@@ -415,26 +415,30 @@ module.exports = ({ cv, utils, getTestImg }) => {
415415 [ [ 1 , 1 , 1 ] , [ 11 , 12 , 13 ] ]
416416 ]
417417 const src = new cv . Mat ( srcData , cv . CV_8UC3 )
418+ const dstDepth8 = new cv . Mat ( dstData , cv . CV_8UC3 )
418419 let dst
419420 const mask = new cv . Mat ( maskData , cv . CV_8UC1 )
421+
422+ it ( 'should throw if dst has not a depth of CV_32F or CV_64F' , ( ) => {
423+ expect ( ( ) => cv . accumulate ( src , dstDepth8 ) ) . to . throw ( 'Imgproc::Accumulate - dst must has a depth of CV_32F or CV_64F' ) ;
424+ } ) ;
420425
421426 generateAPITests ( {
422427 getDut : ( ) => cv ,
423428 methodName : 'accumulate' ,
424- classNameSpace : 'Mat' ,
425429 methodNameSpace : 'Imgproc' ,
426430 beforeHook : ( ) => dst = new cv . Mat ( dstData , cv . CV_32FC3 ) ,
427431 getRequiredArgs : ( ) => ( [
428- dst ,
429432 src ,
433+ dst ,
430434 mask
431435 ] ) ,
432- expectOutput : res => {
436+ expectOutput : ( ) => {
433437 channelIndices = [ 'x' , 'y' , 'z' ]
434- for ( let row = 0 ; row < res . rows ; row ++ ) {
435- for ( let col = 0 ; col < res . cols ; col ++ ) {
436- for ( let channel = 0 ; channel < res . channels ; channel ++ ) {
437- expect ( res . at ( row , col ) [ channelIndices [ channel ] ] ) . to . be . closeTo ( expectedData [ row ] [ col ] [ channel ] , 1e-5 ) ;
438+ for ( let row = 0 ; row < dst . rows ; row ++ ) {
439+ for ( let col = 0 ; col < dst . cols ; col ++ ) {
440+ for ( let channel = 0 ; channel < dst . channels ; channel ++ ) {
441+ expect ( dst . at ( row , col ) [ channelIndices [ channel ] ] ) . to . be . closeTo ( expectedData [ row ] [ col ] [ channel ] , 1e-5 ) ;
438442 }
439443 }
440444 }
@@ -467,26 +471,30 @@ module.exports = ({ cv, utils, getTestImg }) => {
467471 const src1 = new cv . Mat ( srcData1 , cv . CV_8UC3 )
468472 const src2 = new cv . Mat ( srcData2 , cv . CV_8UC3 )
469473 let dst
474+ const dstDepth8 = new cv . Mat ( dstData , cv . CV_8UC3 )
470475 const mask = new cv . Mat ( maskData , cv . CV_8UC1 )
471476
477+ it ( 'should throw if dst has not a depth of CV_32F or CV_64F' , ( ) => {
478+ expect ( ( ) => cv . accumulateProduct ( src1 , src2 , dstDepth8 ) ) . to . throw ( 'Imgproc::AccumulateProduct - dst must has a depth of CV_32F or CV_64F' ) ;
479+ } ) ;
480+
472481 generateAPITests ( {
473482 getDut : ( ) => cv ,
474483 methodName : 'accumulateProduct' ,
475- classNameSpace : 'Mat' ,
476484 methodNameSpace : 'Imgproc' ,
477485 beforeHook : ( ) => dst = new cv . Mat ( dstData , cv . CV_32FC3 ) ,
478486 getRequiredArgs : ( ) => ( [
479- dst ,
480487 src1 ,
481488 src2 ,
489+ dst ,
482490 mask
483491 ] ) ,
484- expectOutput : res => {
492+ expectOutput : ( ) => {
485493 channelIndices = [ 'x' , 'y' , 'z' ]
486- for ( let row = 0 ; row < res . rows ; row ++ ) {
487- for ( let col = 0 ; col < res . cols ; col ++ ) {
488- for ( let channel = 0 ; channel < res . channels ; channel ++ ) {
489- expect ( res . at ( row , col ) [ channelIndices [ channel ] ] ) . to . be . closeTo ( expectedData [ row ] [ col ] [ channel ] , 1e-5 ) ;
494+ for ( let row = 0 ; row < dst . rows ; row ++ ) {
495+ for ( let col = 0 ; col < dst . cols ; col ++ ) {
496+ for ( let channel = 0 ; channel < dst . channels ; channel ++ ) {
497+ expect ( dst . at ( row , col ) [ channelIndices [ channel ] ] ) . to . be . closeTo ( expectedData [ row ] [ col ] [ channel ] , 1e-5 ) ;
490498 }
491499 }
492500 }
@@ -514,25 +522,29 @@ module.exports = ({ cv, utils, getTestImg }) => {
514522
515523 const src = new cv . Mat ( srcData , cv . CV_8UC3 )
516524 let dst
525+ const dstDepth8 = new cv . Mat ( dstData , cv . CV_8UC3 )
517526 const mask = new cv . Mat ( maskData , cv . CV_8UC1 )
518527
528+ it ( 'should throw if dst has not a depth of CV_32F or CV_64F' , ( ) => {
529+ expect ( ( ) => cv . accumulateSquare ( src , dstDepth8 ) ) . to . throw ( 'Imgproc::AccumulateSquare - dst must has a depth of CV_32F or CV_64F' ) ;
530+ } ) ;
531+
519532 generateAPITests ( {
520533 getDut : ( ) => cv ,
521534 methodName : 'accumulateSquare' ,
522- classNameSpace : 'Mat' ,
523535 methodNameSpace : 'Imgproc' ,
524536 beforeHook : ( ) => dst = new cv . Mat ( dstData , cv . CV_32FC3 ) ,
525537 getRequiredArgs : ( ) => ( [
526- dst ,
527538 src ,
539+ dst ,
528540 mask
529541 ] ) ,
530- expectOutput : res => {
542+ expectOutput : ( ) => {
531543 channelIndices = [ 'x' , 'y' , 'z' ]
532- for ( let row = 0 ; row < res . rows ; row ++ ) {
533- for ( let col = 0 ; col < res . cols ; col ++ ) {
534- for ( let channel = 0 ; channel < res . channels ; channel ++ ) {
535- expect ( res . at ( row , col ) [ channelIndices [ channel ] ] ) . to . be . closeTo ( expectedData [ row ] [ col ] [ channel ] , 1e-5 ) ;
544+ for ( let row = 0 ; row < dst . rows ; row ++ ) {
545+ for ( let col = 0 ; col < dst . cols ; col ++ ) {
546+ for ( let channel = 0 ; channel < dst . channels ; channel ++ ) {
547+ expect ( dst . at ( row , col ) [ channelIndices [ channel ] ] ) . to . be . closeTo ( expectedData [ row ] [ col ] [ channel ] , 1e-5 ) ;
536548 }
537549 }
538550 }
@@ -561,26 +573,30 @@ module.exports = ({ cv, utils, getTestImg }) => {
561573
562574 const src = new cv . Mat ( srcData , cv . CV_8UC3 )
563575 let dst
576+ const dstDepth8 = new cv . Mat ( dstData , cv . CV_8UC3 )
564577 const mask = new cv . Mat ( maskData , cv . CV_8UC1 )
565578
579+ it ( 'should throw if dst has not a depth of CV_32F or CV_64F' , ( ) => {
580+ expect ( ( ) => cv . accumulateWeighted ( src , dstDepth8 , alpha ) ) . to . throw ( 'Imgproc::AccumulateWeighted - dst must has a depth of CV_32F or CV_64F' ) ;
581+ } ) ;
582+
566583 generateAPITests ( {
567584 getDut : ( ) => cv ,
568585 methodName : 'accumulateWeighted' ,
569- classNameSpace : 'Mat' ,
570586 methodNameSpace : 'Imgproc' ,
571587 beforeHook : ( ) => dst = new cv . Mat ( dstData , cv . CV_32FC3 ) ,
572588 getRequiredArgs : ( ) => ( [
573- dst ,
574589 src ,
590+ dst ,
575591 alpha ,
576592 mask
577593 ] ) ,
578- expectOutput : res => {
594+ expectOutput : ( ) => {
579595 channelIndices = [ 'x' , 'y' , 'z' ]
580- for ( let row = 0 ; row < res . rows ; row ++ ) {
581- for ( let col = 0 ; col < res . cols ; col ++ ) {
582- for ( let channel = 0 ; channel < res . channels ; channel ++ ) {
583- expect ( res . at ( row , col ) [ channelIndices [ channel ] ] ) . to . be . closeTo ( expectedData [ row ] [ col ] [ channel ] , 1e-5 ) ;
596+ for ( let row = 0 ; row < dst . rows ; row ++ ) {
597+ for ( let col = 0 ; col < dst . cols ; col ++ ) {
598+ for ( let channel = 0 ; channel < dst . channels ; channel ++ ) {
599+ expect ( dst . at ( row , col ) [ channelIndices [ channel ] ] ) . to . be . closeTo ( expectedData [ row ] [ col ] [ channel ] , 1e-5 ) ;
584600 }
585601 }
586602 }
0 commit comments