diff --git a/script/device/Image.py b/script/device/Image.py index 7fe73fe..a926e6a 100644 --- a/script/device/Image.py +++ b/script/device/Image.py @@ -22,39 +22,20 @@ class Image(DeviceBase, Readable): tmp_file = self.pixel.image_root_folder + "tmp/spec_image_info.dat" copyfile(filename, tmp_file) - ret = img_get_int(tmp_file, threshold1, threshold2, threshold3, threshold4, \ + return 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, \ self.roi[0], self.roi[1], self.roi[2], self.roi[3], self.broi[0], self.broi[1], self.broi[2], self.broi[3]) - - - - - #unixCommand = "%s%s %s %d %d %d %d -median 30" % (commandDir,"/bin/image_get_int.py","/tmp/spec_image_info.dat", \ - # threshold1, threshold2, threshold3, threshold4) - #ret = run("image_get_int.py", [None, tmp_file, threshold1, threshold2, threshold3, threshold4, "-median", 30]) - (I_sum, area_I, thresh1_count, thresh2_count, thresh3_count, thresh4_count, I_sum_bgr, area_bgr) = ret + print ret return I_sum - - """ - IMAGE_I_SUM = "" - IMAGE_AREA_SIG = "" - IMAGE_THRESH1_COUNT = "" - IMAGE_THRESH2_COUNT = "" - IMAGE_THRESH3_COUNT = "" - IMAGE_I_BG = "" - IMAGE_AREA_BG = "" - } - if (IMAGE_AREA_BG > 0){ - IMAGE_I_SIG = IMAGE_I_SUM - ((IMAGE_I_BG / IMAGE_AREA_BG) * IMAGE_AREA_SIG) - } else { - IMAGE_I_SIG = IMAGE_I_SUM - } - """ - def read(self): - return self.get_int() + (I_sum, area_I, thresh1_count, thresh2_count, thresh3_count, thresh4_count, I_sum_bgr, area_bgr) = self.get_int() + ret = I_sum + if area_bgr > 0: + ret = ret - ((I_sum_bgr / area_bgr) * area_I) + return ret + add_device( Image("image", pixel), True)