Ask Your Question

Vaclav's profile - activity

2017-01-24 09:13:30 -0500 commented answer VideoCapture - passed invalid camera ID - revised

Thanks , my next step wast to read the source code. Appreciate your answer.

2017-01-23 15:44:35 -0500 asked a question VideoCapture - passed invalid camera ID - revised

VideoCapture cap(0); // open the default camera if(!cap.isOpened()) // check if we succeeded return -1;

The above snippet will fail if invalid parameter is passed to the constructor. The error returned exits the program.

How do I validate the camera ID prior to executing the VideoCapture? I need to control the program flow and NOT exit the program via VideoCapture class.


OK , I have better understanding how to access video camera, however, I still need some more assistance.

Here is my my debugging code for (int iVideoID = 0; iVideoID != 9; iVideoID ++) {

            if ( {
                cerr << "success - opened video cam ID " << iVideoID
                        << endl;
                //return 15;
                break; //       return -1;
            } else {
                cerr << "Cannot open the video cam " << iVideoID
                        << endl;
                if(iVideoID  != 8)
                cerr << " try next ID " << endl;
                    cerr << "Failed to access any video camera " << iVideoID
                                                << endl;

ifdef TRACE

                    cerr << "Failed to access any video camera " << iVideoID
                                                                        << endl;
        cout << __func__ << endl;
        cerr << __LINE__ << endl;
        cerr << "EXIT "<< endl;
        return 42 ;


It does do what I want, but... When there are NO USB cameras on the system , it correctly exists after ID is > 8 . No problem there. But when there is a USB camera and it is not accessible I get ton of library errors. I like to gracefully exit the application instead of collecting all these however valid errors.

Here is a copy of my outputs:

int main(int argc, char **argv) main libv4l2: error setting pixformat: Device or resource busy VIDEOIO ERROR: libv4l unable to ioctl S_FMT libv4l2: error setting pixformat: Device or resource busy libv4l1: error setting pixformat: Device or resource busy main libv4l2: error setting pixformat: Device or resource busy libv4l1: error setting pixformat: Device or resource busy VIDEOIO ERROR: libv4l unable to ioctl VIDIOCSPICT

Cannot open the video cam 0 try next ID VIDEOIO ERROR: V4L: index 1 is not correct! Cannot open the video cam 1 try next ID VIDEOIO ERROR: V4L: index 2 is not correct! Cannot open the video cam 2 try next ID VIDEOIO ERROR: V4L: index 3 is not correct! Cannot open the video cam 3 try next ID VIDEOIO ERROR: V4L: index 4 is not correct! Cannot open the video cam 4 try next ID VIDEOIO ERROR: V4L: index 5 is not correct! Cannot open the video cam 5 try next ID VIDEOIO ERROR: V4L: index 6 is not correct!

Basically - how do I access / process the lib4l2 errors ?

I did some search on this and found all of such problems are blamed on application. However, one discussion was about "USB bandwidth" or lack of it . Please NOTE that when my code works , when I can access the camera , it works. So if the USB bandwidth is the issue , I just want to recover from it. Essentially looking for a function which would return the error , not just true / false as does. As it stands - "open" just sort of hides the errors and returns false, which it suppose to do. I hope I am making sense.

Any ... (more)

2017-01-19 18:46:41 -0500 asked a question imshow / namedWindow tracking mouse and RGB on video frame

I am not sure which method displays the mouse pointer x/y positions and RGB values at the bottom status bar of the window. I like to use these values and also show them in full view - currently the font used does not fit into the status area. Can I get a hit which method source code contains the info I am looking for ?

2016-12-05 11:17:54 -0500 asked a question namedwindow

Is "namedwindow" preferred function to build window in OpenCV?
I am interested in just base window as GUI - with title, max / min , close "buttons". The actual content of window is not important.

2016-12-02 11:25:30 -0500 asked a question libraries list / locator ?

For whatever reason none of the OpenCV sample codes identifies libraries to link to. This seems to be a common beginner, like me , issue leading to "undefined symbols" and frustrating search for library to link to.

For example - what is a recommended way to find the library for VideoCapture?

PS I am using GCC in Eclipse and the linked libraries seems to be of "static" type. Not really sure how to tell the linker to use dynamic library, or if it is even an option. Seems that with CPU's access to GBs of memories using DLL or painstakingly options static libraries is rather anachronistic. Just saying.


2016-11-22 10:44:51 -0500 commented question Which is CURRENT OpenCV version for Unbuntu 32 bits ?

Thanks for providing useful info and wasting my time. Would that be too difficult to actually answer the question instead of posting this sermon? If you cannot impress with brilliance....

2016-11-20 11:16:23 -0500 asked a question Installing OpenCV using CMakeLists.txt

Not having much luck running this CMakeLists "off the shelf" as downloaded from Github. The doc I have read refer to making your own "make" and few versions of CMakeLists did not quite work.

How do I verify if the current CMakeLists is really current?

Is there a tutorial on using CMakeLists? I did not found one Googling.

BTW this CMakeLists 'output" appears to be "\build" which would be normal way to setup / build in Linux, but it was empty when I used it on OpenCV 3.1. I am confused - which way is up?

Also most instructions for using "make" seems backwards / outdated . When yu select "CMakeLists" you have an option to use "CMake" to execute it. You do not select CMake and than select CMakeLists. Minor detail.

2016-11-20 11:13:34 -0500 received badge  Famous Question (source)
2016-11-20 10:55:15 -0500 asked a question Which is CURRENT OpenCV version for Unbuntu 32 bits ?

OpenCV 2.4.x or OpenCV 3.X

Does DATE of release means anything? It seems people on "Github" use "latest" which tells nothing about how these ARE different to novice.


2016-11-18 12:38:59 -0500 asked a question OpenCV version 3 basic info ? Python only ?

It looks as OpenCV version 3 has some major differences in files etc. Running CMake using supplied file creates /usr/local/lib/pkgconfig which appears to be Python wrapper for "pkg-config" thus unusable in "plain " C++ , right?

So - is there some info on how OpenCV 3 works ? Is it the latest to be used on Linux/ Ubuntu ?

Is it some undocumented "fork" of real OpenCV?

2016-11-14 11:12:10 -0500 asked a question What is a current version to run on Ubuntu 16.04 32 bits ?

New kid on the block. Using Ubuntu 16.04 OS (32 bits) with Eclipse IDE ( 32 bits) and cannot link to OpenCV. Perhaps I mistakenly downloaded -version 3. something. So how do I determine current WORKING OpenCV for Unbuntu 16.04 - 32 bits? In long pass OpenCV versioning was always a challenge, still is for me and 3. something is probably wrong one . Like to hear some success stories using same setup as me, it would be encouraging. Cheers

2016-11-14 10:56:17 -0500 commented question Compiling 2.4.11 on Ubuntu 16.10

I am a new user of OpenCV under Linux / Ubuntu. Had my shares of problem eons ago while running in WIndows. At present I just cannot link to OpenCV in similar manner as described. I feel pretty confident about my IDE , but have a burning question to this forum. Since I am again hijacking discussions I'll attempt to post a new one.
Hope this one will get answered soon.

2016-11-08 16:08:30 -0500 commented answer Implementing edge detector on SAM3x8e ( Arduino Due )

Yes, I know that. i WAS asking about minimal OpenCV. I am well aware of limitations of my hardware also. Let's call this closed OK?

2016-11-05 20:03:41 -0500 asked a question Implementing edge detector on SAM3x8e ( Arduino Due )

I am looking for minimal porting of OpenCV into SAM3x8e hardware. (.5GB ). Is there a "sample code" somewhere? I can go thru all the core includes step by step but would prefer not to reinvent the wheel. I do not need any GUI related classes, just want to be able to calculate edges. Thanks

2015-04-03 01:16:28 -0500 received badge  Notable Question (source)
2014-04-05 09:28:43 -0500 received badge  Popular Question (source)
2013-04-26 09:11:51 -0500 commented question How to build includes structure for opencv.hpp to work properly

And I always wonder why I always get stupid advises instead answers to my questions.In case you want to really know - I have WORKING code build in VC++ with partial OPenCV1.1 and just like to add all of OpenCV and at this point don't care if it does something - I just need to compile the whole mess. Somehow folks like you think that if it is the newest it must be bug free. BTW now I know how to use CMake to build the opencv2 structure. Thanks for your "help".

2013-04-25 21:49:28 -0500 asked a question how to use .txt and .cmake files in CMake?

OK OK folks , enough googling for old / incorrect / incomplete / none-existent stuff about cmakes. What are these .txt files for? WHERE is the real tutorial on how to use .cmake file to build required opencv2 directory so opencv.hpp will compile????? A correct / real link would be appreciated - none of these "read doc" is helping much.

2013-04-25 12:54:54 -0500 asked a question How to build includes structure for opencv.hpp to work properly

Opencv.hpp includes all headers from directory ( in OpenCv2.4.5) opencv2**.h. Can I “make” this structure without installing the entire OpenCV? There are tons of cmake files in cmake directory but there is no documentation on how to use them. A tutorial reference would be appreciated.

I am actually using OpenCv1.1 and the headers in this release are using opencv2 structure which does not exist at all in this release, builds or not. Or is there a way to do that in OpenCv 1.1? I have a .dsw project which is nice but... . Again, lack of documentation even here on how to use make /cmake. Any help as always is appreciated.

2013-04-24 16:59:15 -0500 received badge  Editor (source)
2013-04-24 16:56:56 -0500 asked a question OpenCV includes / libraries documetation

What are required includes / libraries in OpenCV245 and where is it documented? I do not see "cv" anywhere. Was it replaced with what? Are there still "debug libraries?" IS there a description of directory structure ea which "src" can I use to build my own library? Modules or "build" directory???

2013-02-19 16:05:17 -0500 answered a question capturing camera ?

From the blurry picture it looks like Video Source selection dialog. Time honored way is to step thru the code - including the OpenCV, however MOST capAVI calls in OpenCV do not check the return values. And some of the OpenCV "wrappers" are notorous for that. cvCaptureFromCAM(0) is a prime example!

The code you have posted is a typical lazy way OpenCV (samples) are presented - for example CvCapture* capture = cvCaptureFromCAM(0); You should verify / assert / check if "capture" is set correctly. When dealing wiht hardware, functions returns are important. For all we know, you may be missing video driver for you camera.(But unlikely).

2013-02-19 15:47:43 -0500 asked a question Silly question - but why is it so hard to find the source code?

I am treating OpenCV as a handy library and periodically would like to get the actual source code for particular function. OK I can get the header, but getting the method source code is a doubting Google search. Why? And since I got your attention – is there a SINLE point of contact for OpenCV development? It is hard to keep up with all the recent releases plastered all over the web. Please – no references to yahoo group, that is not a good source of info for me. Thanks for reading. Vaclav

2013-02-19 15:36:44 -0500 asked a question capAVI users / experts wanted

Since Windows OpenCV is based on Windows capAVI one would expect that there is some level of knowledge about it with OpenCV users. I have a different experience - most OpenCV "programmers" are on very high level - looking for "how to detect a license plate" using one line of code! OK I am stretching it a little , but please - is there someone who knows how capPreview actually works, as an example? Like to hear from you.

2013-01-08 12:10:10 -0500 asked a question cvPyrDown in which libraray?

From my first encounter with OpenCV I find it awkward / difficult /annoying to search the web to FIND OUT IN WHICH LIBRARY the function resides. Why is that? So where is the source for cvPyrDown? The description in wiki does not say and the yahoo user group - no comment on that one! Let's make it not only Open but open for programmers too.