Question

I want to be able to work with RAW images in C++ so I downloaded an already compiled DCRaw executable. I tried compiling it myself but I kept getting errors. So I want to be able to read in raw images to C++ and work with them. What would be the best way to do this? Should I find a way to include dcraw.c in my projects and call functions in that, or should I access the EXE file using the system(...) function?

Était-ce utile?

La solution

If you don't want to manipulate the raw data directly in your application then yes you should use an already existing implementation of a raw image decoder (such as dcraw, like you said).

Here is what I would do in order of preference:

  1. I would first try to find another raw image decoder that is available as a static or dynamic library version and link to that (dcraw only has an executable).

  2. If #1 is not possible, I would extract the relevant parts of dcraw into a static library and link to that.

  3. If not possible, I would include the .c file in my code like you have proposed.

  4. I would only execute the EXE from within my program as a last resort.

That being said, if your application is for experimentation purposes only I don't see anything wrong in using the dcraw EXE from within your program. Otherwise I would not do this in a professional application.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top