我希望能够在 C++ 中使用 RAW 图像,所以我下载了一个已经编译的 DCRaw 可执行文件。我尝试自己编译它,但我不断收到错误。所以我希望能够将原始图像读入 C++ 并使用它们。最好的方法是什么?我应该找到一种方法将 dcraw.c 包含在我的项目中并在其中调用函数,还是应该使用 system(...) 函数访问 EXE 文件?
1 回答
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:
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).
If #1 is not possible, I would extract the relevant parts of dcraw into a static library and link to that.
If not possible, I would include the .c file in my code like you have proposed.
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.