Script execution
This commit is contained in:
@@ -21,9 +21,9 @@ def detect_led(ip):
|
||||
output_image = "outlines", minCirc = 0.4, maxCirc = 1.0)
|
||||
"""
|
||||
|
||||
roi_center = (2322, 1025)
|
||||
roi_radius = 675
|
||||
integration_count = 5
|
||||
roi_center = (1995, 1092)
|
||||
roi_radius = 680
|
||||
integration_count = 10
|
||||
integration_continuous = False
|
||||
integration_partial = False
|
||||
frames = []
|
||||
@@ -35,7 +35,7 @@ color_roi = Color(0, 128, 0)
|
||||
|
||||
renderer = show_panel(img)
|
||||
renderer.clearOverlays()
|
||||
ov_roi_shape = Ellipse(Pen(color_roi, 0,), java.awt.Point(roi[0], roi[1]), java.awt.Dimension(roi[2], roi[3]))
|
||||
ov_roi_shape = Ellipse(Pen(colordet-_roi, 0,), java.awt.Point(roi[0], roi[1]), java.awt.Dimension(roi[2], roi[3]))
|
||||
ov_roi_bound = Rect(Pen(color_roi, 0, Pen.LineStyle.dotted), java.awt.Point(roi[0], roi[1]), java.awt.Dimension(roi[2], roi[3]))
|
||||
ov_roi_center = Crosshairs(Pen(color_roi, 0), java.awt.Point(roi_center[0],roi_center[1]), java.awt.Dimension(15,15))
|
||||
|
||||
@@ -79,7 +79,7 @@ class MyFilter(Filter):
|
||||
"""
|
||||
|
||||
def in_roi(x,y):
|
||||
return math.hypot(x-roi_center[0], y-roi_center[1]) < roi_radius
|
||||
return math.hypot(x-roi_radius, y-roi_radius) < roi_radius
|
||||
|
||||
|
||||
def integrate (ips):
|
||||
@@ -98,7 +98,7 @@ def detect_led(ip):
|
||||
x=ip
|
||||
aux = sub_image(ip, roi[0], roi[1], roi[2], roi[3])
|
||||
grayscale(aux)
|
||||
gaussian_blur(aux)
|
||||
#gaussian_blur(aux)
|
||||
|
||||
if (integration_count>1):
|
||||
frames.append(aux)
|
||||
@@ -117,8 +117,8 @@ def detect_led(ip):
|
||||
#subtract_background(aux)
|
||||
auto_threshold(aux)
|
||||
#binary_open(aux)
|
||||
(results,output) = analyse_particles(aux, 500,4000,
|
||||
fill_holes = True, exclude_edges = True,print_table=False,
|
||||
(results,output) = analyse_particles(aux, 500,6000,
|
||||
fill_holes = True, exclude_edges = False, print_table=False,
|
||||
output_image = "outlines", minCirc = 0.3
|
||||
, maxCirc = 1.0)
|
||||
r=results
|
||||
@@ -137,16 +137,16 @@ def detect_led(ip):
|
||||
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))) + ", " + str(int(r.getValue("YM", row))) + ")"
|
||||
points = points + " (" + str(int(r.getValue("XM", row))+roi[0]) + ", " + str(int(r.getValue("YM", row))+roi[1]) + ")"
|
||||
npoints = npoints + 1
|
||||
print str(r.counter) + " - " + points
|
||||
print str(npoints) + " - " + points
|
||||
|
||||
last_ret = (results,output)
|
||||
if not integration_continuous:
|
||||
frames = []
|
||||
|
||||
if npoints!=10:
|
||||
save_image(output, "{images}/" + str(datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))+".png", "png")
|
||||
if npoints!=12:
|
||||
save_image(op_image(aux, output,"xor", in_place=False), "{images}/" + str(datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))+".png", "png")
|
||||
#return (results,aux)
|
||||
return (results,output)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user