Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

since we cannot reproduce your hardware setup, here's a small testcase:

Mat m(960,1280,CV_16U);
randn(m,10000, 500);
Scalar M,D;
meanStdDev(m,M,D);
cout << M(0) << " " << D(0) << endl;
Mat m2 = m.reshape(0,1);
meanStdDev(m2,M,D);
cout << M(0) << " " << D(0);


10000.5 500.032
10000.5 500.032

so, probably not a meanStdDev bug, but a problem with your data acquisition.

1st thing to do: get rid of the deprecated IplImage !

Mat image(960, 1280, CV_16U);
ret = GetQHYCCDLiveFrame(camhandle,&w,&h,&bpp,&channels,imgage.data);

since we cannot reproduce your hardware setup, here's a small testcase:

Mat m(960,1280,CV_16U);
randn(m,10000, 500);
Scalar M,D;
meanStdDev(m,M,D);
cout << M(0) << " " << D(0) << endl;
Mat m2 = m.reshape(0,1);
meanStdDev(m2,M,D);
cout << M(0) << " " << D(0);


10000.5 500.032
10000.5 500.032

so, probably not a meanStdDev bug, but a problem with your data acquisition.

1st thing to do: get rid of the deprecated IplImage !

Mat image(960, 1280, CV_16U);
CV_16U); // allocate data
// now read it in directly
ret = GetQHYCCDLiveFrame(camhandle,&w,&h,&bpp,&channels,imgage.data);
GetQHYCCDLiveFrame(camhandle,&w,&h,&bpp,&channels, image.data);