Ask Your Question
1

is it possible display full screen in mac with opencv?

asked 2013-04-24 03:20:23 -0600

okgogo2000 gravatar image

updated 2013-04-25 01:34:50 -0600

Hi guys,
I can use the below code to display full screen in Windows and Linux. but in Mac OS X, it always have the menu bar in the top! Is it possible to display full screen in mac with opencv? any one have ideas of this?

Regards Andy

solved fullscreen but crashed! this is the code: I used opencv2.4.3 and have done like this link http://code.opencv.org/issues/2846

but still crased!

cvNamedWindow(WIN_NAME, CV_WINDOW_NORMAL);
cvSetWindowProperty(WIN_NAME, CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
int screen_width = GlobalData::Instance()->GetScreenWidth();
int screen_height = GlobalData::Instance()->GetScreenHeight();
IplImage* img = cvCreateImage(cvSize(screen_width, screen_height), IPL_DEPTH_8U, 3);
cvZero(img);
cvShowImage(WIN_NAME, img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow(WIN_NAME);

Crash Informations:

    0   CoreFoundation                      0x00007fff8d1060a6 __exceptionPreprocess + 198

1   libobjc.A.dylib                     0x00007fff91d543f0 objc_exception_throw + 43
2   CoreFoundation                      0x00007fff8d19c6ea -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
3   CoreFoundation                      0x00007fff8d0f45ce ___forwarding___ + 414
4   CoreFoundation                      0x00007fff8d0f43b8 _CF_forwarding_prep_0 + 232
5   libopencv_highgui.2.4.dylib         0x0000000100594a8f -[CVView setFrameSize:] + 175
6   libopencv_highgui.2.4.dylib         0x000000010059246c cvShowImage + 1068

....

edit retag flag offensive close merge delete

Comments

why did you remove your code ?

berak gravatar imageberak ( 2013-04-24 04:27:53 -0600 )edit

I test it and see it is crashed and don't want to mislead someone. so I try to found the bug of my code. but after one day effort. the bug still didn't fix. :(

okgogo2000 gravatar imageokgogo2000 ( 2013-04-24 23:05:50 -0600 )edit

probably won't help with your crash, but make it : cvWaitKey(0); instead of sleep(1);

berak gravatar imageberak ( 2013-04-25 01:16:29 -0600 )edit

And for a starter, leave the C code and try the C++ interface first. There are tons of issues regarding pointers in C - interface, which needs hardcore debugging. So use namedWindow, setWindowProperty, Mat::zero instead of IplImage, ... Code would look like:

 namedWindow("test", CV_WINDOW_NORMAL);
 setWindowProperty("test", CV_WND_PROP_FULLSCREEN, CV, WINDOW_FULLSCREEN);
 int screen_width + int screen_heigth remain same;
 Mat img = Mat::zeros(screen_width, screen_heigth, CV_8UC3);
 imshow("test", img); waitKey(0);

Do not bother with releasing and destroying in C++, will be done for you when calling destructor of Mat element in garbage collector.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-25 01:28:56 -0600 )edit

Thanks. I try your ideas. and use the simple code. it still can't work on my macbookair with osx10.8.2. the programe run it shows a full screen white dialog(program cashed). but I can't quit (command+q, command+option+esc )except I push down power button on the keyboard.

okgogo2000 gravatar imageokgogo2000 ( 2013-04-25 03:10:54 -0600 )edit

The simple code:

include "opencv2test.h"

include <opencv2/core/core.hpp>

include <opencv2/highgui/highgui.hpp>

include <opencv2/imgproc/imgproc.hpp>

define WIN_NAME "Test"

int main(int argc, char *argv[]) { int screen_height = 768; int screen_width = 1366; cv::namedWindow(WIN_NAME, CV_WINDOW_NORMAL); cv::setWindowProperty(WIN_NAME, CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN); cv::Mat img = cv::Mat::zeros(screen_width, screen_height, CV_8UC3); cv::imshow(WIN_NAME, img); cv::waitKey(100); }

okgogo2000 gravatar imageokgogo2000 ( 2013-04-25 03:12:10 -0600 )edit

you didn't even change the window name... please fill in "test", which will make it more clear, change to static variable defining after that. Also, I am wondering why this shouldn't work. It seems to me you cannot define where the crash happens. Please again, go into debug mode and go step by step through your code. Are you sure it even gets executed?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-25 03:45:49 -0600 )edit

3 answers

Sort by ยป oldest newest most voted
2

answered 2013-04-25 03:47:38 -0600

Ok excuse me for posting another answer, but this seem to be the solution. There has been a bug report about going fullscreen on macOSX:

http://code.opencv.org/issues/2846

Basically use the patch that the person suggested supplies and recompile openCV. Else wait for it to get fixed.

edit flag offensive delete link more

Comments

Yes, I rebuilded the Opencv2.4.3 as the person suggested but still have the same problem. I will retry it for opencv2.4.2 then back here because the person used opencv2.4.2, even i know it is most probably still have the problem.

okgogo2000 gravatar imageokgogo2000 ( 2013-04-25 06:31:28 -0600 )edit

Please stick to openCV 2.4.5, why use old versions tha

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-25 08:00:39 -0600 )edit
1

answered 2013-04-24 05:36:48 -0600

updated 2013-04-24 05:38:00 -0600

The solution is pretty straightforward, though it is not mentioned in documents when looking for the namedWindow arguments.

namedWindow("Name", CV_WINDOW_NORMAL);
setWindowProperty("Name", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
imshow("Name", your_image); 
waitKey(0);
edit flag offensive delete link more

Comments

Hi Steven, Thanks. It is really full screen in Mac, But it always crash when show image. Do you of any idea of this?

I have edit the question to show the crash code.

okgogo2000 gravatar imageokgogo2000 ( 2013-04-24 22:46:07 -0600 )edit
0

answered 2013-04-24 03:23:24 -0600

berak gravatar image

try:

cvNamedWindow(CALIBRATE_FORM_NAME, CV_WINDOW_NORMAL);

(AUTOSIZE won't let you resize windows)

edit flag offensive delete link more

Comments

thanks. fix it with your comments

okgogo2000 gravatar imageokgogo2000 ( 2013-04-24 03:29:14 -0600 )edit

Question Tools

Stats

Asked: 2013-04-24 03:20:23 -0600

Seen: 4,141 times

Last updated: Apr 25 '13