How to flip matrix in place? [closed]

asked 2016-06-24 16:23:04 -0600

goldroses gravatar image

updated 2016-06-24 16:24:07 -0600

I would like to reduce the 3 matrixes to just 2 matrixes by converting and flipping in one command, or flipping in place. Is there any way how to increase efficiency of the code?

cv::Mat dImg; // assume its initalized with TYPE_16UC1
cv::Mat dImg_grey;
cv::Mat dImg_grey_flip;
dImg.convertTo(dImg_grey, CV_8UC1, 255. / (2500 - 0), 0);//  to grayscale cv::Mat, (max - min)
cv::flip(dImg_grey, dImg_grey_flip, 1);// cannot flip in place

Is it somehow possible to stuff the flip into the convert.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-11-11 08:47:25.378264


imho, you're worried in the wrong place, both operations are comparably cheap.

(and no, you can't flip in-place, and you can't combine them into a single operation.)

berak gravatar imageberak ( 2016-06-24 23:44:53 -0600 )edit