is there an unnecessary code repeat? [closed]

asked 2019-09-02 14:10:28 -0600

updated 2019-09-04 12:47:08 -0600

hi all,

could you take a look at the code in copy.cpp

is there an unnecessary code repeat? ( the part below is exactly same )

switch (rotateMode)
{
case ROTATE_90_CLOCKWISE:
    transpose(_src, _dst);
    flip(_dst, _dst, 1);
    break;
case ROTATE_180:
    flip(_src, _dst, -1);
    break;
case ROTATE_90_COUNTERCLOCKWISE:
    transpose(_src, _dst);
    flip(_dst, _dst, 0);
    break;
default:
    break;
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2019-09-18 02:32:15.132460

Comments

1

Maybe try to remove ocl_rotate() and CV_OCL_RUN(_dst.isUMat(), ocl_rotate(_src, _dst, rotateMode)). Try to validate it with a sample test code with Umat and Mat and by running the OpenCV tests.

But yes, it looks like not needed at first sight.

Eduardo gravatar imageEduardo ( 2019-09-04 15:09:57 -0600 )edit

thanks for your comment @Eduardo

sturkmen gravatar imagesturkmen ( 2019-09-05 14:32:25 -0600 )edit

@Tetragramm what is your opinion ?

sturkmen gravatar imagesturkmen ( 2019-09-16 11:15:17 -0600 )edit
2

I would like to think I had a reason for putting that there, but I can't remember, and it certainly looks unnecessary. It should be safe to remove, because flip and transpose contain the necessary OCL checks.

Tetragramm gravatar imageTetragramm ( 2019-09-17 22:17:45 -0600 )edit

@Tetragramm thank you.

sturkmen gravatar imagesturkmen ( 2019-09-18 02:31:49 -0600 )edit