コード例 #1
0
filename = sys.argv[1]

image = highgui.cvLoadImage (filename)

if not image:
	print "Error loading image '%s'" % filename
	print ""
	sys.exit(-1)

winname = "featureDetectorTest"

highgui.cvNamedWindow (winname, highgui.CV_WINDOW_AUTOSIZE)

print "Attempt to find features"
points = featureDetector.getGoodFeatures(image)

print "Found %s features" % len(points)

for point in points:
	lib.plot(image, point)

while True:
	highgui.cvShowImage (winname, image)

	c = highgui.cvWaitKey(0)
	
	if c == 'q':
		print "Exiting ..."
		print ""
		sys.exit(0)
コード例 #2
0
image = highgui.cvLoadImage (filename)

if not image:
	print "Error loading image '%s'" % filename
	print ""
	sys.exit(-1)

winname = "basicFunctionalityTest"

highgui.cvNamedWindow (winname, highgui.CV_WINDOW_AUTOSIZE)

print "Finding the golden means in the picture"
lines = lib.findGoldenMeans(cv.cvGetSize(image))

print "Drawing the means"
lib.drawLines(image)

print "Test plot function and intersection function"
lib.plot(image, lines[0].intersection(lines[2]))
lib.plot(image, lib.intersection(lines[1], lines[3]), color=lib.COL_BLUE)

while True:
	highgui.cvShowImage (winname, image)

	c = highgui.cvWaitKey(0)
	
	if c == 'q':
		print "Exiting ..."
		print ""
		sys.exit(0)
コード例 #3
0
ファイル: gridTest.py プロジェクト: thorlund/gyldnesnit
# 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)
# Get grids
grid = grid.gridIt(out, newComponents, 5)
for point in grid:
	lib.plot(image, point, 1)

#lib.drawLines(out)

winname = "Find regions"
=======
out = edgeDetector.findEdges(image, 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)
コード例 #4
0
if not image:
	print "Error loading image '%s'" % filename
	print ""
	sys.exit(-1)

out = cv.cvCreateImage(cv.cvGetSize(image), 8, 3)
edgeDetector.findEdges(image, out, threshold1, threshold2)

winname = "lineScannerTest"

highgui.cvNamedWindow (winname, highgui.CV_WINDOW_AUTOSIZE)

print "Finding the golden means in the picture"
lines = lib.findGoldenMeans(cv.cvGetSize(image))

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

for point in points:
	lib.plot(out, point, 2)

while True:
	highgui.cvShowImage (winname, out)

	c = highgui.cvWaitKey(0)
	
	if c == 'q':
		print "Exiting ..."
		print ""
		sys.exit(0)