Ask Your Question

rexroni's profile - activity

2017-04-20 06:39:51 -0600 received badge  Famous Question (source)
2016-04-24 15:21:04 -0600 received badge  Enthusiast
2016-04-22 15:54:02 -0600 commented answer OpenCV 3.0 won't compile with FFMPEG support?

I like this, it is simpler.

2016-04-22 15:52:26 -0600 asked a question sfm::reconstruct() flat output

Problem

I cannot get sfm::reconstruct() to output anything with a significant z dimension (|z|>1). Everything appears very flat, even if I run the demo recon2v on the demo data. When I run the opencv_test_sfm it passes.

Question

Is this a common issue? Is it possible I built something wrong? I also noticed that the

Details

I built the latest OpenCV yesterday. I am using the sfm sample (opencv_contrib/modules/sfm/samples/recon2v.cpp) and with its intended sample data (opencv_contrib/modules/sfm/samples/data/recon2v_checkerboards.txt). If I scale the z values by a factor of 100, I can see that the two planes of the checkerboard data are both very planar, but are actually on different planes. However, it doesn't make sense that you would have to scale the z values to see the depth (does it?)

I have additional suspicions that something is not built quite right: I have to compile the application with -DCERES_FOUND (which seems like it should only be done within cmake when building the library). I also get all zeros for my estimated camera intrinsics, both with the demo set and with my own pictures. There's also quite a few opencv tests which fail, though sfm isn't one of them. However, the Ceres solver passes all build tests.

2016-04-22 14:56:29 -0600 received badge  Supporter (source)
2016-04-22 14:56:13 -0600 received badge  Scholar (source)
2016-04-22 14:54:08 -0600 received badge  Notable Question (source)
2016-02-11 16:06:58 -0600 received badge  Popular Question (source)
2015-10-17 01:45:08 -0600 received badge  Self-Learner (source)
2015-10-16 16:18:26 -0600 answered a question What is the gpu::DisparityBilateralFilter based on?

So I used git blame to find the email address of the guy who wrote the code, and I asked him. He said, ya it's in section 3.5 of the indicated paper. The section is called "A Constant-Time Constant-Space Post-Processing Method".

2015-10-10 20:24:45 -0600 asked a question What is the gpu::DisparityBilateralFilter based on?

According to the OpenCV documentation, the DisparityBilateralFilter is based on the following paper:

Q. Yang, L. Wang, and N. Ahuja. A constant-space belief propagation algorithm for stereo matching. In CVPR, 2010. [pdf]

But I am reading that paper, and I don't see anywhere where bilateral filters are mentioned. I'll admit that it's a bit over my head.

I don't quite understand what the source code is doing for that class, but could they maybe have meant to cite this paper (or one of Yang's other papers on bilateral filters?):

Qingxiong Yang, Kar-Han Tan and Narendra Ahuja, Real-time O(1) Bilateral Filtering, IEEE Conference on Computer Vision and Pattern Recognition (CVPR) 2009. [pdf2]

Can anybody confirm which paper the DisparityBilateralFilter is based on?

2015-09-01 18:38:01 -0600 received badge  Teacher (source)
2015-09-01 18:37:15 -0600 received badge  Student (source)
2015-09-01 15:10:55 -0600 received badge  Editor (source)
2015-09-01 12:46:50 -0600 commented question OpenCV 3.0 won't compile with FFMPEG support?

Ok, so I again have a need to compile opencv with video support, but I do not see a WITH_AV option or anything that looks like that when I run ccmake .., am I missing something?

2015-06-09 09:12:50 -0600 commented question OpenCV 3.0 won't compile with FFMPEG support?

Thanks for the tip!

2015-06-09 02:44:56 -0600 received badge  Self-Learner (source)
2015-06-08 20:26:44 -0600 commented question OpenCV 3.0 won't compile with FFMPEG support?

Really? I suppose I'm not too concerned where my video support comes from... I just wanted video support and I had instructions for how to make ffmpeg work. I actually solved the question before I asked it, only I wasn't able to answer immediately due to new-user restrictions.

Do you have instructions for setting up opencv with libav, or is it just an option in ccmake and it "just works"?

2015-06-08 20:23:30 -0600 answered a question OpenCV 3.0 won't compile with FFMPEG support?

Ah, great question Rex. I had the same exact problem, myself!

