libraw使用

来源:互联网 发布:mac解压软件 编辑:程序博客网 时间:2024/05/23 23:23
  • 解压。zip文件
  • 设置环境变量,使编译器或者链接器能够找到库和包含文件
  • 在VS开发人员命令提示命令行下进入对应目录,运行nmake -f Makefile.msvc
  • 如果设置正确,在lib文件夹下出现两个.lib文件。
  • 在程序属性VC++目录添加对应的包含目录和库目录。
  • 在链接器输入-附加依赖项中加入.lib文件。

Windows: Native Building

Building under Windows has three steps:

Unpack the distribution package (if you have got no tar+gzip, take the LibRaw distribution package in the .ZIP format) and go to folder LibRaw-X.YYY.
Set the environment parameters so that the compiler/linker would find the libraries and include-files. For Visual C++, this is done by running vcvars32.bat.
Run
nmake -f Makefile.msvc
If all paths are set correctly and the include-files/libraries have been found, then the following will be compiled:

Library libraw_static.lib in folder lib
Dynamic library bin/libraw.dll and linking library for it lib/libraw.lib
Examples in folder bin/.
Only the thread-safe library is built under Win32, but it can be used with non-threaded applications as well. All examples are linked with the dynamic library (DLL); if static linking is necessary, one should link applications with library libraw_static.lib and set the preprocessor option /DLIBRAW_NODLL during compilation.

Windows-version compiles without LCMS support for now.

During building of DLL, all public functions are exported; further, the exported subset may be reduced.

Unfortunately, paths to include/ libraries depend on the way Visual C (or other compiler) is installed; therefore, it is impossible to specify some standard paths in Makefile.msvc.


C++ API

  • Libraw 对象

LibRaw对象一种是不带有参数,一种是带有决定对象行为的标志参数。

#include "libraw/libraw.h"...    LibRaw ImageProcessor(unsigned int flags=0);...

flags(多个flags是通过|操作符连接)
LIBRAW_OPTIONS_NO_MEMERR_CALLBACK: 不设置标准内存不足处理程序(错误报告在stderr中)
LIBRAW_OPTIONS_NO_DATAERR_CALLBACK: 不设置标准文件读取错误处理程序(错误报告在stderr中)
三组用于图像处理的方法

 Data loading from the RAW file; Postprocessing functions emulating the dcraw behavior; File output functions emulating the dcraw behavior

处理的结果放在libraw_data_t的imgdata中;
 返回值
所有的libraw API函数按照约定的返回代码返回一个整型数值。请阅读有关约定和防止libraw致命错误行为的描述。
 从文件中载入数据的方法
int LibRaw::open_datastream(LibRaw_abstract_datastream *stream)
打开raw数据流,读取metadata,完成以下结构

imgdata.idata (libraw_iparams_t),imgdata.sizes (libraw_image_sizes_t),imgdata.color (libraw_colordata_t),imgdata.other (libraw_imgother_t), andimgdata.thumbnail (libraw_thumbnail_t)

函数按照约定的返回代码返回一个整型数值,如果任一系统调用返回一个错误返回正值,在libraw有错误情况返回负值。
通常在打开文件之前,recycle()被调用,因此,如果有几幅图像在批处理模式下,在每个处理循环后不需要调用recycle()。
Input data:对象指针,源于 LibRaw_abstract_datastream类。这个对象需要初始化,准备读。这个对象在使用后应该在调用程序中销毁。


int LibRaw::open_file(const char *filename[,INT64 bigfile_size])
Win32 only: int LibRaw::open_file(const wchar_t *filename[,INT64 bigfile_size])
创建 LibRaw_file_datastream对象,调用 open_datastream()。如果打开成功,设置内部符号标志,该符号是销毁内部数据流对象 recycle(),如果打开失败,创建的文件数据流立即被销毁。


