简体   繁体   English

原始图像和C ++中的DCRaw

[英]Raw Images, and DCRaw in C++

I want to be able to work with RAW images in C++ so I downloaded an already compiled DCRaw executable. 我希望能够使用C ++处理RAW图像,所以我下载了一个已编译的DCRaw可执行文件。 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. 因此,我希望能够将原始图像读取到C ++中并使用它们。 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? 我应该找到在项目中包含dcraw.c并在其中调用函数的方法,还是应该使用system(...)函数访问EXE文件?

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). 如果您不想直接在应用程序中操作原始数据,则可以,您应该使用原始图像解码器的现有实现(如您所说的dcraw)。

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). 我首先会尝试找到另一个原始图像解码器,它可以作为静态或动态库版本使用并链接到该版本(dcraw仅具有可执行文件)。

  2. If #1 is not possible, I would extract the relevant parts of dcraw into a static library and link to that. 如果不可能使用#1,我将dcraw的相关部分提取到静态库中并链接到该库。

  3. If not possible, I would include the .c file in my code like you have proposed. 如果不可能,我将像您建议的那样在代码中包含.c文件。

  4. I would only execute the EXE from within my program as a last resort. 作为最后的选择,我只能从程序中执行EXE。

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. 话虽如此,如果您的应用程序仅用于实验目的,则在程序中使用dcraw EXE不会出现任何错误。 Otherwise I would not do this in a professional application. 否则,我不会在专业应用程序中执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM