I have written an openCV code and my code has following statement:
cv::imshow("Matches", matchesImg);
cv::waitKey(0);
When I run the code either in Debug or Release I am not able to see window which shows me the output.
And this is happening for every project I create.
Not able to figure out the reason, Can someone please guide me on this?
I am coding on Windows 7 and Visual studio 2010, with opencv version of 2.4.6
As I mentioned in the comments, you have to create a window first, using namedWindow with the same window name as in imshow
See this tutorial for details.
EDIT
This strongly suggest that you have to create the window beforehand.
Some may argue that it didn't work this way for previous versions of OpenCV. Then, let's say this solution apply at least to OpenCV 2.4.6, which is the version of concern here (and it solved the problem).
Related
I am trying to generate Arcuo Marker and Detect the marker in Visual Studio 2019 vc16, I am using OpenCV version 4.7 and i am using a already written code of generating Arcuo marker, in the code they have aruco.hpp header file but in the new version they do not have that, it is moved in the objectdetect folder. I am just confused that how can I use or call Arcuo, because I am not sure what was in the previous version. Any help will be appreciated.
I tried to use older version, in those I could not see aruco.hpp as well. I am confused because how it is not there while everyone is using it? what am I Missing??
You need to build OpenCV with its contribs.
There's also an option for that in Conan if you happen to use it.
Then aruco.hpp will be available here.
I am sorry if this question is already asked but, from every source I have read on google so far they don't cover the most latest versions and I am having a lot of trouble figuring this out.
I have a VS code for detecting faces and saving the ROI onto the desktop. Now, I need to add the functionality for force capture and need to employ GUI for it which openCV is not good enough for. I have been told to use Qt. For more than a week now I have been stuck at simply installing Qt and getting it to work. If anyone could help me out in-line with my project's purpose I would greatly appreciate it.
Every time I install I get some sort of different error which I am not able to understand (complete beginner here), the latest one I got was that Qt could not find the "Kit", even though the dialog box displayed the available ones (Mingw 2022).
Thanks in advance!
NEW TO OPENCV AND KINECT :)
I am sorry if there are other similar questions here - I did search and am still lost.
I am trying to use the Microsoft Kinect SDK with opencv. I looked at the KinectBridgeWithOpenCVBasis example in the SDK but find it too complex.
Here is the question: I am using the DepthSensor class from this site I am trying to get the depth data into opencv matrix. The code is as follows:
DepthSensor *ds = new DepthSensor();
ds->init();
Mat frame;
ds->getDepthMat().copyTo(frame);
imshow("display", ds->getColorMat());
I did add ds->processDepth(); at various points to check if it works. The exact error message is :
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow, fi
le C:\builds\2_4_PackSlave-win64-vc12-shared\opencv\modules\highgui\src\window.c
pp, line 261
and
Unhandled exception at 0x000007FEFC7B940D in opencvtest.exe: Microsoft C++ exception: cv::Exception at memory location 0x00000000001AF500.
Any ideas on how I fix this? Thanks.
MT
I'm still fairly new to OpenCV and the Kinect as well, but I came across this post. It seems to describe a similar problem. If you look at the last comment on any of the posts, the OP has described the solution they found:
Thanks for answering. I figured out the issue. It was a conflict
between the 32 and 64 bits dlls vs the compiler. When I installed VS
2010 with superpack 2.3 the compiler I think tries to use a mix match
of x86 and x64 dlls based on the way its setup in the environment vars
and Vs2010. I figured it out by installing VS2010 on a different
computer with only x86 support compiler and I had no trouble at all.
Everything Worked Fine! Exact same setup, only one is X86 and the
other is X86 and X64. It didn't make sense because the compiler should
choose one right? and not a mix of x86 and 64 dlls?
Another (perhaps related?) possibility is that something is wrong in your install of OpenCV. The first couple times I tried building the libraries I made mistakes and got strange errors when trying to run code. I eventually settled on using the pre-built libraries. If you get errors with all OpenCV code, try reinstalling.
Finally, it looks as though you've only posted a fragment of your code. I've seen many people request that questions include the complete code so that it can be more easily debugged and in case you missed an error somewhere else.
Good luck!
I just don't seem to be able to get OpenCV to work properly. Here's what I want to accomplish:
Use CodeBlocks (which I installed using codeblocks-10.05mingw-setup.exe) with OpenCV (installer: OpenCV-2.4.2.exe) on my Windows x64.
I've tried a lot of different configurations which will only bother you if I posted them all, so I hope you don't mind if I just ask the simple question: how do I get this to work?
I think I'm missing the smallest detail right now, so a detailed description of how to get started would be welcome.
If the OpenCV installer did the job, you should have by now OpenCV libraries and headers already installed in your system.
I would then go ahead and try to compile a hello world basic code, like the one you can get from here. If you would like to program using an IDE, like VisualC++ in Windows, you can follow this guide that will help you setting up the environment.
OpenCV team just introduced their new web site. There you can find Introduction to OpenCV section with installation instructions, including detailed instructions for Windows. Don't forget to cleanup your system before installation to avoid problems with mixing different install options. If you still can't get it working with CodeBlocks, follow Dan's advice and try compiling from command line.
When you are done with installation, go on and read there great new tutorials!
I am starting up with OpenCV (using C++) and was playing around with the "Feature matching with FLANN" tutorial from here:
http://opencv.itseez.com/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.html
I did not modify anything, just tried running it as it is. Unfortunately, when running it, I am getting this error when the program tries to detect the keypoints (on the line detector.detect(img_1, keypoints_1)) :
I had no problems with running other OpenCV tutorials out of the box...did anyone experience similar problems?
My system: Visual Express 2010 and OpenCV 2.3, under Windows 7 64-bit. Could this be a bug of v2.3, or some issues related to the 64-bitness of my system?
It sure helps to know more about C++ than a worm :) I realized I had linked against the release version of the feature2d lib. As always, solved automatically by virtue of the "power of posting"...
I have same mistake with your‘s,because you have use different Version of lib file.
If you use debug,you must use lib ended by 'd'.