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?
Yes, cv::flip().
Although a simple search through the docs would've given you this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With