Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to flip matrix in place?

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
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.

How to flip matrix in place?

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.