cvNorm doesn't work with multi-channel images and mask (Bug #638)


Added by Frank Bauernöppel over 14 years ago. Updated almost 14 years ago.


Status:Done Start date:
Priority:Low Due date:
Assignee:- % Done:

0%

Category:core
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

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

Revision ecf770d4
Added by Andrey Kamaev almost 12 years ago

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

Also available in: Atom PDF