int LibRaw::unpack(void)
解压图像RAW文件,计算暗电平(暗电平(black level)就是通常所说的电脑显示器或电视显示屏的亮度。暗电平决定图形显示器在图像的暗区发出的光线的强弱。)
结果放置在imgdata.image中。
读取数据有时受imgdata.params(libraw_output_params_t)的影响。
函数按照约定的返回代码返回一个整型数值,如果任一系统调用返回一个错误返回正值,在libraw有错误情况返回负值。
int LibRaw::unpack_thumb(void)
读取图像缩略图,将结果放在imgdata.thumb缓冲中,JPEG缩略图放在原封不动缓冲中,其他缩略图格式以解压位图(三通道,每通道都是8位),放在缓冲中。缩略图格式写入在imgdata.thumbnail.tformat中。
函数按照约定的返回代码返回一个整型数值,如果任一系统调用返回一个错误返回正值,在libraw有错误情况返回负值。


  • 辅助函数

检查库版本
const char* LibRaw::version() 返回版本字符串表示(如0.6.0-Alpha2 或者 0.6.1-Release)
int LibRaw::versionNumber() 返回libraw库版本的整数表示。
支持RAW格式列表
int LibRaw::cameraCount() 返回相机支持的个数
const cha r** LibRaw::cameraList() 返回支持相机列表,列表中的最后一项设置为0(便于打印)
int LibRaw::set_rawspeed_camerafile(char *path_to_cameras_xml)
(libraw 支持RawSpeed的情况)
载入含有RawSpeed相机描述的XML文件,文件是由path_to_cameras_xml指定的
载入成功返回0,否则返回非零值。
int LibRaw::get_decoder_info(libraw_decoder_info_t *)
函数通过传递指针用当前raw解码数据填充libraw_decoder_info_t结构
const char* LibRaw::unpack_function_name() 返回解压文件函数的名称,
意在为libraw套件测试设计用于覆盖测试。
void LibRaw::setCancelFlag()
此调用设置内部快速取消标志。如果设置,当前的RAW解码器将会终止。这个调用在你想取消多线程所有RAW解码器中是有用的。
int LibRaw::COLOR(int row, int col)
此调用返回bayer中行列像素颜色值。对于四个通道的bayer返回值从0到3,对于3个的则是从0到2 .
void LibRaw::subtract_black()
这个调用从RAW数据(合适的RAW数据)中减去暗电平值,colordata.data_maximum 、colordata.maximum 和 black level data (colordata.black 和colordata.cblack)也要调节。
如果你要用自己的代码处理数据这个调用应该会用到。Libraw 后处理函数自身调用subtract_black()
void LibRaw::recycle_datastream(void)
这个调用关闭与数据缓存和打开文件相关的输入数据流
void LibRaw::recycle(void)
释放LibRaw实例的分配数据,使得处理器再处理下一个文件,重复调用recycle()是十分可能的,不冲突。
LibRaw::~LibRaw()
析构函数,在recycle()中
const char* LibRaw::strprogress(enum LibRaw_progress code)
将处理阶段代码转换成描述字符串(英文的)
const char* LibRaw::strerror(int errorcode)
和strerror函数相似,输出libraw错误代码文本描述


  • 数据后处理:解码RAW(dcraw)行为的模拟

不用写自己的bayer模式后处理器,可以用解码raw(dcraw)函数,该函数在open_file() + unpack() /+ unpack_thumb()/之后调用。
参数设置
几乎所有的参数都可以通过dcraw命令行设置,通过LibRaw::imgdata.params结构指定字段赋值。结构类型是libraw_output_params_t;所有字段详情查看数据结构的描述。
int LibRaw::raw2image
这个函数为后处理(imgdata.image)分配缓存,并用兼容libraw0.13/0.14以下的数据填充。如果缓存已经分配,它将被释放重新分配。
该函数仅在代码正在做后处理时被调用,如果使用libraw的后处理调用,则不需要使用raw2image()
void LibRaw::free_image
此函数释放raw2image分配imgdata.image的缓存。
如果当前的后处理结果不是程序所需要的,这个方法应当被调用。
int LibRaw::adjust_sizes_info_only(void)
这个函数计算以下情况输出图像的正确大小(imgdata.sizes.iwidth and imgdata.sizes.iheight)
来自Fuji相机的文件(45度旋转);
来自非方像素相机的文件;
旋转相机图像快照
上述情况,函数改变图像输出大小的字段。这种改变不可重复。
int LibRaw::dcraw_process(void)
这个函数模拟了dcraw后处理能力,在调用LibRaw::unpack()后被调用
支持dcraw的整体作用(通过imgdata.params设置),除了
Dark frame subtraction
Work with bad pixels
函数只用于演示和测试目的,假设源代码大多数应用下,是作为raw 数据处理顺序的参考资料。


  • 数据输出到文件:dcraw行为的模拟

