lkdemo.cpp will not run in OpenCV 3.0

asked 2016-06-06 18:26:58 -0500

Brock gravatar image

I am able to build lkdemo.cpp in the samples folder of OpenCV 3.0. When I run the code, it displays the video from the webcam, but will not allow me to click and errors out with the following:

"Unhandled exception at 0x521ac3d2 in test.exe: 0xC0000005: Access violation reading location 0x00000000."

The code is stock. it stops at the following location: if( addRemovePt && points[1].size() < (size_t)MAX_COUNT ) { vector<point2f> tmp; tmp.push_back(point); -----> cornerSubPix( gray, tmp, winSize, Size(-1,-1), termcrit); points[1].push_back(tmp[0]); addRemovePt = false; }

Again stock code, I can see the video, but cannot click to put the dot on the screen. I also cannot auto-initialize.

I get the following when auto initializing: Unhandled exception at 0x5552df22 (msvcr110.dll) in test.exe: 0xC0000005: Access violation writing location 0x00000000.

Can Someone Please help me get this problem fixed?


edit retag flag offensive close merge delete


since you seem to be using windows/vs2010, please check, if you're not accidentally mixing debug/release opencv libs

berak gravatar imageberak ( 2016-06-06 22:45:14 -0500 )edit

berak. thank you for the reply. i do not believe i am. i guess i do not know how to tell. i have been in debug mode and release mode. using the libs found in vc11

Brock gravatar imageBrock ( 2016-06-07 09:32:39 -0500 )edit

i have tried this in msvs 2012 and 2008. I have tried as an empty console app, as a x64 build and x86 build. i have tried opencv30 and 31.

Brock gravatar imageBrock ( 2016-06-07 09:33:51 -0500 )edit