I tried all the same things you did actually. I finally found the answer by googling "ffmpeg --enable-pic", which led me to the ffmpeg website on advanced linking configuration (http://www.ffmpeg.org/platform.html#A...). It turns out my problem was two-fold: I needed to change how I was compiling ffmpeg, and how I was linking OpenCV

The short answer is, I recompiled ffmpeg with additional flags --enable-pic and --extra-ldexeflags=-pie, and then had to edit a particular option in my OpenCV build. I used ccmake to set CMAKE_SHARED_LINKER_FLAGS to a value of -Wl,-Bsymbolic, as described by the ffmpeg website.

Hopefully this helps you out, Rex. Best of luck!

Ok but seriously, this took me a while to find the answer, so hopefully this will help save somebody a couple hours of pain.

2015-06-05 11:40:10 -0600 asked a question OpenCV 3.0 won't compile with FFMPEG support?

I would like to use the ffmpeg library so I have video support with my OpenCV 3.0 build. I'm using the excellent step-by-step instructions from the book Practical OpenCV by Samarth Brahmbhatt (http://www.it-ebooks.info/book/3145/) But every time I run make, the build quits while trying to link libopencv_videoio.so, and throws this error:

Linking CXX shared library ../../lib/libopencv_videoio.so

/usr/bin/ld: /usr/local/lib/libavcodec.a(vc1dsp_mmx.o): relocation R_X86_64_PC32 against symbol `ff_pw_9' can not be used when making a shared object; recompile with -fPIC

First, there was actually some similar error, and I fixed it by recompiling x264 with the additional option --enable-pic. That was easy.

But I've recompiled ffmpeg a bunch of times, with the options --extra-cflags=-fPIC, --extra-cxxflags=-fPIC, --enable-pic, and nearly every combination of those options. Nothing will make this work.

I don't have any problem following the same steps with OpenCV 2.4.9.

Help!

2015-04-24 15:18:02 -0600 received badge  Necromancer (source)
2015-03-29 23:45:57 -0600 answered a question rectify fisheye stereo setup

I see this is an old thread, but this problem set me back a couple of months, so hopefully this helps somebody. I used the OpenCV chessboard calibration technique but had the same problem. Everything before the stereo calibration was easy--I just followed the steps in this book: (http://www.it-ebooks.info/book/3145). I'll assume you already have the left and right camera matricies, left and right distortion coefficients, and an appropriate set of chessboard corners (image points) for the stereo calibration.

First, I used initUndistortRectifyMap() create pixel mappings that remove the distortion on the individual camera outputs:

// initUndistortRectifyMap(InputArray cameraMatrix, InputArray distCoeffs, InputArray R, InputArray newCameraMatrix, Size size, int m1type, OutputArray map1, OutputArray map2) 
initUndistortRectifyMap(left_cameraMatrix, left_distCoeffs, empty, left_cameraMatrix, left_image_size, 32FC1,   monomap_l1,monomap_l2);
initUndistortRectifyMap(right_cameraMatrix, right_distCoeffs, empty, right_cameraMatrix, right_image_size, CV_32FC1, monomap_r1, monomap_r2);

Then I applied the undistortPoints() to my image points.

// undistortPoints( InputArray src, OutputArray dst, InputArray cameraMatrix, InputArray distCoeffs, InputArray R=noArray(), InputArray P=noArray())
undistortPoints( left_image_points, left_image_points, l_cameraMatrix, l_distCoeffs, empty, l_cameraMatrix);
undistortPoints( right_image_points, right_image_points, r_cameraMatrix, r_distCoeffs, empty, r_cameraMatrix);

Now if I remap() the images using the "monomaps" and drawChessboardCorners() on those images, the chessboard corners line up with the distortion-corrected images.

Last step: use the distortion-corrected chessboard corners to do stereoRectify():

Mat R, T, E, F; //stereo calibration information
Mat zerodistortion = Mat::zeros(1,5,CV_32FC1);  //empty distortion matrix
stereoCalibrate(object_points, left_image_points, right_image_points, left_cameraMatrix, zerodistortion, right_cameraMatrix, zerodistortion, left_image_size, R, T, E, F);

This worked! I was at a conference recently where I spoke with a guy teaching in Spain and he said he was doing the same exact thing with his cameras.

Now, to see the rectified outputs, you have to create the stereo rectification maps:

// initUndistortRectifyMap(InputArray cameraMatrix, InputArray distCoeffs, InputArray R, InputArray newCameraMatrix, Size size, int m1type, OutputArray map1, OutputArray map2) 
initUndistortRectifyMap(l_cameraMatrix, zerodistortion, Rl, Pl, image_size, CV_32FC1, map_l1, map_l2);
initUndistortRectifyMap(r_cameraMatrix, zerodistortion, Rr, Pr, image_size, CV_32FC1, map_r1, map_r2);

Then (I was too lazy to fix this), to see the rectified output, you have to remap your input images twice: once for monocular undistortion and once for stereo rectification:

// Remap images to remove monocular distortions
remap(left, left_undist, monomap_l1, monomap_l2, INTER_LINEAR);
remap(right, right_undist, monomap_r1, monomap_r2, INTER_LINEAR);

// Remap images to rectify
remap(left_undist, left_rect, map_l1, map_l2, INTER_LINEAR);
remap(right_undist, right_rect, map_r1, map_r2, INTER_LINEAR);

Long story short, stereoCalibrate() couldn't handle the extreme distortion, but it you can remove that distortion before calling stereoCalibration().