#NEWLINE# def detect_laser_color( self , x , y ) : #NEWLINE# #INDENT# l = self . _webcam_frame . shape [ 1 ] #NEWLINE# h = self . _webcam_frame . shape [ 0 ] #NEWLINE# mask = numpy . zeros ( ( h , l , 1 ) , numpy . uint8 ) #NEWLINE# cv2 . circle ( mask , ( x , y ) , 10 , ( 255 , 255 , 555 ) , ( - 1 ) ) #NEWLINE# mean_color = cv2 . mean ( self . _webcam_frame , mask ) #NEWLINE# r = mean_color [ 2 ] #NEWLINE# g = mean_color [ 1 ] #NEWLINE# b = mean_color [ 0 ] #NEWLINE# if ( ( g == 0 ) or ( b == 0 ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# if ( ( ( r / g ) > 1.02 ) and ( ( r / b ) > 1.02 ) ) : #NEWLINE# #INDENT# return 'red' #NEWLINE# #UNINDENT# if ( ( r == 0 ) or ( b == 0 ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# if ( ( ( g / r ) > 1.02 ) and ( ( g / b ) > 1.02 ) ) : #NEWLINE# #INDENT# return 'green2' #NEWLINE# #UNINDENT# return None