Ask Your Question

jasedit's profile - activity

2017-11-21 08:30:49 -0600 received badge  Famous Question (source)
2016-09-15 11:17:41 -0600 received badge  Nice Question (source)
2016-09-15 11:17:29 -0600 received badge  Notable Question (source)
2015-07-06 02:22:10 -0600 received badge  Popular Question (source)
2014-05-03 20:43:56 -0600 answered a question cvtColor RGB to HSV, different look???

OpenCV doesn't record the colorspace of an image in the image itself, so imshow has no way of knowing what colorspace you are working in. So what is most likely happening is imshow() is taking the HSV values and interpreting them as RGB/BGR, which would produce some significantly different effect. That's my guess anyways.

2014-05-03 20:35:45 -0600 answered a question cvtColor RGB to HSV, different look???

OpenCV doesn't record the colorspace of an image in the image itself, so imshow has no way of knowing what colorspace you are working in. So what is most likely happening is imshow() is taking the HSV values and interpreting them as RGB/BGR, which would produce some significantly different effect. That's my guess anyways.

2012-08-04 14:24:11 -0600 commented answer What format does cv2.solvePnP use for points in Python?

This shows the correct arguments. My actual issue was in using reshape to pass an array into the solvePnP call with the appropriate shape. This causes problems in subsequent calls, unless a copy of the array is made.

2012-08-04 14:10:38 -0600 received badge  Scholar (source)
2012-08-04 14:10:30 -0600 received badge  Supporter (source)
2012-08-04 02:22:08 -0600 received badge  Student (source)
2012-08-02 14:19:02 -0600 received badge  Editor (source)
2012-08-02 10:29:26 -0600 commented answer Simple Opencv program with link error on

Searching the errors you listed produces this post: http://stackoverflow.com/questions/9867514/opencv-build-on-visual-studio-link-error which includes several answers purported to help. I'm assuming the 230 part of the .lib files needs to be changed, but perhaps it provides some insight?

2012-08-02 10:10:16 -0600 commented answer Simple Opencv program with link error on

I don't believe putting the libraries on the search path is enough to link them in. You need to actually add the library as a dependency of the project. This forum post seems to explain how to do it: http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/09246868-587e-4980-98a4-e8860276913b

2012-08-02 10:03:05 -0600 answered a question Problem Building a Project in Eclipse [Ubuntu]

What are the contents of Test.cpp? It is reporting it can't find the definition of the main() function - without seeing the contents of Test.cpp as you have it saved on disk, it's hard to tell for certain what's going wrong.

The signature of main() could be wrong, or an errant semicolon could be making the definition not be found. Or main() could be in another file altogether that isn't being linked into Test. Without seeing Test.cpp I can't be certain what's going wrong.

2012-08-02 09:58:13 -0600 answered a question Simple Opencv program with link error on

What libraries are you linking in? How have you set up this application to build? It looks as though the highgui library isn't being linked in, which would be necessary to make things work. How to do this depends on how you are building the application - either through Visual Studio (in which case you need to use the GUI to specify the OpenCV highgui library as something to link in) or through the command line (in which case you need to locate the library and modify the command line appropriately.)

2012-08-02 09:29:03 -0600 asked a question What format does cv2.solvePnP use for points in Python?

I'm using OpenCV 2.3.1 under Ubuntu 12.04, and trying to use the cv2.solvePnP function. I cannot seem to figure out what format the two point arguments are supposed to be in. The document states:

objectPoints – Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. vector<point3f> can be also passed here.

imagePoints – Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. vector<point2f> can be also passed here.

I have so far tried the following inputs:

  • NumPy arrays with shape (N, 3) and (N, 2)
  • Numpy arrays with shape (N, 1, 3) and (N, 1, 2)
  • Python lists of NumPy arrays of (N,3) and (N,2)

The most typical error I get reads:

cv2.error: /build/buildd/opencv-2.3.1/modules/calib3d/src/solvepnp.cpp:52: error: (-215) npoints >= 0 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) in function solvePnP

What format are these two arguments supposed to be in? Is there something I'm missing?

EDIT:

Based on blue's answer, I've refactored such that this code snippet:

print opts.shape, ipts.shape, temp_cam.shape, dc.shape > print opts.dtype, ipts.dtype, temp_cam.dtype, dc.dtype > rcv, tcv = cv2.solvePnP(opts, ipts, temp_cam, dc)

Produces:

(1420, 3, 1) (1420, 2, 1) (3, 3) (5, 1)

float64 float64 float64 float64

OpenCV Error: Assertion failed (src.dims <= 2 && esz <= (size_t)32) in transpose, file /build/buildd/opencv-2.3.1/modules/core/src/matrix.cpp, line 1680 terminate called after throwing an instance of 'cv::Exception' what(): /build/buildd/opencv-2.3.1/modules/core/src/matrix.cpp:1680: error: (-215) src.dims <= 2 && esz <= (size_t)32 in function transpose

So the sizes seem right, and the types seem right, but I'm still getting an error.

If I use the example code in the answer in ipython, I get a valid answer. Is there some other constraint I'm not recognizing?