M5StickV参考示例3-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1512|回复: 0

M5StickV参考示例3

[复制链接]
发表于 2020-3-23 16:05 | 显示全部楼层 |阅读模式
本帖最后由 vany5921 于 2020-3-23 16:37 编辑

[mw_shl_code=python,true]1.获取补色图像
lcd.init()
lcd.direction(lcd.YX_LRUD)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)

while True:

    img = sensor.snapshot()
#颜色反转
    img.negate()

    lcd.display(img)[/mw_shl_code]


2.重设图片大小
[mw_shl_code=python,true]
import lcd
import sensor

lcd.init()
lcd.direction(lcd.YX_LRUD)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)

while True:
    img = sensor.snapshot()
    resized_img = img.resize(lcd.width(), lcd.height())
    lcd.display(resized_img)[/mw_shl_code]

3.中间值滤波
[mw_shl_code=python,true]import lcd
import sensor
lcd.init()
lcd.direction(lcd.YX_LRUD)

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)

while True:
    img = sensor.snapshot()
    img.midpoint(1, bias = 1.0)
    lcd.display(img)[/mw_shl_code]


4.gamma矫正
[mw_shl_code=python,true]import lcd
import sensor

lcd.init()
lcd.direction(lcd.YX_LRUD)

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)

while True:
    img = sensor.snapshot()
    img.gamma_corr(gamma = 1.5, contrast = 1.0, brightness = 0.0)
    lcd.display(img)[/mw_shl_code]

5.腐蚀消除相近颜色线条
[mw_shl_code=python,true]
import lcd
import sensor
lcd.init()
lcd.direction(lcd.YX_LRUD)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)

while True:
    img = sensor.snapshot()
    img.erode(1)
    lcd.display(img)[/mw_shl_code]


6.消除亮度
[mw_shl_code=python,true]import lcd
import sensor

lcd.init()
lcd.direction(lcd.YX_LRUD)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)

while True:
    img = sensor.snapshot()
    img.illuminvar()
    lcd.display(img)[/mw_shl_code]


7.拉普拉斯滤波锐化
[mw_shl_code=python,true]
import lcd
import sensor
lcd.init()
lcd.direction(lcd.YX_LRUD)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)

while True:
    img = sensor.snapshot()
    img.laplacian(1)
    lcd.display(img)[/mw_shl_code]

8.彩虹色阶
[mw_shl_code=python,true]import lcd
import sensor
lcd.init()
lcd.direction(lcd.YX_LRUD)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)
while True:
    img = sensor.snapshot()
    img.to_rainbow()
    lcd.display(img) [/mw_shl_code]
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 08:40 , Processed in 0.094022 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表