svn repository web references are replaced with links to git
This commit is contained in:
@@ -27,12 +27,12 @@ class FitEllipse:
|
||||
cv.CreateTrackbar("Threshold", "Result", slider_pos, 255, self.process_image)
|
||||
self.process_image(slider_pos)
|
||||
|
||||
def process_image(self, slider_pos):
|
||||
def process_image(self, slider_pos):
|
||||
"""
|
||||
This function finds contours, draws them and their approximation by ellipses.
|
||||
"""
|
||||
stor = cv.CreateMemStorage()
|
||||
|
||||
|
||||
# Create the destination images
|
||||
image02 = cv.CloneImage(self.source_image)
|
||||
cv.Zero(image02)
|
||||
@@ -56,18 +56,18 @@ class FitEllipse:
|
||||
PointArray2D32f = cv.CreateMat(1, len(c), cv.CV_32FC2)
|
||||
for (i, (x, y)) in enumerate(c):
|
||||
PointArray2D32f[0, i] = (x, y)
|
||||
|
||||
|
||||
# Draw the current contour in gray
|
||||
gray = cv.CV_RGB(100, 100, 100)
|
||||
cv.DrawContours(image04, c, gray, gray,0,1,8,(0,0))
|
||||
|
||||
|
||||
# Fits ellipse to current contour.
|
||||
(center, size, angle) = cv.FitEllipse2(PointArray2D32f)
|
||||
|
||||
|
||||
# Convert ellipse data from float to integer representation.
|
||||
center = (cv.Round(center[0]), cv.Round(center[1]))
|
||||
size = (cv.Round(size[0] * 0.5), cv.Round(size[1] * 0.5))
|
||||
|
||||
|
||||
# Draw ellipse in random color
|
||||
color = cv.CV_RGB(random.randrange(256),random.randrange(256),random.randrange(256))
|
||||
cv.Ellipse(image04, center, size,
|
||||
@@ -82,12 +82,12 @@ if __name__ == '__main__':
|
||||
if len(sys.argv) > 1:
|
||||
source_image = cv.LoadImage(sys.argv[1], cv.CV_LOAD_IMAGE_GRAYSCALE)
|
||||
else:
|
||||
url = 'http://code.opencv.org/svn/opencv/trunk/opencv/samples/c/stuff.jpg'
|
||||
url = 'http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/c/stuff.jpg'
|
||||
filedata = urllib2.urlopen(url).read()
|
||||
imagefiledata = cv.CreateMatHeader(1, len(filedata), cv.CV_8UC1)
|
||||
cv.SetData(imagefiledata, filedata, len(filedata))
|
||||
source_image = cv.DecodeImage(imagefiledata, cv.CV_LOAD_IMAGE_GRAYSCALE)
|
||||
|
||||
|
||||
# Create windows.
|
||||
cv.NamedWindow("Source", 1)
|
||||
cv.NamedWindow("Result", 1)
|
||||
|
Reference in New Issue
Block a user