Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the opencv equivalent to matlab's fliplr()?

Tags:

c++

opencv

matlab

My solution is:

cv::Mat FlipLR(const cv::Mat& inImg)
{
    //create flipped image from Left to right
    cv::Mat outImg(inImg.size(), inImg.type());
    cv::Mat_<double> FlipMatrix(2, 3);
    FlipMatrix << -1, 0, inImg.cols - 1, 
        0, 1, 0; 

    cv::warpAffine( inImg, outImg, FlipMatrix, outImg.size(), cv::INTER_NEAREST );

    return outImg;
}

Is there a more efficient way to do this?

like image 805
Yonatan Simson Avatar asked Apr 20 '15 05:04

Yonatan Simson


1 Answers

Yes, cv::flip().

Although a simple search through the docs would've given you this.

like image 135
a-Jays Avatar answered Sep 27 '22 22:09

a-Jays