Commit ad5c50a9 authored by Tetragramm's avatar Tetragramm

Improve the efficiency as suggested by vpisarev.

Alter the Rotation enum to be unambiguous as to direction.
parent 6f7bf653
...@@ -1023,9 +1023,9 @@ around both axes. ...@@ -1023,9 +1023,9 @@ around both axes.
CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode); CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode);
enum RotateFlags { enum RotateFlags {
ROTATE_90 = 0, //Rotate 90 degrees clockwise ROTATE_90_CLOCKWISE = 0, //Rotate 90 degrees clockwise
ROTATE_180 = 1, //Rotate 180 degrees clockwise ROTATE_180 = 1, //Rotate 180 degrees clockwise
ROTATE_270 = 2, //Rotate 270 degrees clockwise ROTATE_90_COUNTERCLOCKWISE = 2, //Rotate 270 degrees clockwise
}; };
/** @brief Rotates a 2D array in multiples of 90 degrees. /** @brief Rotates a 2D array in multiples of 90 degrees.
The function rotate rotates the array in one of three different ways: The function rotate rotates the array in one of three different ways:
......
...@@ -832,14 +832,16 @@ static bool ocl_rotate(InputArray _src, OutputArray _dst, int rotateMode) ...@@ -832,14 +832,16 @@ static bool ocl_rotate(InputArray _src, OutputArray _dst, int rotateMode)
{ {
switch (rotateMode) switch (rotateMode)
{ {
case ROTATE_90: case ROTATE_90_CLOCKWISE:
flip(_src.getUMat().t(), _dst, 1); _dst.getUMat() = _src.getUMat().t();
flip(_dst, _dst, 1);
break; break;
case ROTATE_180: case ROTATE_180:
flip(_src, _dst, -1); flip(_src, _dst, -1);
break; break;
case ROTATE_270: case ROTATE_90_COUNTERCLOCKWISE:
flip(_src.getUMat().t(), _dst, 0); _dst.getUMat() = _src.getUMat().t();
flip(_dst, _dst, 0);
break; break;
default: default:
break; break;
...@@ -856,14 +858,16 @@ void rotate(InputArray _src, OutputArray _dst, int rotateMode) ...@@ -856,14 +858,16 @@ void rotate(InputArray _src, OutputArray _dst, int rotateMode)
switch (rotateMode) switch (rotateMode)
{ {
case ROTATE_90: case ROTATE_90_CLOCKWISE:
flip(_src.getMat().t(), _dst, 1); _dst.getMat() = _src.getMat().t();
flip(_dst, _dst, 1);
break; break;
case ROTATE_180: case ROTATE_180:
flip(_src, _dst, -1); flip(_src, _dst, -1);
break; break;
case ROTATE_270: case ROTATE_90_COUNTERCLOCKWISE:
flip(_src.getMat().t(), _dst, 0); _dst.getMat() = _src.getMat().t();
flip(_dst, _dst, 0);
break; break;
default: default:
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment