Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将 .jpg 图像转换为 .pgm 图像。图像是从 tcp 套接字获取的,该套接字通过 OPENCV 程序进行实时流式传输。在 matlab 中,我使用了 imread 函数来执行此操作。我如何在cpp中做到这一点?我在linux平台上工作。OPENCV有什么功能可以做到吗?
谁能帮忙?
问候, shiksha
是的。
在 OpenCV 中,您可以使用imread()加载 JPG 图像,然后将imwrite()其用于 PGM 图像(通过使用CV_IMWRITE_PXM_BINARY格式标志)。
imread()
imwrite()
CV_IMWRITE_PXM_BINARY
请查看 OpenCV 文档以了解 HighGui 库函数cv::imread和cv::imwrite. 使用具有适当扩展名的文件名读取 jpgcv::imread并重新保存它。cv::imsave
cv::imread
cv::imwrite
cv::imsave