1

I have a strange problem with OpenCV. Here's the code:

    cv::Mat cvSideDepthImage1(150, 150, CV_8UC1, cv::Scalar(100));
    cv::imshow("side1", cvSideDepthImage1);

Based on the documentation for cv::Mat, I would expect this to show a 150x150 image with all pixels set to 100 (so the whole picture should be gray).

Instead I get this:

enter image description here

What am I doing wrong?

houbysoft
  • 32,532
  • 24
  • 103
  • 156
  • is the window that displays the image also the right size? (150x150) – scord Jul 24 '12 at 17:09
  • @scordova88, yes, it seems that it's not 150x150. And I think this is a bug. – ArtemStorozhuk Jul 24 '12 at 17:10
  • I've tested your code on Ubuntu and it works OK (shows fully filled square). So this is an IOS specific bug. – ArtemStorozhuk Jul 24 '12 at 17:11
  • @Astor: yes I've just noticed that the window is actually 200x150. So it seems that it fills out the 150x150 px correctly but for some weird reason the window does not match the size of the image. – houbysoft Jul 24 '12 at 17:15
  • @Astor: bug reported : http://code.opencv.org/issues/2189. – houbysoft Jul 24 '12 at 17:27
  • It's not a bug. Windows cannot be too small - there is a minimum window size defined for each os. on mac, that is bigger. In windows, the minimum size is around 50px. I do not know about Linux. – Sam Jul 24 '12 at 20:37
  • @vasile: I thought about that, but I was able to resize a TextEdit window to about 100x50 just fine. – houbysoft Jul 24 '12 at 20:50
  • There are different sizes and defaults. It may be the minimum default size, and you may be able to shrink it if you open with RESIZE flag. but definitely is not a bug. I encountered the same behaviour in Windows, for sizes below a given threshold. – Sam Jul 24 '12 at 21:02
  • @vasile: I just set Terminal's default window size to 150x100; again it worked fine... – houbysoft Jul 24 '12 at 21:20

1 Answers1

2

This seems to be a bug in OpenCV on OS X.

I have reported it here.

houbysoft
  • 32,532
  • 24
  • 103
  • 156