33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
class BaslerRoiIntensity (ImageMeasurement):
|
|
def __init__(self, x,y,w,h):
|
|
ImageMeasurement.__init__(self, image2, "roi"+ str([x,y,w,h]))
|
|
self.x, self.y, self.w, self.h, = x,y,w,h
|
|
def calc(self, data):
|
|
return data.getRoi(Rectangle(self.x, self.y, self.w, self.h)).integrate(False)
|
|
|
|
class Profile(ReadableArray):
|
|
def read(self):
|
|
return image2.data.integrateHorizontally(False)
|
|
def getSize(self):
|
|
return image2.data.getWidth()
|
|
|
|
def before_read(pos, scan):
|
|
cam2.start();
|
|
image2.waitNext(3000)
|
|
|
|
EXPOSITION = [0.001, 0.002, 0.005, 0.01 , 0.025, 0.05, 0.1, 0.25, 0.5, 1.0]
|
|
def before_pass(pass_id, scan):
|
|
#exposure = (0.005) * (pass_ids)
|
|
exposure = EXPOSITION[pass_id-1]
|
|
while cam2.exposure != exposure:
|
|
cam2.setExposure(exposure)
|
|
time.sleep(0.5)
|
|
print "Exposure = ", exposure
|
|
|
|
set_device_alias(image2.intensity, "Intensity")
|
|
p=Profile()
|
|
set_device_alias(p, "Profile_1d")
|
|
sensors = [image2.intensity, Profile(),p,BaslerRoiIntensity(10,10,20,20)]
|
|
tscan(sensors, 10, 1.0, passes = 10, \
|
|
before_read=before_read, before_pass=before_pass, \
|
|
save=False, line_plots=[p]) |