尽管大量的库文件以各种格式输出,libraw包含dcraw提供的模拟文件输出的调用。这样做主要是为了库的简单验证:合成文件必须是二进制文件
int LibRaw::dcraw_ppm_tiff_writer(const char *outfile)
此函数以PPM/PGM 或 TIFF格式(格式是通过imgdata.params.output_tiff设置)输出后处理结果到文件。结果与dcraw提供的相同
int LibRaw::dcraw_thumb_writer(const char *thumbfile)
位图缩略图以PPM格式写入文件,JPEG格式的缩略图以JPEG格式写入文件


  • 将解压数据复制到内存缓存

有一些函数调用用于将解压结果储存到内存缓存(dcraw_process之后调用)
get_mem_image_format –得到位图大小和深度结果
copy_mem_image-将后处理结果以不同的颜色顺序和线(行、列)步长复制到内存缓冲
dcraw_make_mem_image-将后处理数据存储到分配缓存
dcraw_make_mem_thumb-将缩略图以JPEG图像或者RGB位图存储到缓存
使用见samples/mem_image.c
void get_mem_image_format(int *widthp, int *heightp, int *colorsp, int *bpp) const ——返回处理位图大小
这个函数返回后处理图像的大小:
图像宽度以*widthp方式返回;位图高度以*heightp;图像颜色数目以*colorsp;像素位数(8/16)以*bpp
int LibRaw::copy_mem_image(void* scan0, int stride, int bgr)
函数参数:
void *scan0 - 指向缓存的指针,缓存大小至少stride*image_height
int stride - 图像线(行)步长,通常image_width*(bit_per_pixel/8)*image_colors,但是如果想行对齐,补偿可以大些。8、16、32
int bgr – 像素复制顺序,如果bgr==0以RGB,否则BGR
libraw_processed_image_t *dcraw_make_mem_image(int *errorcode=NULL)
——将解压、后处理数据以RGB位图形式存储到缓存
此函数分配内存缓存并将解压后处理数据存入缓存,函数返回libraw_processed_image_t结构,通常返回数据是RGB位图(类型字段是LIBRAW_IMAGE_BITMAP)。
dcraw_process()应当在dcraw_make_mem_image()之前被调用。
如果出现错误返回空。
libraw_processed_image_t *dcraw_make_mem_thumb(int *errorcode=NULL)
——将解压的缩略图存入缓存
函数返回libraw_processed_image_t结构,大部分RAW图像分配的结构包含JPEG图像(类型字段 LIBRAW_IMAGE_JPEG),一些RGB位图缩略图返回包含RGB位图的结构(类型字段 LIBRAW_IMAGE_JPEG)
在dcraw_make_mem_thumb() 之前要调用unpack_thumb() 。遇到错误返回为NULL
void LibRaw::dcraw_clear_mem(libraw_processed_image_t *)
释放dcraw_make_mem_image,dcraw_make_mem_thumb的分配内存。
这是静态的类成员,调用语法LibRaw::dcraw_clear_mem(…)
可以直接用系统函数free(),但是使用dcraw_make_mem,libraw(DLL)被内存管理器编译而不是用调用应用程序


  • Input layer abstraction输入层简介

