python - OpenCV: Extract the red light sources -


i have image in there few red lights. need save coordinates of points in array: enter image description here

and here's code:

             red, green, blue = cv2.split(frame)              rbin, thresholdimg = cv2.threshold(red, 240, 255, cv2.thresh_binary)                  new = np.argwhere(thresholdimg == 255)             #get red pixels              if len(new) != 0:                                                     xs = []                  ys = []                   n, m = new.shape                  counter = 0                  (x,y) in new:  #extract red pixels positions                         xs = np.append(xs,y)                         ys = np.append(ys,x) 

now in arrays xs , ys have (x,y) coordinates of "white" pixels respectively. need count number of red lights , if 2, check whether correct distance between them. tried it:

 if ((np.any(new[counter+1] - new[counter] >= minseamlength)) , (np.any(new[counter+1] - new[counter] <= maxseamlength))):   ... 

this way tried check if size of gap in array fits me. isn't working.

any help?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -