Beispiel #1
0
def find_color(frame, lower, upper,
               stage):  ### Color detecting to find sinho_signal or jucha_sign

    detector = blob_param_siljun.setting(stage)

    hsv = cv2.cvtColor(frame,
                       cv2.COLOR_BGR2HSV)  ### process rgb_image to hsv_image
    mask_red = cv2.inRange(hsv, lower, upper)

    reversmask = 255 - mask_red  ### Detect blobs
    keypoints = detector.detect(reversmask)
    #print('keypoints',keypoints)
    """	
	if stage ==0:
		cv2.imshow('sinho',reversmask)
	
	if stage ==1:
		cv2.imshow('jucha',reversmask)
	if stage ==4:
		cv2.imshow('obstacle',reversmask)
	"""
    if len(keypoints) > 0 and stage == 1:
        point = []

        for i in keypoints:
            point.append(i.pt)

        #print('points',point)

        return point

    if len(keypoints) > 0 and stage == 4:
        point = []

        for i in keypoints:
            point.append(i.pt)

        #print('points',point)

        return point

    elif stage == 0:

        return keypoints
def find_color(frame,lower,upper,stage):  ### 신호/주차 표지판에서 컬러 인식

	detector=blob_param_siljun.setting(stage)

		
	hsv=cv2.cvtColor(frame,cv2.COLOR_BGR2HSV) ### process rgb_image to hsv_image 
	mask_red=cv2.inRange(hsv,lower,upper)


	reversmask=255-mask_red ### Detect blobs
	keypoints = detector.detect(reversmask)
	
	if len(keypoints)>0 and stage==1:
		point=[]
		cv2.imshow('zzz',reversmask)
		for i in keypoints:
			point.append(i.pt)
		
		return point

	else:

		
		return keypoints