Ask Your Question
0

V3.3 - imshow no response [closed]

asked 2017-09-12 13:43:43 -0600

busybyte gravatar image

updated 2017-09-13 02:26:50 -0600

Hello,

i just installed opencv3.3 under vs2017, windows 8.1, and tried imshow, which was runnin perfect under 3.2.

the result is a grey picture and the window state is: no response. i tried it with 2 different cams and with precompiled 3.3 as well as self compiled 3.3, same result.

image description

VideoCapture cap; if (!cap.open(1)) return 0; for (;;) { Mat frame;

        cap >> frame;
        //cap.read(frame);
        //cap.retrieve(frame, 1);
    if (frame.empty()) break; // end of video stream

        //frame.AUTO_STEP;
        cv::imshow("RoboCam", frame);
    }

the debugger steps permanent through the for loop while showing the window

do you have any ideas or same results with 3.3 ?

many thanks for your help !

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by busybyte
close date 2017-09-12 17:32:05.554505

Comments

Many thanks magic, you're also right, today i tested the restored backup without the waitkey command and i got the gray window again !

busybyte gravatar imagebusybyte ( 2017-09-13 02:27:02 -0600 )edit

Now i found the second/main-reason, cause i got the same problem with a facedetect-sample.

The reason is in different settings in debug and release-setups

Changing the following settings in debug-options and it will run great (i hope my translation is correct)

Option: C/C++ -> Preprocessor-> Processordefinitions: _DEBUG;%(PreprocessorDefinitions) ----> _NODEBUG;%(PreprocessorDefinitions)

Option: C/C++ ->Codegenerating->Runtimelibrary: Multithreaded-Debug-DLL (/MDd) -----> Multithreaded-DLL (/MD)

This works for me under x64-platform with vs2017

busybyte gravatar imagebusybyte ( 2017-09-13 13:16:33 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-09-12 13:57:32 -0600

berak gravatar image

updated 2017-09-12 14:00:35 -0600

  • magic: add a cv::waitkey(30); after the cv::imshow()

  • long answer: imshow() just copies a pointer to the image. the waitKey() call is required, because it actually handles the native message queue, which will blit the image to your current window. the argument passed there (in milliseconds) is the time to give back to your os for other processes ( think a 1 cpu celeron system)

edit flag offensive delete link more

Comments

p.s, this kind of behaviour did not change among versions, imho, you only lost a line of code in the transition

berak gravatar imageberak ( 2017-09-12 14:07:51 -0600 )edit

thanks magic,

i tried the cv::waitKey after imshow but still the same result. (i7,geforce gtx,8gb-ram)

i still wonder why 3.2 is working and also precompiled 3.3 not

the funny thing is, if i disconnect the usb-cam(verry good logitec) the last frame is shown

if i copy opencv_world320(d).lib/.dll to 330directories and change the linker to 320 i get a compiler error unresolved token in class cv::videocapture

busybyte gravatar imagebusybyte ( 2017-09-12 14:28:44 -0600 )edit

the problem maybe has been a bad configuration in my project. i restored a backup made with 3.2, configured it to 3.3 and copied the opencv_world330(d).dll's to my project outputdirectories. now it's working thank you magic and berak

busybyte gravatar imagebusybyte ( 2017-09-12 17:35:37 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-09-12 13:39:40 -0600

Seen: 1,059 times

Last updated: Sep 13 '17