Ejemplo n.º 1
0
	def getConeCenterPoint(self,frame):
		o_contours = cvUtil.getContoursForColor(frame,FrameProcessor.ORANGE_LOW_HSV,FrameProcessor.ORANGE_HIGH_HSV,
												FrameProcessor.CONE_MIN_AREA,FrameProcessor.CONE_MAX_AREA,FrameProcessor.CONE_KERNEL)
		if(len(o_contours) > 0):
			lrgContour = cvUtil.getLargestContour(o_contours)
			centerLst = cvUtil.getCenterOfContours([lrgContour])
			cvUtil.drawCircleForPoints(frame,centerLst,3,(0,255,0),3)
			return centerLst[0]
		return None
Ejemplo n.º 2
0
 def getConeCenterPoint(self, frame):
     o_contours = cvUtil.getContoursForColor(frame,
                                             FrameProcessor.ORANGE_LOW_HSV,
                                             FrameProcessor.ORANGE_HIGH_HSV,
                                             FrameProcessor.CONE_MIN_AREA,
                                             FrameProcessor.CONE_MAX_AREA,
                                             FrameProcessor.CONE_KERNEL)
     if (len(o_contours) > 0):
         lrgContour = cvUtil.getLargestContour(o_contours)
         centerLst = cvUtil.getCenterOfContours([lrgContour])
         cvUtil.drawCircleForPoints(frame, centerLst, 3, (0, 255, 0), 3)
         return centerLst[0]
     return None
Ejemplo n.º 3
0
videoCap.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, FRAME_HEIGHT)

kernel = np.ones((2, 2), np.uint8)

while (True):
    ret, frame = videoCap.read()
    cv2.setMouseCallback('frame', fc.frameClickEvent, frame)
    hsvFrame = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
    threshImg = cv2.inRange(hsvFrame, selectLowHSV, selectHighHSV)

    algorithms.largestArea = 0
    algorithms.minPtsDistance = sys.float_info.max
    contours = cvUtil.getContoursForColor(frame, selectLowHSV, selectHighHSV,
                                          MIN_CONTOUR_AREA, MAX_CONTOUR_AREA)
    centerLst = algorithms.removeCloseContours(contours, 10)
    cvUtil.drawCircleForPoints(frame, centerLst, 5, (0, 255, 0), 1)
    print centerLst
    closestCenters = algorithms.getNClosestPoints(centerLst, 4)
    cvUtil.drawCircleForPoints(frame, closestCenters, 5, (0, 255, 0), 1)
    '''
	if(closestCenters == None):
		cv2.imshow('frame',frame)
		continue

	lrgTriPtList = algorithms.getLargestTriangle(closestCenters)
	baseCenterPt = algorithms.getClosestPt(lrgTriPtList,closestCenters)
	sortedPts = algorithms.getSortedPtListInTri(baseCenterPt,lrgTriPtList)
	drawDirectionalTriangle(frame,sortedPts)
	
	
	#cvUtil.drawCircleForPoints(frame,closestCenters,10,(0,255,0),2)
Ejemplo n.º 4
0
kernel = np.ones((2,2),np.uint8)

while(True):
	ret,frame = videoCap.read()
	cv2.setMouseCallback('frame',fc.frameClickEvent,frame)
	hsvFrame = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)
	threshImg = cv2.inRange(hsvFrame,selectLowHSV,selectHighHSV)

	
	
	algorithms.largestArea = 0
	algorithms.minPtsDistance = sys.float_info.max
	contours = cvUtil.getContoursForColor(frame,selectLowHSV,selectHighHSV,MIN_CONTOUR_AREA,MAX_CONTOUR_AREA)
	centerLst = algorithms.removeCloseContours(contours,10)
	cvUtil.drawCircleForPoints(frame,centerLst,5,(0,255,0),1)
	print centerLst
	closestCenters = algorithms.getNClosestPoints(centerLst,4)
	cvUtil.drawCircleForPoints(frame,closestCenters,5,(0,255,0),1)
	
	
	'''
	if(closestCenters == None):
		cv2.imshow('frame',frame)
		continue

	lrgTriPtList = algorithms.getLargestTriangle(closestCenters)
	baseCenterPt = algorithms.getClosestPt(lrgTriPtList,closestCenters)
	sortedPts = algorithms.getSortedPtListInTri(baseCenterPt,lrgTriPtList)
	drawDirectionalTriangle(frame,sortedPts)