2

Sorry for repeating a frequent question. It is now a week that I am trying to set up openCV with Qt 5.0.2 or Microsoft VC++ express edition in my 32bit windows 7, with no success. now for QT : -It is QT 5.0.2 MinGW . -It runs programs not using opencv successfully.

Now, the opencv lines of my .pro file is like this :

INCLUDEPATH += "C:\opencv\build\include"
LIBS += "C:\opencv\bin\bin\libopencv_core243.dll"
LIBS += "C:\opencv\bin\bin\libopencv_highgui243.dll"

This is because code like bellow results in error "not finding core.hpp":

LIBS += -LC:\\opencv\\build\\x86\\vc10\\lib\
libopencv_core243 \
libopencv_highgui243 \

Now its autocomplete for opencv functions runs, and if you write :

cv::Mat im = cv::imread("D:\\Tulips.jpg");

there is no error. But if after this you write :

cv::imshow("im",im);

It closes the program with exception code : c0000005 It even doesn't fall in "catch" of an exception handler.

The strange thing is that VC++ express is doing just the same. I should mention that I have compiled opencv for MinGW myself, and the build was Ok because it works with Code::Blocks. I used prebuilt opencv with my VC++ 10 , but that doesn't work either. Pleaase help me!Thanks a lot!

2 Answers 2

1

Check if im.data is not null. Because c0000005 is access violation, that means you are using some invalid pointers, so show some more code or a better solution is to use a debugger and step-trough your code.

Sign up to request clarification or add additional context in comments.

5 Comments

it even exits with this code if I write : cout<<im . actually the pointer is null. but why? file which I want to read exists .
Make sure the path is correct and/or the file is not corrupted - i'm not experienced with opencv - maybe someone experienced with opencv can help you with that, if you confirm that is not a path/corrupted file issue.
Thank you. I'm sure about the path. But now I cheked im.rows and im.cols and I see that it undrestands image dimensions. but if I write : cout <<im.at<cv::Vec3b>(1,1)[0] it returns strange characters. the image has three channels.
Id im.data is null is means that using that image can go back to access violation anytime, see the documentation on why that can be null: opencv.willowgarage.com/documentation/cpp/… Are you sure you don't have windows set to hide the extension for known types and your image is not actually named Tulips.jpg and have the .jpg extension and the full name is not actually: Tulips.jpg.jpg?
No the path is ok. It reads the file and returns the rows and columns number . I see that im.data is null if the file path is wrong, but if the path is correct, even checking im.data is null or not causes crash.
0

I finally found my answer !! It was all ablut the firewall. My fireWall blocked the process and opencv couldn't access the memory. When I used cvLoadImage() , it worked, but cv::imread() didn't. I had added an exception for visual satudio but it seems that wasn't enough. Now my firewall is off and FINALLY EVERYTHING IS OKKK :) :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.