《K230 从熟悉到...》图像校正
《庐山派 K230 从熟悉到...》 图像矫正

| 操作 | 函数 | 适用格式 | 参数说明 |
|---|---|---|---|
| 旋转校正 | img.rotation_corr | 未提及限制 | x_rotation等多个旋转、平移、缩放参数 |
| 镜头畸变校正 | image.lens_corr | 未提及限制 | strength:去除畸变程度;zoom:缩放倍数 |
| Gamma 校正 | img.gamma_corr | 未提及限制 | Gamma 值,src_img.gamma_corr(3) |
import time, os, sys
from media.sensor import *
from media.display import *
from media.media import *
sensor = None
fps = time.clock()
try:
sensor = Sensor()
sensor.reset()
sensor.set_framesize(width = 800, height = 480)
sensor.set_pixformat(Sensor.YUV420SP)
bind_info = sensor.bind_info()
Display.bind_layer(**bind_info, layer = Display.LAYER_VIDEO1)
# 通道2 320*240
sensor.set_framesize(Sensor.QVGA, chn = CAM_CHN_ID_2)
sensor.set_pixformat(Sensor.RGB565, chn = CAM_CHN_ID_2)
Display.init(Display.ST7701)
MediaManager.init()
sensor.run()
fps = time.clock()
# 注意他们2个显示都不在一个层上面!!!
while True:
fps.tick()
os.exitpoint()
img = sensor.snapshot(chn = CAM_CHN_ID_2)
img.rotation_corr(0.5) #旋转校正
#img.lens_corr(3.0) # 镜头畸变校正
#img.gamma_corr(7) # Gamma 校正
Display.show_image(img, x = 800-320, layer = Display.LAYER_OSD1)
print(fps.fps())
except KeyboardInterrupt as e:
print("user stop: ", e)
except BaseException as e:
print(f"Exception {e}")
finally:
# sensor stop run
if isinstance(sensor, Sensor):
sensor.stop()
# deinit display
Display.deinit()
os.exitpoint(os.EXITPOINT_ENABLE_SLEEP)
time.sleep_ms(100)
# release media buffer
MediaManager.deinit()
1944

被折叠的 条评论
为什么被折叠?



