Script execution
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
from ijutils import *
|
||||
|
||||
from ch.psi.pshell.imaging.Overlays import *
|
||||
import ch.psi.pshell.imaging.Pen as Pen
|
||||
|
||||
roi_center = (800, 600)
|
||||
roi_radius = 600
|
||||
roi = (roi_center[0] - roi_radius, roi_center[1] - roi_radius, 2* roi_radius, 2*roi_radius)
|
||||
|
||||
#roi = (0,0,1600,1200)
|
||||
|
||||
|
||||
def in_roi(x,y):
|
||||
@@ -34,7 +35,8 @@ def get_image(samples = 1):
|
||||
img.backgroundEnabled=False
|
||||
led_ctrl1.write(0.0)
|
||||
led_ctrl2.write(0.0)
|
||||
time.sleep(1.0)
|
||||
time.sleep(0.1)
|
||||
img.waitNext(100)
|
||||
|
||||
background = get_image(5)
|
||||
#img.setBackground(background.getBufferedImage())
|
||||
@@ -45,13 +47,15 @@ background = get_image(5)
|
||||
|
||||
led_ctrl1.write(0.40)
|
||||
led_ctrl2.write(0.40)
|
||||
time.sleep(1.0)
|
||||
time.sleep(0.1)
|
||||
img.waitNext(100)
|
||||
image = get_image(5)
|
||||
|
||||
op_image(image, background, "subtract", float_result=True, in_place=True)
|
||||
|
||||
|
||||
show_panel(image.getBufferedImage())
|
||||
renderer = show_panel(image.getBufferedImage())
|
||||
renderer.clearOverlays()
|
||||
|
||||
invert(image)
|
||||
auto_threshold(image, method = "MaxEntropy") #Tested ok: MaxEntropy, Triangle, Yen
|
||||
@@ -65,11 +69,13 @@ points = ""
|
||||
npoints = 0
|
||||
for row in range (r.counter):
|
||||
if in_roi(r.getValue("XM",row), r.getValue("YM",row)):
|
||||
points = points + " (" + str(int(r.getValue("XM", row))+roi[0]) + ", " + str(int(r.getValue("YM", row))+roi[1]) + ")"
|
||||
#x, y = int(r.getValue("XM", row))+roi[0], int(r.getValue("YM", row))+roi[1]
|
||||
x, y = int(r.getValue("XM", row)), int(r.getValue("YM", row))
|
||||
points = points + " (" + str(x) + ", " + str(y) + ")"
|
||||
npoints = npoints + 1
|
||||
print str(npoints) + " - " + points
|
||||
|
||||
renderer.addOverlay(Crosshairs(Pen(java.awt.Color.MAGENTA), java.awt.Point(x,y), java.awt.Dimension(15,15)))
|
||||
|
||||
print str(npoints) + " - " + points
|
||||
print r
|
||||
#show_panel(output.getBufferedImage())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user