From 09fa55f6b09355b2ab0496332966699863a3767e Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Wed, 21 Jun 2017 17:39:41 +0200 Subject: [PATCH] Closedown --- script/LedDetectionProc.py | 46 ++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/script/LedDetectionProc.py b/script/LedDetectionProc.py index a983dce..0ad1ba4 100644 --- a/script/LedDetectionProc.py +++ b/script/LedDetectionProc.py @@ -1,3 +1,16 @@ +from ijutils import * + + +roi_center = (800, 600) +roi_radius = 600 +roi = (roi_center[0] - roi_radius, roi_center[1] - roi_radius, 2* roi_radius, 2*roi_radius) + + + +def in_roi(x,y): + return math.hypot(x-roi_radius, y-roi_radius) < roi_radius + + def integrate (ips): for i in range(len(ips)): if i==0: @@ -21,25 +34,29 @@ def get_image(samples = 1): img.backgroundEnabled=False led_ctrl1.write(0.0) led_ctrl2.write(0.0) -time.sleep(0.5) +time.sleep(1.0) background = get_image(5) +#img.setBackground(background.getBufferedImage()) +#img.captureBackground(1,0) +#show_panel(img.backgroundImage) -show_panel(background) - - -img.background = background -img.backgroundEnabled = True -time.sleep(0.5) - +#img.backgroundEnabled = True +led_ctrl1.write(0.40) +led_ctrl2.write(0.40) +time.sleep(1.0) image = get_image(5) +op_image(image, background, "subtract", float_result=True, in_place=True) -invert(aux) -auto_threshold(aux, method = "Percentile") + +show_panel(image.getBufferedImage()) + +invert(image) +auto_threshold(image, method = "MaxEntropy") #Tested ok: MaxEntropy, Triangle, Yen #binary_open(aux) -(results,output) = analyse_particles(aux, 250,1000, +(r,output) = analyse_particles(image, 250,1000, fill_holes = True, exclude_edges = False, print_table=False, output_image = "outlines", minCirc = 0.3 , maxCirc = 1.0) @@ -53,8 +70,9 @@ for row in range (r.counter): print str(npoints) + " - " + points -print results - - +print r +#show_panel(output.getBufferedImage()) + +#img.backgroundEnabled=False