Ask Your Question

Melvin_DY's profile - activity

2016-08-23 00:17:15 -0600 received badge  Student (source)
2016-08-22 21:13:06 -0600 received badge  Editor (source)
2016-08-22 19:29:14 -0600 asked a question Where to set origin of model for solvePnP

Hi everyone, I've been figuratively tearing my hair out over this problem for over a month now. I have to admit that I haven't taken a good hard look at the math behind solvePnP (most people don't, which is why we have open source libraries), because reasons.

I'd like to ask for some practical advice regarding using solvePnP with regards to where to position the origin for the model.

Background: I'm using OpenCV to make a head tracking app. Tracking the objects (4 of them) on screen isn't really the problem; figuring out the 6DoF is.

Camera: Mobile phone camera. I haven't performed calibration, but I figure that as long as the subject keeps their head in the center of the view, it shouldn't be a big problem. I do notice significant barrel distortion towards the edges though.

Parameters fed into solvePnP: Image points -- from tracker (origin in lower-left). Model points -- from 3D model (origin in lower-left, translated to OpenCV upper-left origin). Camera matrix -- fx,fy max dimension of image, principal point at center of image, no skew (may change if I do calibration). Using ITERATIVE with extrinsicGuess (because it's very jittery without it).

So the specific advice that I want to ask: Where should I set the origin of the model (in this case, of a human head) to get consistent 6DoF values? Ideally, I want to get the rotation values "anchored" inside the neck (about a few centimeters deep from the anterior). I've tried translating the head model points to have the origin inside the neck, but I notice that z-translation values go bonkers when a significant portion of the model is in the -z range. Also, it becomes unable to resolve x-rotation properly (it gives me positive values whether I look up or down).

Should I be placing the model in a particular octant of the model space? Should I avoid having any part of my model in the -z range, or should I expect solvePnP to return a -z translation for such a situation?

2016-08-10 00:22:42 -0600 received badge  Enthusiast
2016-06-27 22:31:22 -0600 answered a question build opencv3.1 on mac for iOS failed

Based on the answer found here:

http://stackoverflow.com/a/22228306/3631181

I added an #include '<'unistd.h'>' (remove the single quotes) in 3rdparty/zlib/gzguts.h. Compiles OK.

2016-06-27 22:31:21 -0600 commented question build opencv3.1 on mac for iOS failed

Same problem.

Setup: OpenCV 3.1.0 Python 2.7.10 Mac OS 10.11.5 XCode 7.3.1 (7D1014)

It builds okay for ARMv7 and ARMv7s. Incidentally, I am building it with opencv_contrib modules.

Spotted this error in the output: /Users/username/codespace/git/opencv/3rdparty/zlib/gzlib.c:256:24: error: implicit declaration of function 'lseek' is invalid in C99 [-Werror,-Wimplicit-function-declaration] state->start = LSEEK(state->fd, 0, SEEK_CUR);