数据结构
Libraw_data_t:libraw主要的数据结构(RawProcessor.imgdata)
使用C++API,可以作为LibRaw::imgdata,结构中的数据要在执行open_file(或者其他打开调用)之后才出现,(图像自身【unpack()填充】,包含缩略图信息【unpack_thumb()填充】)数据除外。
数据字段:
unsigned int progress_flags:记录了之前图像处理的过程
libraw_iparams_t idata:描述了从RAW文件检索的主要图像参数
libraw_image_sizes_t sizes:描述图像几何参数
libraw_colordata_t color:包含文件中的颜色数据
libraw_imgother_t other:包含从文件获得的图像参数,但在图像处理中不需要这些参数。
libraw_thumbnail_t thumbnail:
libraw_rawdata_t rawdata:指向raw数据缓存的指针,当调用raw2image或者dcraw_process()时填充。
ushort (*image)[4]:内存中是图像像素,当调用raw2image或者dcraw_process()时填充。
libraw_output_params_t params:图像后处理管理

libraw_iparams_t:图像主要参数
char make[64]:相机制造商
char model[64]:相机模式
unsigned raw_count:文件中RAW图像的数目(0意味着文件未被识别)
unsigned dng_version:DNG版本
1代表Foveon矩阵,0代表其他。LibRaw-demosaic-pack-GPL2支持Foveon
int colors:文件中的颜色数目
unsigned filters:位mask描述矩阵中颜色像素的顺序(0是全彩图像),32比特描述16个像素(8行,每行2个像素),每2位值从0到3. 简便起见,用COLOR(row,column)返回给定像素的颜色数目。值小于1000特殊保留:
1-Leaf Catchlight16*16 bayer矩阵
9-Fuji(6*6矩阵)
3…8,10…999 未被使用
char xtrans[6][6]:矩阵包含Fuji X-Trans row/col
char cdesc[5]:颜色描述从0到3(RGBG,RGBE,GMCY, or GBTG)

libraw_image_sizes_t:图像维数
libraw_image_sizes_t是所有描述图像大小的文件集合
数据段:
ushort raw_height, raw_width:RAW 图像(包括帧)全尺寸
ushort height, width:可视图像大小
ushort top_margin, left_margin:左上角坐标
ushort iheight, iwidth:输出图像大小(可能与相机中高宽有所不同)
unsigned raw_pitch:raw数据行数
double pixel_aspect:像素width/height比值
int flip:图像旋转方向(0代表不需要旋转,3代表旋转180度,5代表逆时针旋转90度,6代表顺时针旋转90度)

libraw_colordata_t:颜色信息
libraw_colordata_t结构包含所有颜色数据,既有来自RAW文件的也有基于图像自身计算的,对于不同的相机,有不同的颜色处理方式。
数据段:
ushort white[8][8]:CIFF/CRW文件白色像素块,不用于其他格式,用于计算白平衡系数。
float cam_xyz[4][3]:相机RGB-XYZ转换矩阵。矩阵是一个常量矩阵(不同模式也不同),RGB模式最后一行是0,其他非0
float cam_mul[4]:日光下白平衡系数
float cmatrix[3][4]:白平衡矩阵,相机中读取,或者计算
float rgb_cam[3][4]:另一种白平衡矩阵,从leaf/Kodak读取
ushort curve[0x4001]:相机色调曲线,相机中读取
unsigned black:暗电平。取决于相机,可以为0(意味着在解压阶段已经与自身相减)
unsigned cblack[4]:每个通道暗电平校正。通道N中最终暗电平black+cblack[N]
unsigned maximum:最大像素值。相机及其他中数据计算得来,这个值在后处理阶段可能会改变(执行了black subtraction ),以及自动调整(params.adjust_maximum_thr设置为非0值)
unsigned data_maximum:实际图像(不包括mask区域),在执行black subtraction后计算得来
ph1_t phase_one_data:颜色数据块
float flash_used:
float canon_ev:用于白平衡计算
char model2[64]:固件修订
void *profile:指向ICC配置文件指针
unsigned profile_length:ICC配置文件长度(比特)

libraw_imgother_t:图像其他参数
libraw_imgother_t包含从文件获得的图像参数,但在图像处理中不需要这些参数
数据段:
float iso_speed:ISO灵敏度
float shutter:快门速度
float aperture:孔径
float focal_len:焦距
time_t timestamp:拍摄日期
unsigned shot_order:图像序列号
unsigned gpsdata[32]:GPS数据
char desc[512]:图像描述
char artist[64]:图像拍摄者

