Question

I want to covert a .jpg image to a .pgm image.The image is being obtained from a tcp socket which has live streaming by a OPENCV program. In matlab I used the imread function to do it. How do I do it in cpp? I am working in linux platform. Is there any function to do it in OPENCV?

can anyone help?

regards, shiksha

Était-ce utile?

La solution

Yes.

In OpenCV, you can use imread() to load the JPG image, and then use imwrite() it to the PGM image (by using the CV_IMWRITE_PXM_BINARY format flag).

Autres conseils

please look at OpenCV documentation for HighGui library functions cv::imread and cv::imwrite. Read the jpg using cv::imread and resave it with cv::imsave using filename with proper extension.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top