Exemplo n.º 1
0
threshold1 = 70;
threshold2 = 70;
out = cv.cvCreateImage(cv.cvGetSize(image), 8, 3)
edgeDetector.findEdges(image, out, threshold1, threshold2)

print "Finding the golden means in the picture"

lines = lib.findMeans(cv.cvGetSize(image))

print "Test plot and line scanner methods"
points = lineScanner.naiveLineScanner(out, image, lines[0])

out = highgui.cvLoadImage (filename)
outcopy = highgui.cvLoadImage (filename)

(out,areaOfBlobs) = featureDetector.floodFillLine(out, points, lines[0], lo, up)
copy = cv.cvCopy(out,outcopy)
#print "Finding the golden means in the picture"
#lines = lib.findMeans(cv.cvGetSize(out))

#print "Drawing the means"
#lib.drawLines(lines, out)

#out = out[:,points[0].x :]

listOverSizeOfBlobs = statestik.splitOpBlob(out,outcopy,points,lines[0])
#print listOverSizeOfBlobs
#startpoint = lines[0].getPoints()[0]
#points.append(lines[0].getPoints()[1])
#for point in points:
#	out = floofill.floofill(out, lowerThres, upperThres, startpoint, point, 1)
Exemplo n.º 2
0
threshold2 = 70;
out = cv.cvCreateImage(cv.cvGetSize(image), 8, 3)
edgeDetector.findEdges(image, out, threshold1, threshold2)

print "Finding the golden means in the picture"

lines = lib.findGoldenMeans(cv.cvGetSize(image))

cut = lines[0]

print "Test plot and line scanner methods"
points = lineScanner.naiveLineScanner(out, image, cut)

out = highgui.cvLoadImage (filename)

(out, components) = featureDetector.floodFillLine(image, out, points, cut, lo, up)

print components[0].area

# Test
comp = cv.CvConnectedComp()
seed = cv.cvPoint(200, 20)
cv.cvFloodFill(image, seed, lib.COL_RED, cv.CV_RGB(lo,lo,lo), cv.CV_RGB(up,up,up),comp)# ,flags, None);
print comp.area

lib.drawBoundingBoxes(out, components)

#lib.drawLines(out)

winname1 = "Find regions"
winname2 = "original"
Exemplo n.º 3
0
edgeDetector.findEdges(image, out, threshold1, threshold2)

print "Finding the golden means in the picture"

lines = lib.findGoldenMeans(cv.cvGetSize(image))

# Define cut
cut = lines[0]

print "Test plot and line scanner methods"
points = lineScanner.naiveLineScanner(out, cut)

out = highgui.cvLoadImage (filename)

comp_dict = {}
featureDetector.floodFillLine(image, out, points, cut, lo, up, comp_dict)

# Set margin
margin = 15

# Draw margin
lib.drawMargin(out, cut, margin)

# Set up constraints
constraints = regionSelector.Constraints(cv.cvGetSize(image), cut, margin, 0.002, 0.25)

# Prune components
newComponents = regionSelector.pruneRegions(comp_dict, constraints)

# Draw boxes of selected components
#lib.drawBoundingBoxes(out, newComponents)
Exemplo n.º 4
0
edgeDetector.findEdges(image, out, threshold1, threshold2)

print "Finding the golden means in the picture"

lines = lib.findGoldenMeans(cv.cvGetSize(image))

# Define cut
cut = lines[0]

print "Test plot and line scanner methods"
points = lineScanner.naiveLineScanner(out, cut)

out = highgui.cvLoadImage (filename)

comp_dict = {}
featureDetector.floodFillLine(image, out, points, cut, lo, up, comp_dict)

# Set margin
margin = 15

# Draw margin
lib.drawMargin(out, cut, margin)

# Set up constraints
constraints = regionSelector.Constraints(cv.cvGetSize(image), cut, margin, 0.002, 0.25)

# Prune components
newComponents = regionSelector.pruneRegions(comp_dict, constraints)

# Draw boxes of selected components
lib.drawBoundingBoxes(out, newComponents)