diff --git a/config/settings.properties b/config/settings.properties index 3271b06..16bb961 100644 --- a/config/settings.properties +++ b/config/settings.properties @@ -1,4 +1,4 @@ -#Wed Jul 31 16:57:45 CEST 2019 +#Wed Jul 31 17:19:22 CEST 2019 count_time=1.0 geometry=fourcv roi=173 88 285 136 diff --git a/script/device/Image.py b/script/device/Image.py index 8aa14a4..6ae1a52 100644 --- a/script/device/Image.py +++ b/script/device/Image.py @@ -8,19 +8,10 @@ class ImageIntensity(DeviceBase, Readable): self.setParent(image) def read(self): - global AUTO_THRESH1_COUNT, AUTO_THRESH2_COUNT, AUTO_THRESH3_COUNT, AUTO_THRESH4_COUNT + p=self.getParent() ret = self.getParent().read() if ret is not None: - (I_sum, area_I, thresh1_count, thresh2_count, thresh3_count, thresh4_count, I_sum_bgr, area_bgr) = ret - AUTO_THRESH1_COUNT=thresh1_count - AUTO_THRESH2_COUNT=thresh2_count - AUTO_THRESH3_COUNT=thresh3_count - AUTO_THRESH4_COUNT=thresh4_count - AUTO_THRESH1 = self.getParent().pixel.threshold1 - AUTO_THRESH2 = self.getParent().pixel.threshold2 - AUTO_THRESH3 = self.getParent().pixel.threshold3 - AUTO_THRESH4 = self.getParent().pixel.threshold4 - + (I_sum, area_I, thresh1_count, thresh2_count, thresh3_count, thresh4_count, I_sum_bgr, area_bgr) = ret ret = I_sum #if area_bgr > 0: # ret = ret - ((I_sum_bgr / area_bgr) * area_I) @@ -75,6 +66,7 @@ class Image(DeviceBase, Readable): self.last_filename = None self.last_image = None self.image_lock = threading.Lock() + self.I_sum, self.area_I, self.thresh1_count, self.thresh2_count, self.thresh3_count, self.thresh4_count, self.I_sum_bgr, self.area_bgr = None,None,None,None,None,None,None,None def get_int(self, filename = None): @@ -101,8 +93,10 @@ class Image(DeviceBase, Readable): ret = img_get_int(tmp_file, threshold1, threshold2, threshold3, threshold4, \ self.pixel.image_header_length, self.pixel.PIX_XDIM, self.pixel.PIX_YDIM,self.pixel.PIX_COLOR_DEPTH, \ roi[0], roi[1], roi[2], roi[3], bkroi[0], bkroi[1], bkroi[2], bkroi[3]) + self.I_sum, self.area_I, self.thresh1_count, self.thresh2_count, self.thresh3_count, self.thresh4_count, self.I_sum_bgr, self.area_bgr = ret except: log("Error calculating intensity: " + str(filename) + " - " + str(sys.exc_info()[1]), False) + self.I_sum, self.area_I, self.thresh1_count, self.thresh2_count, self.thresh3_count, self.thresh4_count, self.I_sum_bgr, self.area_bgr = None,None,None,None,None,None,None,None ret = None self.setCache(ret, None) return ret @@ -134,6 +128,7 @@ class Image(DeviceBase, Readable): return ret finally: self.image_lock.release() + def read(self): return self.get_int()