本文整理汇总了C++中LibRaw类的典型用法代码示例。如果您正苦于以下问题:C++ LibRaw类的具体用法?C++ LibRaw怎么用?C++ LibRaw使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LibRaw类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: libraw_dcraw_thumb_writer
int libraw_dcraw_thumb_writer(libraw_data_t* lr,const char *fname)
{
if(!lr) return EINVAL;
LibRaw *ip = (LibRaw*) lr->parent_class;
return ip->dcraw_thumb_writer(fname);
}
示例2: libraw_set_dataerror_handler
void libraw_set_dataerror_handler(libraw_data_t* lr,data_callback func,void *data)
{
if(!lr) return;
LibRaw *ip = (LibRaw*) lr->parent_class;
ip->set_dataerror_handler(func,data);
}
示例3: libraw_dcraw_document_mode_processing
int libraw_dcraw_document_mode_processing(libraw_data_t* lr)
{
if(!lr) return EINVAL;
LibRaw *ip = (LibRaw*) lr->parent_class;
return ip->dcraw_document_mode_processing();
}
示例4: libraw_set_progress_handler
void libraw_set_progress_handler(libraw_data_t* lr, progress_callback cb,void *data)
{
if(!lr) return;
LibRaw *ip = (LibRaw*) lr->parent_class;
ip->set_progress_handler(cb,data);
}
示例5: libraw_set_memerror_handler
void libraw_set_memerror_handler(libraw_data_t* lr, memory_callback cb,void *data)
{
if(!lr) return;
LibRaw *ip = (LibRaw*) lr->parent_class;
ip->set_memerror_handler(cb,data);
}
示例6: main
int main(int argc, char const *argv[])
{
LibRaw rawProcessor;
rawProcessor.open_file(argv[argc-1]);
rawProcessor.unpack();
// Use 16-bit input.
buffer_t input_buf = {0};
input_buf.host = (uint8_t *)rawProcessor.imgdata.rawdata.raw_image;
input_buf.stride[0] = 1;
input_buf.stride[1] = rawProcessor.imgdata.sizes.width;
input_buf.extent[0] = rawProcessor.imgdata.sizes.width;
input_buf.extent[1] = rawProcessor.imgdata.sizes.height;
input_buf.elem_size = sizeof(*rawProcessor.imgdata.rawdata.raw_image);
// Allocate WxH 16-bit, 3 channel output buffer.
buffer_t output_buf = {0};
output_buf.stride[0] = 1;
output_buf.stride[1] = rawProcessor.imgdata.sizes.width;
output_buf.stride[2] = rawProcessor.imgdata.sizes.width * rawProcessor.imgdata.sizes.height;
output_buf.stride[3] = rawProcessor.imgdata.sizes.width * rawProcessor.imgdata.sizes.height * 3;
output_buf.extent[0] = rawProcessor.imgdata.sizes.width;
output_buf.extent[1] = rawProcessor.imgdata.sizes.height;
output_buf.extent[2] = 3;
output_buf.elem_size = 2;
uint8_t *output_data = new uint8_t[sizeof(uint16_t) * rawProcessor.imgdata.sizes.width * rawProcessor.imgdata.sizes.height * 3];
output_buf.host = output_data;
output_buf.host_dirty = false;
output_buf.dev_dirty = false;
output_buf.dev = 0;
for (int i = 0; i<20; i++) {
igd_demosaic(&input_buf, 0, &output_buf);
}
//Image<uint16_t> output_image = Image<uint16_t>(&output_buf, "output");
//output_image.copy_to_host();
//Tools::save_image(output_image, "test.png");
return 0;
}
示例7: rawFilesExt
bool KDcraw::loadEmbeddedPreview(QByteArray& imgData, const QBuffer& buffer)
{
QString rawFilesExt(KDcrawIface::KDcraw::rawFiles());
LibRaw raw;
QByteArray inData = buffer.data();
int ret = raw.open_buffer((void*) inData.data(), (size_t) inData.size());
if (ret != LIBRAW_SUCCESS)
{
qCDebug(LIBKDCRAW_LOG) << "LibRaw: failed to run open_buffer: " << libraw_strerror(ret);
raw.recycle();
return false;
}
return (Private::loadEmbeddedPreview(imgData, raw));
}
示例8: main
int main(int ac, char *av[])
{
int i, ret;
LibRaw RawProcessor;
if(ac<2)
{
printf(
"multirender_test - LibRaw %s sample. Performs 4 different renderings of one file\n"
" %d cameras supported\n"
"Usage: %s raw-files....\n"
,LibRaw::version(), LibRaw::cameraCount(),
av[0]);
return 0;
}
for (i=1;i<ac;i++)
{
printf("Processing file %s\n",av[i]);
if( (ret = RawProcessor.open_file(av[i])) != LIBRAW_SUCCESS)
{
fprintf(stderr,"Cannot open_file %s: %s\n",av[i],libraw_strerror(ret));
continue; // no recycle b/c open file will recycle itself
}
if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
{
fprintf(stderr,"Cannot unpack %s: %s\n",av[i],libraw_strerror(ret));
continue;
}
process_once(RawProcessor,0,0,0,1,-1,av[i]); // default flip
process_once(RawProcessor,1,0,1,2,-1,av[i]);
process_once(RawProcessor,1,1,0,3,-1,av[i]); // default flip
process_once(RawProcessor,1,1,0,4,1,av[i]); // flip 1
process_once(RawProcessor,1,1,0,5,3,av[i]); // flip 3
process_once(RawProcessor,1,1,0,6,1,av[i]); // 1 again same as 4
process_once(RawProcessor,1,1,0,7,-1,av[i]); // default again, same as 3
process_once(RawProcessor,0,0,0,8,-1,av[i]); // same as 1
RawProcessor.recycle(); // just for show this call
}
return 0;
}
示例9: Validate
static BOOL DLL_CALLCONV
Validate(FreeImageIO *io, fi_handle handle) {
LibRaw RawProcessor;
BOOL bSuccess = TRUE;
// wrap the input datastream
LibRaw_freeimage_datastream datastream(io, handle);
// open the datastream
if(RawProcessor.open_datastream(&datastream) != LIBRAW_SUCCESS) {
bSuccess = FALSE; // LibRaw : failed to open input stream (unknown format)
}
// clean-up internal memory allocations
RawProcessor.recycle();
return bSuccess;
}
示例10: fileInfo
bool KDcraw::rawFileIdentify(DcrawInfoContainer& identify, const QString& path)
{
QFileInfo fileInfo(path);
QString rawFilesExt(rawFiles());
QString ext = fileInfo.suffix().toUpper();
identify.isDecodable = false;
if (!fileInfo.exists() || ext.isEmpty() || !rawFilesExt.toUpper().contains(ext))
return false;
LibRaw raw;
int ret = raw.open_file((const char*)(QFile::encodeName(path)).constData());
if (ret != LIBRAW_SUCCESS)
{
qCDebug(LIBKDCRAW_LOG) << "LibRaw: failed to run open_file: " << libraw_strerror(ret);
raw.recycle();
return false;
}
ret = raw.adjust_sizes_info_only();
if (ret != LIBRAW_SUCCESS)
{
qCDebug(LIBKDCRAW_LOG) << "LibRaw: failed to run adjust_sizes_info_only: " << libraw_strerror(ret);
raw.recycle();
return false;
}
Private::fillIndentifyInfo(&raw, identify);
raw.recycle();
return true;
}
示例11: Java_com_androsz_andslr_LibRaw_getThumbnailDimensions
extern "C" JNIEXPORT jshortArray JNICALL Java_com_androsz_andslr_LibRaw_getThumbnailDimensions(JNIEnv * env, jobject obj, jstring jfilename)
{
LibRaw raw;
jboolean bIsCopy;
const char* strFilename = (env)->GetStringUTFChars(jfilename , &bIsCopy);
// Open the file and read the metadata
raw.open_file(strFilename);
(env)->ReleaseStringUTFChars(jfilename, strFilename);// release jstring
// Let us unpack the image
raw.unpack_thumb();
jshortArray js = (env)->NewShortArray(sizeof(jshort)*2);
//env->SetShortArrayRegion(js,0,sizeof(jshort),(jshort*)raw.imgdata.thumbnail.theight);
//env->SetShortArrayRegion(js,sizeof(jshort),sizeof(jshort)*2,(jshort*)raw.imgdata.thumbnail.twidth);
raw.recycle();
return js;
}
示例12: process_once
int process_once(LibRaw& RawProcessor, int half_mode, int camera_wb, int auto_wb, int suffix, int user_flip,char *fname)
{
char outfn[1024];
RawProcessor.imgdata.params.half_size = half_mode;
RawProcessor.imgdata.params.use_camera_wb = camera_wb;
RawProcessor.imgdata.params.use_auto_wb = auto_wb;
RawProcessor.imgdata.params.user_flip = user_flip;
int ret = RawProcessor.dcraw_process();
if(LIBRAW_SUCCESS !=ret)
{
fprintf(stderr,"Cannot do postpocessing on %s: %s\n",
fname,libraw_strerror(ret));
return ret;
}
snprintf(outfn,sizeof(outfn),"%s.%d.%s", fname, suffix, (RawProcessor.imgdata.idata.colors>1?"ppm":"pgm"));
printf("Writing file %s\n",outfn);
if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_ppm_tiff_writer(outfn)))
fprintf(stderr,"Cannot write %s: %s\n",outfn,libraw_strerror(ret));
return ret;
}
示例13: Java_com_androsz_andslr_LibRaw_unpackThumbnailBytesToFit
extern "C" JNIEXPORT jbyteArray JNICALL Java_com_androsz_andslr_LibRaw_unpackThumbnailBytesToFit(JNIEnv * env, jobject obj, jstring jfilename, jshort height, jshort width)
{
LibRaw raw;
jboolean bIsCopy;
const char* strFilename = (env)->GetStringUTFChars(jfilename , &bIsCopy);
// Open the file and read the metadata
raw.open_file(strFilename);
(env)->ReleaseStringUTFChars(jfilename, strFilename);// release jstring
// Let us unpack the image
raw.unpack_thumb();
jsize length = raw.imgdata.thumbnail.tlength;
jbyteArray jb = (env)->NewByteArray(length);
env->SetByteArrayRegion(jb,0,length,(jbyte *)raw.imgdata.thumbnail.thumb);
// Finally, let us free the image processor for work with the next image
raw.recycle();
return jb;
}
示例14: Datastream
bool RawIOHandlerPrivate::load(QIODevice *device)
{
if (device == 0) return false;
if (raw != 0) return true;
stream = new Datastream(device);
raw = new LibRaw;
if (raw->open_datastream(stream) != LIBRAW_SUCCESS) {
delete raw;
raw = 0;
delete stream;
stream = 0;
return false;
}
defaultSize = QSize(raw->imgdata.sizes.width,
raw->imgdata.sizes.height);
if (raw->imgdata.sizes.flip == 5 || raw->imgdata.sizes.flip == 6) {
defaultSize.transpose();
}
return true;
}
示例15: libraw_open_file_ex
int libraw_open_file_ex(libraw_data_t* lr, const char *file,INT64 sz)
{
if(!lr) return EINVAL;
LibRaw *ip = (LibRaw*) lr->parent_class;
return ip->open_file(file,sz);
}