Frage

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

War es hilfreich?

Lösung

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

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top