libraw_rawdata_t:拥有解压RAW数据
libraw_rawdata_t有:
来自传感器的RAW数据,数据读取和解压用 unpack();颜色备份,防止后处理过程中修改,当重复调用后处理函数,从这个备份恢复所需的数据。
数据字段:
void *raw_alloc:存储RAW数据的缓存
unsigned short *raw_image:指向单通道数据缓存的指针
unsigned short (*color3_image)[3]:指向三通道像素数组的指针
unsigned short (*color4_image)[4]:指向4通道像素数组的指针
当调用unpack()上述字段只有一个是非空的。其他字段内部使用,开发人员不应该触碰它们。
libraw_thumbnail_t:描述缩略图
数据字段:
LibRaw_thumbnail_formats tformat:缩略图格式。值在枚举LibRaw_thumbnail_formats 中
ushort twidth, theight:缩略图以像素为单位的维数
unsigned tlength:以比特为单位的缩略图长度
int tcolors:颜色数目
char *thumb:指向缩略图数据文件的指针
libraw_output_params_t:后处理管理
libraw_output_params_t管理dcraw_process(), dcraw_ppm_tiff_writer(),dcraw_thumb_writer()的兼容调用,数据字段对应命令行键。
数据段:
unsigned greybox[4]:dcraw keys:-A x y w h
四个数字对应坐标(像素单位),坐标用来计算白平衡,X Y 是矩形的左上坐标,w h 对应矩形的宽和高。
unsigned cropbox[4]:dcraw keys:none
字段对应剪切矩形,crop[0],crop[1]是矩形的左上坐标,剩下的两个是宽和高,所有坐标适用于图像旋转之前。
double aber[4]:dcraw keys: -C
色差修正,唯一指定的值aber[0] –红色乘数aber[2]-绿色乘数
对于某些格式,该字段影响RAW数据的读取,因为色差修正会改变输出大小
double gamm[6]:dcraw keys: -g
gamma曲线设定。库用户需要设置gamma数组前两个字段。
gamma[0],gamma值的倒数
gamma[1],线性部分的斜率。
其余四个自动填充。
rec. BT.709默认设置,power 2.222,gamm[0]=1/2.222,斜率为4.5。sRGB曲线gamm[0]=1/2.4,gamm[1]=12.92,线性曲线gamm[0]/gamm[1]为1.0。
float user_mul[4]:dcraw keys: -r mul0 mul1 mul2 mul3,白平衡的4 multipliers (r,g,b,g)
unsigned shot_select:dcraw keys: -s
处理图像数目的选择
float bright:dcraw keys: -b
亮度,默认为1.0
float threshold:dcraw keys: -n
小波去噪参数
int highlight:dcraw keys: -H
0-9: Highlight mode (0=clip, 1=unclip, 2=blend, 3+=rebuild)
int use_auto_wb:dcraw keys: -a
使用通过平均整个图像获得的自动白平衡
int use_camera_wb:dcraw keys: -w
如果可能,使用相机的白平衡
int use_camera_matrix:dcraw keys: +M/-M
不要使用相机的颜色矩阵
int output_color:dcraw keys: -o
[0-5]输出色彩空间(raw, sRGB, Adobe, Wide, ProPhoto, XYZ)
char* output_profile:dcraw keys: -o filename
输出ICC配置文件的路径,LCMS支持编译才能用
char* camera_profile:dcraw keys: -p file
输入ICC配置文件的路径,LCMS支持编译才能用
char* bad_pixels:dcraw keys: -P file
bad pixels map文件的路径(使用格式”column row date-of-pixel-death-in-UNIX-format,每行一个像素)
char* dark_frame:dcraw keys: -K file
Path to dark frame file (in 16-bit PGM format)
int output_bps:dcraw keys: -4
8 bit (default)/16 bit (key -4)
int output_tiff:dcraw keys: -T
0/1: output PPM/TIFF
int user_flip:dcraw keys: -t
[0-7]翻转图像(0=none, 3=180, 5=90CCW, 6=90CW),默认-1,从RAW中取相应的值(不翻转?)
int user_qual:dcraw keys: -q
0-10: interpolation quality:
0 - linear interpolation
1 - VNG interpolation
2 - PPG interpolation
3 - AHD interpolation
4 - DCB interpolation
5 - Modified AHD interpolation by Paul Lee
6 - AFD interpolation (5-pass)
7 - VCD interpolation
8 - Mixed VCD/Modified AHD interpolation
9 - LMMSE interpolation
10 - AMaZE intepolation
11 - DHT intepolation
12 - Modified AHD intepolation (by Anton Petrusevich)
Values 5-9 are useful only if “LibRaw demosaic pack GPL2” compiled in (see README.demosaic-packs in your distribution for details). Value 10 is useful only if LibRaw compiled with “LibRaw demosaic pack GPL3”. If some interpolation method is unsupported because LibRaw compiled without corresponding demosaic pack, AHD interpolation will be used without any notice.
int user_black:dcraw keys: -k
暗电平
int user_cblack[4]:dcraw keys: none
关闭索尼相机ARW数据。这是不符合老LibRaw / dcraw,但增加了一位重要的数据(色调曲线)
int user_sat:dcraw keys: -S
饱和度调整
int med_passes:dcraw keys: -m
中值滤波器个数
int no_auto_bright:dcraw keys: -W
不要使用直方图自动增加亮度
float auto_bright_thr:dcraw keys:none
剪裁像素自动增加亮度,默认值0.01(1%),现在数兆低噪相机的建议值取决于拍摄风格。0.001-0.003浮动比较合理
float adjust_maximum_thr:dcraw keys:none
这个参数控制基于channel_maximum[]自适应最大值,如果计算的最大值超过,adjust_maximum_thr*maximum,最大值设置为calculated_maximum。默认值0.75,如果设置的值超过0.99999,将使用默认值。如果设置的值低于0.00001,不在调整最大值。Adjusting maximum should not damage any picture (esp. if you use default value) and is very useful for correcting channel overflow problems (magenta clouds on landscape shots, green-blue highlights for indoor shots)
int use_fuji_rotate:dcraw keys: -j
默认值-1,0 - don’t use rotation for cameras on a Fuji sensor
int green_matching:dcraw keys: none打开绿通道不平衡修复
默认值0,1-在后处理阶段打开,绿色配准需要额外的内存消耗
int dcb_iterations:dcraw keys: none
DCB修正滤波器数目。默认-1 (不修正)。适用于DCB插值
int dcb_enhance_fl:dcraw keys: none
非零:增强插值色彩的DCB插值
int fbdd_noiserd:dcraw keys: none
在插值之前控制FBDD降噪
0 - do not use FBDD noise reduction
1 - light FBDD reduction
2 (and more) - full FBDD reduction
int eeci_refine:dcraw keys: none
非0-使用EECI改进的VCD插值
int es_med_passes:dcraw keys: none
VCD+AHD插值之后边缘敏感中指滤波器数目,高于1不建议用
int ca_correc:dcraw keys:none
如果是正值开启色差修正,默认是0(关)
float cared,cablue
dcraw keys: none
If one of these fields is non-zero, then these values will be used instead of automatic ones. Useable range is +-0.1..+-4.0.
int cfaline; float linenoise;
Line noise (banding) reduction.
positive value turns this feature on (default: off).
linenoise - amount of reduction. Useful range is 0.001 to 0.02. Default value is 0.0 i.e. not clean anything.
int cfa_clean; float lclean,cclean;
Reduce impulse noise and Gaussian high frequency.
cfa_clean: positive value turns the feature on (default: off).
lclean,cclean - amount of noise reduction for (L)uminance and (C)olor. Useable range from 0.005 to 0.05, common value 0.01
int cfa_green; float green_thresh;
Reduces maze artifacts produced by bad balance of green channels.
cfa_green: positive value turns the feature on (default: off).
green_thresh - max difference between channels allowed for equalization. Useful range between 0.01 and 0.1.
int exp_correc; float exp_shift,exp_preser;
去马赛克(插值)之前曝光度调整,当exp_correc为正值开启这项功能,exp_shift线性曝光偏移,从0.25到8.0,(0.25-2.0偏黑,3.0-8.0)
Exposure correction before demosaic.
exp_correc: positive value turns the feature on (default: off).
exp_shift: exposure shift in linear scale. Usable range from 0.25 (2-stop darken) to 8.0 (3-stop lighter). Default: 1.0 (no exposure shift).
exp_preser: preserve highlights when lighten the image. Usable range from 0.0 (no preservation) to 1.0 (full preservation). 0.0 is the default value.
int wf_debanding; float wf_deband_treshold[4];
wf_debanding: 1 turns on banding suppression (slow!), 0 turns it off.
wf_deband_treshold[] - per channel debanding thresholds.
int use_rawspeed;
Turns on using RawSpeed library for data unpacking (only if RawSpeed support compiled in).
int no_auto_scale;
Disables pixel values scaling (call to LibRaw::scale_colors()) in LibRaw::dcraw_process()
int no_interpolation;
Disables call to demosaic code in LibRaw::dcraw_process()
int sraw_ycc;
Disables YCbCr to RGB conversion for Canon sRAW/mRAW files.
libraw_decoder_info_t:RAW解码器的名称和数据格式
const char *decoder_name 解码函数名称
unsigned decoder_flags 解码数据格式
libraw_processed_image_t:dcraw_make_mem_image()/dcraw_make_mem_thumb()
函数结果
结构libraw_processed_image_t是由调用dcraw_make_mem_image()/ dcraw_make_mem_thumb()产生和包含插值数据内存图像或缩略图。
数据字段:
LibRaw_image_formats type:这个字段记录数据类型
LIBRAW_IMAGE_BITMAP: RGB bitmap,metadata有效
LIBRAW_IMAGE_JPEG:JPEG文件图像,数据大小数据字段有效
ushort height,width:图像大小(像素单位), type==LIBRAW_IMAGE_BITMAP有效
ushort colors, bits:颜色通道数(1或3)颜色深度(8或16),type==LIBRAW_IMAGE_BITMAP有效
ushort gamma_corrected:gamma修正,type==LIBRAW_IMAGE_BITMAP有效
unsigned int data_size:数据字段大小(bytes),bitmap图像height*width*colors * (bits/8),For JPEG image - exact JPEG size (i.e. extracted thnumbnail size + JPEG header + EXIF header).
unsigned char data[]:数据数组。
Parameters of the LibRaw::imgdata.params Structure Affecting the Behavior of open_file/unpack/unpack_thumb
Most data fields of structure LibRaw::imgdata.params affect only data postprocessing, but there are some exceptions, which have been inherited by the current version of LibRaw from/ dcraw source texts (these dependences will be gradually removed).
imgdata.params.use_camera_matrix and imgdata.params.use_camera_wb
These fields affect loading of RAW data for cameras with a color matrix.
Attention! If parameter imgdata.params.use_camera_matrix is not set by the user, it is copied from imgdata.params.use_camera_wb at the stage of file opening.
imgdata.params.user_flip
If this parameter is greater than or equal to zero, assignment imgdata.sizes.flip = imgdata.params.user_flip is performed at the open_file() stage.
imgdata.params.shot_select
This parameter makes it possible to select the number of the extracted image for data formats in which storage of several RAW images in one data file is possible.
imgdata.params.half_size
Affects RAW data loading for Phase One and Sinar backs. Also, it this parameter is set then image bitmap will be reduced by half in each dimension. In later case, all 4 components of bitmap will be filled during data extraction phase.
imgdata.params.threshold, imgdata.params.aber
If these parameters used, then half-sized bitmap will be used for data unpacking. See above for details.
imgdata.params.use_camera_wb
Affects loading of white balance matrix for Leaf backs.

0 0
原创粉丝点击