Ask Your Question
3

DEV NEEDED: Looking for someone with a OpenNI supported camera, trying to debug the new C++ code sample version.

asked 2013-11-05 05:11:20 -0500

updated 2013-11-07 02:26:48 -0500

I am working on a pull request removing the remaining C-code from the C++ samples. For the linemod.cpp I have succeeded in getting it build properly, however I cannot test if the functionality stays intact, since I do not have an openNI camera.

Could someone test this for me?

A link to the adapted code could be found at:

http://pastebin.com/axMMapZL

I will make a PR of this fixed sample once someone assures me it still does the trick, like I did for the others that I could varify. If you need help debugging, let me know!

edit retag flag offensive close merge delete

Comments

Maybe @Guanta or @berak?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-05 08:02:05 -0500 )edit
1

sorry, no hw.

berak gravatar imageberak ( 2013-11-05 08:09:16 -0500 )edit

same here :/

Guanta gravatar imageGuanta ( 2013-11-05 14:40:50 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
3

answered 2013-11-07 17:02:13 -0500

Siegfried gravatar image

updated 2013-11-07 17:05:38 -0500

Hi Steven, I have successfully compiled the sample, but got an SIGABRT error during execution. After selecting the object in color image by a double click on the right mouse button the error occurs. A single click only opens the context menu. This should be fixed in the usage description in line 69. Here is the error message:

OpenCV Error: Assertion failed (!fixedSize() || ((Mat)obj)->size.operator()() == Size(cols, rows)) in create, file /home/XXXXXX/software/SRC/opencv-2.4.6.1/modules/core/src/matrix.cpp, line 1392 terminate called after throwing an instance of 'cv::Exception' what(): /home/XXXXXX/software/SRC/opencv-2.4.6.1/modules/core/src/matrix.cpp:1392: error: (-215) !fixedSize() || ((Mat)obj)->size.operator()() == Size(cols, rows) in function create

And here is the callstack:

0 __GI_raise raise.c 64 0x7ffff5fbf425
1 __GI_abort abort.c 91 0x7ffff5fc2b8b
2 __gnu_cxx::__verbose_terminate_handler() /usr/lib/x86_64-linux-gnu/libstdc++.so.6 0x7ffff691169d
3 ?? /usr/lib/x86_64-linux-gnu/libstdc++.so.6 0x7ffff690f846
4 std::terminate() /usr/lib/x86_64-linux-gnu/libstdc++.so.6 0x7ffff690f873
5 __cxa_throw /usr/lib/x86_64-linux-gnu/libstdc++.so.6 0x7ffff690f96e
6 cv::error system.cpp 453 0x7ffff7ab07c8
7 cv::_OutputArray::create matrix.cpp 1392 0x7ffff7adc1df
8 cv::transpose matrix.cpp 2009 0x7ffff7ae4365
9 cv::_SVDcompute lapack.cpp 1568 0x7ffff7a5a806
10 cv::SVD::compute lapack.cpp 1582 0x7ffff7a5aa60
11 filterPlane main.cpp 457 0x414c6a
12 subtractPlane main.cpp 571 0x4158d1
13 main main.cpp 236 0x413340

The cpp-example-linemod from the OpenCV C++ samples works fine. See screen-shot image description

Note: I'm using Ubuntu 12.04 64Bit with OpenCV 2.4.6.1 (HighGUI with Qt5)

edit flag offensive delete link more

Comments

Hi SIegfried, indeed the samples do work, but they contained a lot of C-style commands. Based on a feature request, I am updating all code samples to contain only C++ code :) It is a hard task but will see if I can fix this problem.

However after reading your remarks again, does my code work or not? :D

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-08 01:13:12 -0500 )edit

I will have a look at it later today!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-08 01:14:12 -0500 )edit

So okay, after reading through the code, the way to fix this, is adding a remark that right click opens the context menu and you then need to select learn or something?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-08 02:20:34 -0500 )edit
1

I think a right click to select something is uncommon. Most applications use left mouse button to select something. But this is not the main problem in the moment. We should focus on what causes the error after selecting the object. For that I will take a more detailed look on the source code and debug the code again.

Siegfried gravatar imageSiegfried ( 2013-11-08 06:43:41 -0500 )edit

Btw Siegfried, thanks for helping out! It will not only help me but also all future users of the samples!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-08 07:12:10 -0500 )edit

And indeed, it might seem weird to use right mouse click to select something, but thats the actual implementation. Changing the pure code to C++ was the first focus. This linemod examples was the last one that actually gave problems. I will submit it in a seperate pull request different from the others.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-08 07:32:33 -0500 )edit

Hi Steven, I have found the cause of the failed Assertion. The reason is that for the computation of SVD in line 455 the matrix for left singular vectors (parameter 3) has the type CV_8U all the other matrices has the type CV_32F. I have then instantiated a cv::Mat in the same way as for the other matrices cv::Mat lp_u = cv::Mat(4, 1, CV_32F); and changed the SVD computation to cv::SVD::compute(lp_pts, lp_w, lp_u, lp_v); This solves the problem with the assert. Now i can select an object and start the online learing by pressing button "l".

Siegfried gravatar imageSiegfried ( 2013-11-10 14:50:39 -0500 )edit

But now I always get the message "No matches found..." in command line. Learning the same object with the cpp-example-linemod from the OpenCV C++ samples works. However, the masks shown by both programs are different. In your code the mask has the same ROI as the training ROI. The mask in cpp-example-linemod has the same contour as the object.

Siegfried gravatar imageSiegfried ( 2013-11-10 14:56:03 -0500 )edit

Ok based on this info I will have a look at it this week! Will keep you up to date!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-11 09:22:50 -0500 )edit

I have added the Mat fix for the first error to my code. I will try to look deeper into the mask thing later. Have it quite busy for the moment, prepping for conferences. Will do it afterwards.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-12-17 06:56:40 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-11-05 05:11:20 -0500

Seen: 1,368 times

Last updated: Nov 08 '13