Converting cv::Mat to byte array [] in objective-c++

asked 2020-08-11 03:42:25 -0600

updated 2020-08-11 04:03:56 -0600

berak gravatar image

Hi am Prabh new with OpenCV and working with tModel in iOS objective-c++. I have successfully converted the Camera frame to image cv::Mat and want to convert this cv::Mat to bytes array. Currently stuck here from last two days please anyone help me . Thanks in Advance

cv::Mat srcMat = cv::Mat(points,false); cv::Mat destMat = cv::Mat(desPoints);

cv::Mat transferMat = cv::getPerspectiveTransform(srcMat, destMat);
cv::warpPerspective(imageMat,destImageMat,transferMat,destImageMat.size());
cv::cvtColor(destImageMat, destImageMat,cv::COLOR_RGBA2GRAY);
cv::adaptiveThreshold(destImageMat, destImageMat, 255, cv::ADAPTIVE_THRESH_MEAN_C, cv::THRESH_BINARY, 15, 15);

cv::flip(destImageMat,destImageMat, -1);
UIImage *destImage1 = MatToUIImage(destImageMat);

Now the next step is convert this "destImageMat" to Bytes Array.

edit retag flag offensive close merge delete