Does the OpenCV included with UE5 come with JPEG compatibility?

Hi there,

I’ve tried to use OpenCV’s imwrite method to save a capture of the scene. When I use BMP, PNG or EXR (with some more steps), no issue, the file is saved.
However, JPEG gives me an OpenCV error:
error: (-2:Unspecified error) could not find a writer for the specified extension in function 'cv::imwrite_'

I call it like this:

cv::imwrite("image.jpg", cvMatInThe-CV_8UC3-format);

After investigating a bit, I’ve seen that in cvconfig.h in the OpenCV plugin from UE5, HAVE_JPEG is not defined.

This leads me to think that I, by design, can’t save to JPEG.

Is there a reason for this, and how can I fix this?
Ideally, I’d like to use UE5’s OpenCV, but if it’s not possible, what would be the easiest alternative?

Thanks in advance :slight_smile: