0
votes

I have an application which can accept images as byte data in many different formats. Under the covers, the application uses both custom code and opencv conversion methods to convert those images into formats that we can use.

I am attempting to write some unit tests to add images into our library in many different formats to make sure that the application works and that the application performance isn't negatively affected by the different formats.

To do this, I figured I would create a tool which can load a JPEG and then use opencv's conversion methods to convert the image from the BGR format that opencv loads it in into all the different input formats we accept. Unfortunately, it seems that OpenCV provide support for converting into the RGB space, but not so much support in the other direction (say RGB to YUV_NV21).

Are there any other libraries or applications that I could use to do this?

It would be nice if I could do the conversions as part of the unit tests and just iterate over all the different formats, but if I need to generate the inputs ahead of time as binary data files, that would be ok too.

Thanks in advance.

EDIT: When I say image format, I don't mean a compressed image format, like JPEG or PNG. I mean the different raw image formats, like RGB, RGBX, YUV (in all its different formulations) etc.

4

4 Answers

1
votes

You may be interested in Intel's IPP. It has plenty of color conversion routines. It's not free, though.

1
votes

In a way that contributes to everyone, consider just using netpbm for what exists, and adding conversion routines for what else you need. netpbm.sourceforge.net

1
votes

Imagemagick is one possibility:

http://www.imagemagick.org/script/index.php

and it's used by many popular applications.

You can also google for specific libraries that support the formats you want.

Edit: Since you want the raw formats, here's a nice project that does some of what you want. Converting RGB to YUV and viceversa isn't difficult. You just need to use the formulas.

http://www.codeproject.com/Articles/402391/RGB-to-YUV-conversion-with-different-chroma-sampli

0
votes

Try VTK. They have different image writers