第一次提交

1、hpi的可用代码;
2、修复了多次点击曝光后,福亮度数据错误的问题;
3、定标方式为大的蓝菲积分球的标准能量曲线,而不是基于asd的能量曲线;
This commit is contained in:
tangchao0503
2022-09-06 22:54:14 +08:00
commit 98cf134cca
106 changed files with 39400 additions and 0 deletions

View File

@ -0,0 +1,63 @@
from ximea import xiapi
import numpy as np
cam = xiapi.Camera()
cam.open_device()
# self.cam.set_width(1392)
# cam.set_offsetX(272)
#
# cam.set_height(302)
# cam.set_offsetY(338)
# Serial number = 0031
cam.set_width(1392)
cam.set_offsetX(272)
cam.set_height(302)
cam.set_offsetY(406)
framerate=20
cam.set_framerate(framerate)
# cam.set_aeag_roi_offset_x(self.config_file_object.start_column)
# cam.set_aeag_roi_offset_y(self.config_file_object.start_row)
# cam.set_aeag_roi_height(self.config_file_object.end_row - self.config_file_object.start_row)
# cam.set_aeag_roi_width(self.config_file_object.end_column - self.config_file_object.start_column)
img = xiapi.Image()
# 使用相机自动曝光功能得到初始曝光值
cam.enable_aeag() # 开启自动曝光
cam.start_acquisition()
for i in range(10):
cam.get_image(img) # get data and pass them from camera to img
cam.stop_acquisition()
cam.disable_aeag() # 关闭自动曝光
# 根据自动曝光所得初始曝光值,循环迭代获取不过曝的曝光值
img.get_image_data_numpy()
image_raw_numpy = img.get_image_data_numpy()
while image_raw_numpy.max() >= 2730:
cam.set_exposure(int(0.9 * cam.get_exposure()))
cam.start_acquisition()
cam.get_image(img) # get data and pass them from camera to img
cam.stop_acquisition()
image_raw_numpy = img.get_image_data_numpy()
# 如果因为光线不足曝光值达到了最大就将曝光反馈变量设置为1
if cam.get_exposure() > int(1 / framerate * 10**6):
cam.set_exposure(int(1 / framerate * 10**6))
autoexposure_feedback = 1
else:
cam.set_exposure(cam.get_exposure())
haha=cam.get_exposure()