cvNorm doesn't work with multi-channel images and mask (Bug #638)
Description
With OpenCV rev 3852 (today's trunk) VC++2008 Win32, but unrelated to any platform specific code, one gets an assertion when cvNorm( a, b, CV_DIFF_L2, m ); is called as shown below.
Note the first call cvNorm( a, b, CV_DIFF_L2 );
succeeds and gives a reasonable result (600) summed up over all 3 channels.
int main( int argc, char *argv[] )
{
IplImage *a = cvCreateImage( cvSize(3,4), IPL_DEPTH_8U, 3 );
IplImage *b = cvCreateImage( cvSize(3,4), IPL_DEPTH_8U, 3 );
IplImage *m = cvCreateImage( cvSize(3,4), IPL_DEPTH_8U, 1 );
cvSet( a, cvScalarAll( 200) );
cvSet( b, cvScalarAll( 100) );
cvSet( m, cvScalar(255) ); // all pixels are in the mask
double p = cvNorm( a, b, CV_DIFF_L2 );
double q = cvNorm( a, b, CV_DIFF_L2, m );
}
This assertion is not new and "by design", but I consider this behaviour inconsistent to other functions like cvSub where
masks work as expected.
Associated revisions
Merge pull request #638 from bitwangyaoyao:2.4_fixErode
History
Updated by Vadim Pisarevsky almost 14 years ago
the problem has been fixed in SVN trunk (~r4900 or later)
- Status changed from Open to Done
- (deleted custom field) set to fixed