Ask Your Question

jtlz2's profile - activity

2017-07-25 00:51:30 -0600 received badge  Popular Question (source)
2017-07-25 00:51:30 -0600 received badge  Notable Question (source)
2017-07-24 02:11:54 -0600 received badge  Enthusiast
2017-07-20 02:31:31 -0600 commented answer python matchShapes on images

cv2.moments(image) works fine - {'mu02': 82.5, 'mu03': 0.0, 'm11': 285.0, 'nu02': 0.8250000000000002, 'm12': 2025.0, 'mu21': 0.0, 'mu20': 82.5, 'nu20': 0.8250000000000002, 'm30': 2025.0, 'nu21': 0.0, 'mu11': 82.5, 'mu12': 0.0, 'nu11': 0.8250000000000002, 'nu12': 0.0, 'm02': 285.0, 'm03': 2025.0, 'm00': 10.0, 'm01': 45.0, 'mu30': 0.0, 'nu30': 0.0, 'nu03': 0.0, 'm10': 45.0, 'm20': 285.0, 'm21': 2025.0}

What is the cv3 equivalent syntax for matchShapes?

2017-07-20 02:20:19 -0600 commented answer python matchShapes on images

Excellent. I still get an exception though:

import cv2 import numpy as np m = np.eye(10,10,dtype=np.uint8) m2 = m[2:6,2:6]=1 cv2.matchShapes(m,m2,1,0)

OpenCV Error: Assertion failed (contour1.checkVector(2) >= 0 && contour2.checkVector(2) >= 0 && (contour1.depth() == CV_32F || contour1.depth() == CV_32S) && contour1.depth() == contour2.depth()) in matchShapes, file /tmp/opencv-20170224-1869-10nlf6f/opencv-2.4.13.2/modules/imgproc/src/contours.cpp, line 1941

error Traceback (most recent call last) <ipython-input-5-ad4e7d59fa25> in <module>() ----> 1 cv2.matchShapes(m,m2,1,0)

error: /tmp/opencv-20170224-1869-10nlf6f/opencv-2.4.13.2/modu

2017-07-20 01:15:13 -0600 asked a question python matchShapes on images

In python, I am trying to exploit the affine invariance of matchShapes() (compared to matchTemplate()) to match my template to distorted candidate images.

The template and candidate images are quite complicated, but the documentation states that grayscale images can be inputted to matchShapes():

http://docs.opencv.org/2.4/modules/im...

This is my preferred option to breaking out into a large ensemble of contours.

As far as I can tell, matchShapes cannot in fact handle two grayscale images. What could I be doing wrong?

That then leaves the contours route. But how does one aggregrate information from all possible contour pairs in order to assess the confidence of a match?

2017-07-19 08:07:32 -0600 commented answer matchShapes() example

What is the internal algorithm for operating on grayscale images? Are they converted to contours first?

2017-07-19 08:01:28 -0600 commented question matchShapes using grayscale images opencv

@berak - question awaiting moderation.... Right now I get:

 ret = cv2.matchShapes(img1,img2,1,0.0)

cv2.error: /tmp/opencv-20170224-1869-10nlf6f/opencv-2.4.13.2/modules/imgproc/src/contours.cpp:1941: error: (-215) contour1.checkVector(2) >= 0 && contour2.checkVector(2) >= 0 && (contour1.depth() == CV_32F || contour1.depth() == CV_32S) && contour1.depth() == contour2.depth() in function matchShapes

2017-07-19 07:24:19 -0600 commented question matchShapes using grayscale images opencv

@Tonystark124 @berak Is this working now (from python)?