is it possible display full screen in mac with opencv?
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
....
why did you remove your code ?
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. :(
probably won't help with your crash, but make it : cvWaitKey(0); instead of sleep(1);
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:
Do not bother with releasing and destroying in C++, will be done for you when calling destructor of Mat element in garbage collector.
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.
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); }
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?