OpenCV Matrix To Binary Image
I have client and server, have an image in client and I want to send this to server. That image is in cv::mat format. Therefore I need to convert this matrix to binary. I have tried memcpy(binImage,matImg.data,sizeof(matImg.data) binImage's format is char*
How can i convert this matImg to binImg? I don't have any experience about OpenCV.
The following should do the trick:
memcpy(binImage, matImg.data, matImg.step.p*matImg.rows)
However, I think you can avoid the copy and work directly with matImg.data.