diff --git a/config/devices - Copy.properties b/config/devices - Copy.properties new file mode 100644 index 0000000..cc3672f --- /dev/null +++ b/config/devices - Copy.properties @@ -0,0 +1,67 @@ +img=ch.psi.pshell.prosilica.Prosilica|25001 "PacketSize=1522;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=300;RegionY=200;Width=1000;Height=1000"|||false +gripper_cam=ch.psi.pshell.imaging.MjpegSource|http://129.129.110.114/axis-cgi/mjpg/video.cgi||-1000| +microscan=ch.psi.pshell.serial.TcpDevice|129.129.100.200:2001||| +microscan_cmd=ch.psi.pshell.serial.TcpDevice|129.129.100.200:2003||| +ue=LaserUE|COM4|||false +#robot=RobotTcp|127.0.0.1:1000||| +#onewire=ch.psi.pshell.serial.TcpDevice|129.129.126.83:5000||| +puck_detection=ch.psi.mxsc.PuckDetection|tell-raspberrypi:5556||| +#robot_modbus=ch.psi.pshell.modbus.ModbusTCP|129.129.126.100:502||| +#jf1=ch.psi.pshell.modbus.AnalogInput|robot_modbus 0||100| +#jf2=ch.psi.pshell.modbus.AnalogInput|robot_modbus 1||100| +#jf3=ch.psi.pshell.modbus.AnalogInput|robot_modbus 2||100| +#jf4=ch.psi.pshell.modbus.AnalogInput|robot_modbus 3||100| +#jf5=ch.psi.pshell.modbus.AnalogInput|robot_modbus 4||100| +#jf6=ch.psi.pshell.modbus.AnalogInput|robot_modbus 5||100| +#robot_sts=ch.psi.pshell.modbus.AnalogInputArray|robot_modbus 6 6||100| +#robot_cmd=ch.psi.pshell.modbus.AnalogOutput|robot_modbus 12||| +#robot_args=ch.psi.pshell.modbus.AnalogOutputArray|robot_modbus 47 12||| +#robot_req=ch.psi.pshell.modbus.AnalogOutput|robot_modbus 13||| +#robot_ack=ch.psi.pshell.modbus.AnalogInput|robot_modbus 14||| +#robot_ret=ch.psi.pshell.modbus.AnalogInputArray|robot_modbus 15 12||| +#wago_back=ch.psi.pshell.modbus.ModbusTCP|SF-TEST-WAGO1:502||| +wago=ch.psi.pshell.modbus.ModbusTCP|wago-mxsc-1:502||| +led_ok_1=ch.psi.pshell.modbus.DigitalInput|wago 0||1000| +led_ok_2=ch.psi.pshell.modbus.DigitalInput|wago 1||1000| +led_ok_3=ch.psi.pshell.modbus.DigitalInput|wago 2||1000| +feedback_local_safety=ch.psi.pshell.modbus.DigitalInput|wago 3||1000| +feedback_psys_safety=ch.psi.pshell.modbus.DigitalInput|wago 4||1000| +filling_phase_separator=ch.psi.pshell.modbus.DigitalInput|wago 5||1000| +filling_dewar=ch.psi.pshell.modbus.DigitalInput|wago 6||1000| +dewar_level_high_alarm=ch.psi.pshell.modbus.DigitalInput|wago 7||1000| +guiding_tool_park=ch.psi.pshell.modbus.DigitalInput|wago 8||1000| +air_pressure_ok=ch.psi.pshell.modbus.DigitalInput|wago 9||1000|false +n2_pressure_ok=ch.psi.pshell.modbus.DigitalInput|wago 10||1000| +he_chamber_valve_1=ch.psi.pshell.modbus.DigitalInput|wago 15||1000| +he_chamber_valve_2=ch.psi.pshell.modbus.DigitalInput|wago 16||1000| +relays=ch.psi.pshell.modbus.DigitalOutputArray|wago 0 16||1000| +release_local_safety=ch.psi.pshell.modbus.DigitalOutput|wago 0||| +release_psys_safety=ch.psi.pshell.modbus.DigitalOutput|wago 1||| +ln2_main_power=ch.psi.pshell.modbus.DigitalOutput|wago 2||| +rim_heater=ch.psi.pshell.modbus.DigitalOutput|wago 3||| +phase_separator_ln2=ch.psi.pshell.modbus.DigitalOutput|wago 4||| +dewar_ln2=ch.psi.pshell.modbus.DigitalOutput|wago 5|||false +valve_he_chamber=ch.psi.pshell.modbus.DigitalOutput|wago 6||| +gripper_dryer=ch.psi.pshell.modbus.DigitalOutput|wago 7||| +valve_1=ch.psi.pshell.modbus.DigitalOutput|wago 8||| +valve_2=ch.psi.pshell.modbus.DigitalOutput|wago 9||| +valve_3=ch.psi.pshell.modbus.DigitalOutput|wago 10||| +valve_4=ch.psi.pshell.modbus.DigitalOutput|wago 11||| +#spare_do_1=ch.psi.pshell.modbus.DigitalOutput|wago 12||| +#spare_do_2=ch.psi.pshell.modbus.DigitalOutput|wago 13||| +#spare_do_3=ch.psi.pshell.modbus.DigitalOutput|wago 14||| +#spare_do_4=ch.psi.pshell.modbus.DigitalOutput|wago 15||| +phase_separator_level=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 0||10000| +dewar_level=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 1||10000| +rim_heater_temp=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 2||10000| +air_pressure=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 3||10000| +n2_pressure=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 4||10000| +#spare_ai_1=ch.psi.pshell.modbus.AnalogInput|wago 5||| +#spare_ai_2=ch.psi.pshell.modbus.AnalogInput|wago 6||| +#spare_ai_3=ch.psi.pshell.modbus.AnalogInput|wago 7||| +led_ctrl_1=ch.psi.pshell.modbus.ProcessVariable|wago 0||| +led_ctrl_2=ch.psi.pshell.modbus.ProcessVariable|wago 1||| +led_ctrl_3=ch.psi.pshell.modbus.ProcessVariable|wago 2||| +#spare_ao_3=ch.psi.pshell.modbus.AnalogOutput|wago 3||| +#cam=ch.psi.pshell.epics.AreaDetector|MX-SAMCAM||| +#img_back=ch.psi.pshell.imaging.CameraSource|cam||-100| diff --git a/config/devices.properties b/config/devices.properties index 37a20a1..bd8c792 100644 --- a/config/devices.properties +++ b/config/devices.properties @@ -1,4 +1,5 @@ img=ch.psi.pshell.prosilica.Prosilica|25001 "PacketSize=1522;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=300;RegionY=200;Width=1000;Height=1000"|||false +gripper_cam=ch.psi.pshell.imaging.MjpegSource|http://129.129.110.114/axis-cgi/mjpg/video.cgi||100| microscan=ch.psi.pshell.serial.TcpDevice|129.129.100.200:2001||| microscan_cmd=ch.psi.pshell.serial.TcpDevice|129.129.100.200:2003||| ue=LaserUE|COM4|||false diff --git a/devices/gripper_cam.properties b/devices/gripper_cam.properties new file mode 100644 index 0000000..77b2bc4 --- /dev/null +++ b/devices/gripper_cam.properties @@ -0,0 +1,20 @@ +#Mon Jun 18 11:16:55 CEST 2018 +flipHorizontally=false +flipVertically=false +grayscale=false +invert=false +rescaleFactor=1.0 +rescaleOffset=0.0 +roiHeight=-1 +roiWidth=-1 +roiX=0 +roiY=0 +rotation=0.0 +rotationCrop=false +scale=1.0 +spatialCalOffsetX=NaN +spatialCalOffsetY=NaN +spatialCalScaleX=NaN +spatialCalScaleY=NaN +spatialCalUnits=mm +transpose=false diff --git a/plugins/MXSC-1.10.0.jar b/plugins/MXSC-1.10.0.jar index f4abe15..d9bb0b3 100644 Binary files a/plugins/MXSC-1.10.0.jar and b/plugins/MXSC-1.10.0.jar differ diff --git a/script/imgproc/CreateMask.py b/script/imgproc/CreateMask.py new file mode 100644 index 0000000..98b3498 --- /dev/null +++ b/script/imgproc/CreateMask.py @@ -0,0 +1,29 @@ + +mask_img = new_image(img.getOutput().getWidth(), img.getOutput().getHeight(), image_type="byte", title = "mask_img", fill_color = Color.BLACK) + +mask_radius = 14 +mask_points = [] + + +def to_img_coords(absolute_coords): + return [img.getCalibration().convertToImageX(absolute_coords[0]), img.getCalibration().convertToImageY(absolute_coords[1])] + +for p in _puck_list: + mask_points.append(to_img_coords(p.led_mini)) + mask_points.append(to_img_coords(p.led_uni)) + + + +i = mask_img.getBufferedImage() +for p in mask_points: + #i.setRGB(p[0], p[1], 0xFFFFFF) + for x in range (p[0]-mask_radius, p[0]+mask_radius): + for y in range (p[1]-mask_radius, p[1]+mask_radius): + if math.hypot(x-p[0], y-p[1]) <= mask_radius: + i.setRGB(x,y, 0xFFFFFF) + + +mask_img = load_image(i) +#show_panel( mask_img.getBufferedImage()) + +set_return(mask_img) \ No newline at end of file diff --git a/script/imgproc/LedDetectionProc.py b/script/imgproc/LedDetectionProc.py index 39c628c..37728d9 100644 --- a/script/imgproc/LedDetectionProc.py +++ b/script/imgproc/LedDetectionProc.py @@ -4,6 +4,7 @@ COVER_PRESENT = True ROOM_TEMP = is_room_temp() +USE_MASK = True if get_exec_pars().source == CommandSource.ui: PLOT = None @@ -23,9 +24,9 @@ print "Block id: ", block_id number_frames = 5 if ROOM_TEMP else 10 -number_backgrounds = 5 if ROOM_TEMP else 10 -minimum_size = 150 -maximum_size = 1500 +number_backgrounds = 5 if ROOM_TEMP else 5 +minimum_size = 78 # r = 5 # 150 +maximum_size = 750 # r = 15 #1500 min_circ = 0.2 threshold_method = "MaxEntropy" if ROOM_TEMP else "Default" #Apparently good for LN2: Default, Intermodes, IsoData, Otsu @@ -52,13 +53,21 @@ image = average_frames(number_frames) set_led_state(False) op_image(image, background, "subtract", float_result=True, in_place=True) +image=grayscale(image) -if RENDERER is not None: +if RENDERER is not None and RENDERER.isShowing(): RENDERER.setImage(None, image.getBufferedImage(), None) else: RENDERER = show_panel(image.getBufferedImage()) RENDERER.clearOverlays() +if USE_MASK: + mask_img = run("imgproc/CreateMask") + #mask_img=grayscale(mask_img) + #show_panel( mask_img.getBufferedImage()) + op_image(image, mask_img, "and", float_result=False, in_place=True) + RENDERER.setImage(None, image.getBufferedImage(), None) + invert(image) if threshold_method == "Manual": threshold(image, threshold_range[0], threshold_range[1])