示例#1
0
def splitOpBlob(floodFillImage, copy, points, line):
"""
Flood fill on bots side of are line, and return the 2 areas
"""
	comp = cv.CvConnectedComp()
	# Get start and stop points
	sizeSplitBlobs = []
	(start_point, stop_point) = line.getPoints()
	for point in points:
		# Get new random color
		color = lib.getRandomColor()
		if (start_point.x == stop_point.x):
			slice1 = floodFillImage[:,0:start_point.x+1]
			cv.cvFloodFill(slice1, cv.cvPoint(start_point.x, start_point.y+1), color, cv.CV_RGB(2,2,2), cv.CV_RGB(2,2,2),comp)
			#removes blobs that have are area under 3
			if (comp.area > 2):
				sizeSplitBlobs.append(comp.area)
				slice2 = copy[:,start_point.x:]
				cv.cvFloodFill(slice2, cv.cvPoint(0, start_point.y+1), color, cv.CV_RGB(2,2,2), cv.CV_RGB(2,2,2),comp)
				sizeSplitBlobs.append(comp.area)
			start_point = point
	return sizeSplitBlobs
示例#2
0
# Superimpose the edges onto the blured image
cv.cvNot(edges, edges)
cv.cvCopy(blurImage, out, edges)

# We're done with the blurred image now
#cv.cvReleaseImage(blurImage)

#print points[:0]
cut = lines[1]
margin = marginCalculator.getPixels(image, cut, 0.024)
component_dictionary = featureDetector.ribbonFloodFill(image, edges, out, cut, margin, lo, up)
#featureDetector.floodFillLine(image, out, points, cut, lo, up, {})
#flags = cv.CV_FLOODFILL_FIXED_RANGE
#flags = 4
color = lib.getRandomColor()
comp = cv.CvConnectedComp()
#cv.cvFloodFill(out, cv.cvPoint(x,y), color, cv.CV_RGB(lo,lo,lo), cv.CV_RGB(up,up,up),comp ,flags)#, None);
#lib.plot(out, cv.cvPoint(x,y), 3, lib.COL_RED)

cv.cvLine(out, cut.p1, cut.p2, lib.COL_RED)
lib.drawMargin(out, cut, margin)

#startpoint = lines[0].getPoints()[0]
#points.append(lines[0].getPoints()[1])
#for point in points:
#	out = floofill.floofill(out, lowerThres, upperThres, startpoint, point, 1)
#	startpoint = point
#for point in points:
#	lib.plot(out, point, 2)
#out = edgeDetector.findEdges(out, 70, 70)