Vra

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

Was dit nuttig?

Oplossing

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

Ander wenke

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.

Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow
scroll top