Obviously my cleaning wasn't good, i ran the unprocessed_raw with a raw image file of 11.2MB and the result was a .tiff file with 18.4MB, so i have check my code. Here is the small routine (without validations) that i did:
---
int main(int i, char *rawimg[])
{
// Initialization
LibRaw RawProcessor;
RawProcessor.imgdata.params.document_mode = 2;
RawProcessor.imgdata.params.output_bps = 16;
RawProcessor.imgdata.params.output_tiff = 1;
RawProcessor.imgdata.params.user_flip = 0;
RawProcessor.imgdata.params.no_auto_bright = 1;
RawProcessor.imgdata.params.filtering_mode = (LibRaw_filtering)(LIBRAW_FILTERING_DEFAULT);
// Opening file and unpack
int tmpimg;
i = 1;
tmpimg = RawProcessor.open_file(rawimg[i]);
tmpimg = RawProcessor.unpack();
// extracting raw image data
int row, col;
char rawfn[1024];
for(row=0;row<RawProcessor.imgdata.sizes.iheight;row++)
for(col=0;col<RawProcessor.imgdata.sizes.iwidth;col++)
RawProcessor.imgdata.image[row*RawProcessor.imgdata.sizes.iwidth+col][0]=
RawProcessor.imgdata.image[row*RawProcessor.imgdata.sizes.iwidth+col]
[RawProcessor.COLOR(row,col)];
// formating and saving image data
snprintf(rawfn,sizeof(rawfn),"%s.tiff",rawimg[i]);
tmpimg = RawProcessor.dcraw_ppm_tiff_writer(rawfn);
// cleaning image processor
RawProcessor.recycle();
return 0;
}
---
If the unprocessed_raw extract only the raw data, without process anything, why the resultant file is bigger that the original?.
According with your suggestion, how can i do the step two (position to libraw_internal_data.unpacker_data.data_offset), and the step three (Read libraw_internal_data.unpacker_data.data_size bytes)?
For the step three, i assume can be done using a "for" structure, but if you can show a basic example code for your suggestion it will be really helpful for me, because i'm not an expert.
I took the unprocessed_raw.cpp, clean it a little bit the code and processed a 11MB image raw file, but the resultant have 55MB, so i assume that there is a post-processing when saving the file in .tiff format.
I basically want to extract the raw image data, without metadata, read it, make a little processing and then save it in a new file.
In order to do that, your suggestion looks what i need to do, but can you please give a reference code about how to implement it?. I'm not asking for an elaborate coding, only a few lines in order to follow the idea.
I'm not c++ expert, so if the question is basic or simple, i'm sorry.
32bit float data output would be very beneficial.
Export of full scene referred linear data with no clipping from 14bit chips would be great.
We hacked dcraw about a bit to reverse the scaling that's done with full highlight retention to push superbrights back in to the >1 range and export as exr.
This is what i get from g++ (a little bit long, sorry about that):
-----
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ahd_interpolateEv.omp_fn.0':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4178: undefined reference to `GOMP_loop_dynamic_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4166: undefined reference to `omp_get_thread_num'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4178: undefined reference to `GOMP_loop_dynamic_next'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4192: undefined reference to `GOMP_loop_end'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `LibRaw::ahd_interpolate()':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4166: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4166: undefined reference to `GOMP_parallel_end'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ppg_interpolateEv.omp_fn.1':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3861: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3861: undefined reference to `omp_get_thread_num'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ppg_interpolateEv.omp_fn.2':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3883: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3883: undefined reference to `omp_get_thread_num'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ppg_interpolateEv.omp_fn.3':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3897: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3897: undefined reference to `omp_get_thread_num'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `LibRaw::ppg_interpolate()':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3858: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3858: undefined reference to `GOMP_parallel_end'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3880: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3880: undefined reference to `GOMP_parallel_end'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3894: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3894: undefined reference to `GOMP_parallel_end'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15wavelet_denoiseEv.omp_fn.4':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `omp_get_thread_num'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3319: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3326: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3334: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3343: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3355: undefined reference to `GOMP_barrier'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `LibRaw::wavelet_denoise()':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `GOMP_parallel_end'
collect2: ld returned 1 exit status
-----
I don't really know why the compiler looks for this file, because is not even in the /usr/local/lib or /usr/local/include directories.
I hope this could give you relevant information in order to point me in the right direction.
Thanks for your answer and suggestion.
I'm trying to compile a .cpp file using g++ and linking libraw, but i'm getting "undefined reference" error. This is the instruction that i'm using:
can you tell me please what i am doing wrong?, at least please point me in the right direction, i know the solution must be plain simple, but i'm not really an expert and i don't see it.
Confirmed, the CFLAGS approach works. Even though its needs some manual intervention.
I hope to can make the openSUSE package using this compiler flag. Thanks for the reply.
LibRaw is specially built as static (not dynamic) library under unix systems because ABI is changed frequently and there is no way to translate ABI of one version into data layout of another one.
However, it is possible to specify CFLAGS/CXXFLAGS/LDFLAGS on ./configure call.
For many (but not all) RAW formats, you can use this trick:
1) Call LibRaw::open_file()
2) Position to libraw_internal_data.unpacker_data.data_offset
3) Read libraw_internal_data.unpacker_data.data_size bytes
This method will work with Canon CR2, Nikon NEFs and many others.
This method will not work for tiled DNGs
Hi,
According to the sample code, the option "unprocessed_raw" extracts (mostly) unaltered RAW data including masked pixels data.
Is it possible to extract ALL unprocessed raw data, without the metadata and the thumbnail in order to save it into a new binary file?, can you please point me in the right direction to do this using LibRaw?.
I have not a look into dlraw source, so my assumptions are based on your short explanation.
It looks like you have own postprocessing pipeline, different from dcraws. I guess, you may use LibRaw's as RAW reading tool (open_file() and unpack() calls), then switch to own processing pipeline.
Licensing is not a problem: LibRaw is licensed under LGPL ('upgradeable' to your GPL3), demosaic-pack-GPL2 is licensed under GPL2+ (also no problem) and AMaZE is licensed under GPL3, no problem too.
I'm unable to reproduce crash, could you please make your problematic image available somewhere via file sharing service(s) like megaupload or rapidshare?
To turn on pretty printing of code use
<code>
.... your code here
</code>
Also, to pass through antispam filter and captcha, it is better to register on this site once...
, I'll install plugin for right code display, but not today.The 'dirty trick' in unprocessed_raw.cpp is P1.colors=1; This is instruction to dump only first component for the internal tiff writer.
The result is larger than source RAW because:
Thanks for your answer.
Obviously my cleaning wasn't good, i ran the unprocessed_raw with a raw image file of 11.2MB and the result was a .tiff file with 18.4MB, so i have check my code. Here is the small routine (without validations) that i did:
---
---
If the unprocessed_raw extract only the raw data, without process anything, why the resultant file is bigger that the original?.
According with your suggestion, how can i do the step two (position to libraw_internal_data.unpacker_data.data_offset), and the step three (Read libraw_internal_data.unpacker_data.data_size bytes)?
For the step three, i assume can be done using a "for" structure, but if you can show a basic example code for your suggestion it will be really helpful for me, because i'm not an expert.
Thank you for your time and help.
If you use unchanged unprocessed_raw sample, what size has the result?
I took the unprocessed_raw.cpp, clean it a little bit the code and processed a 11MB image raw file, but the resultant have 55MB, so i assume that there is a post-processing when saving the file in .tiff format.
I basically want to extract the raw image data, without metadata, read it, make a little processing and then save it in a new file.
In order to do that, your suggestion looks what i need to do, but can you please give a reference code about how to implement it?. I'm not asking for an elaborate coding, only a few lines in order to follow the idea.
I'm not c++ expert, so if the question is basic or simple, i'm sorry.
Unfortunately, LibRaw is binary incompatible between major versions (i.e. 0.13 vs 0.12), so binary upgrade is really not possible.
Compatibility is ensured only within stable versions of one release (0.12.3 should be compatible with 0.12.99).
This is other side of active development....
This is not bug, this is feature. So, no need to fix it
LibRaw 0.12 is updated too.
The github/master version is already fixed in another way:
configure checks will set $LIBS
and Makefile.am uses $(LIBS) instead of $(LCMS_LIBS)
This is commit URL: https://github.com/LibRaw/LibRaw/commit/73229a04fb2a44159df3baa8f812b473...
Thanks for report!
The problem was in Makefile.am, the new one is pushed to GitHub/master (i.e. 0.13-alpha branch)
It is only quick fix, the problem will be solved in more general way
For float data output we need to change entire processing pipeline to floating point.
There are no such plans for LibRaw team: we're open to contributions, but will not spend much own effort on postprocessing phase.
32bit float data output would be very beneficial.
Export of full scene referred linear data with no clipping from 14bit chips would be great.
We hacked dcraw about a bit to reverse the scaling that's done with full highlight retention to push superbrights back in to the >1 range and export as exr.
I can see a need for that kind of a feature.
Thanks for your answer.
i used the -fopenmp and compiled flawlessly.
I really appreciate your help.
You have compiled LibRaw with OpenMP support, but build your application without OpenMP.
You should add -fopenmp to gcc command line when building your app or rebuild LibRaw with ./configure --disable-openmp
Hi!
Thanks for the answer.
This is what i get from g++ (a little bit long, sorry about that):
-----
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ahd_interpolateEv.omp_fn.0':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4178: undefined reference to `GOMP_loop_dynamic_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4166: undefined reference to `omp_get_thread_num'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4178: undefined reference to `GOMP_loop_dynamic_next'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4192: undefined reference to `GOMP_loop_end'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `LibRaw::ahd_interpolate()':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4166: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4166: undefined reference to `GOMP_parallel_end'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ppg_interpolateEv.omp_fn.1':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3861: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3861: undefined reference to `omp_get_thread_num'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ppg_interpolateEv.omp_fn.2':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3883: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3883: undefined reference to `omp_get_thread_num'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ppg_interpolateEv.omp_fn.3':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3897: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3897: undefined reference to `omp_get_thread_num'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `LibRaw::ppg_interpolate()':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3858: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3858: undefined reference to `GOMP_parallel_end'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3880: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3880: undefined reference to `GOMP_parallel_end'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3894: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3894: undefined reference to `GOMP_parallel_end'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15wavelet_denoiseEv.omp_fn.4':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `omp_get_thread_num'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3319: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3326: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3334: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3343: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3355: undefined reference to `GOMP_barrier'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `LibRaw::wavelet_denoise()':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `GOMP_parallel_end'
collect2: ld returned 1 exit status
-----
I don't really know why the compiler looks for this file, because is not even in the /usr/local/lib or /usr/local/include directories.
I hope this could give you relevant information in order to point me in the right direction.
Thanks in advance!.
What references are undefined?
Usually, you need math library added to linker command line (-lm switch)
Thanks for your answer and suggestion.
I'm trying to compile a .cpp file using g++ and linking libraw, but i'm getting "undefined reference" error. This is the instruction that i'm using:
g++ ext-raw-dat.cpp -o extract -I/usr/local/include/libraw -L/usr/local/lib -lraw
can you tell me please what i am doing wrong?, at least please point me in the right direction, i know the solution must be plain simple, but i'm not really an expert and i don't see it.
Thanks in advance.
Confirmed, the CFLAGS approach works. Even though its needs some manual intervention.
I hope to can make the openSUSE package using this compiler flag. Thanks for the reply.
LibRaw is specially built as static (not dynamic) library under unix systems because ABI is changed frequently and there is no way to translate ABI of one version into data layout of another one.
However, it is possible to specify CFLAGS/CXXFLAGS/LDFLAGS on ./configure call.
For many (but not all) RAW formats, you can use this trick:
1) Call LibRaw::open_file()
2) Position to libraw_internal_data.unpacker_data.data_offset
3) Read libraw_internal_data.unpacker_data.data_size bytes
This method will work with Canon CR2, Nikon NEFs and many others.
This method will not work for tiled DNGs
Hi,
According to the sample code, the option "unprocessed_raw" extracts (mostly) unaltered RAW data including masked pixels data.
Is it possible to extract ALL unprocessed raw data, without the metadata and the thumbnail in order to save it into a new binary file?, can you please point me in the right direction to do this using LibRaw?.
Thanks in advance for your kindly answer.
Thanks!
To be included into next releases!
I have not a look into dlraw source, so my assumptions are based on your short explanation.
It looks like you have own postprocessing pipeline, different from dcraws. I guess, you may use LibRaw's as RAW reading tool (open_file() and unpack() calls), then switch to own processing pipeline.
Licensing is not a problem: LibRaw is licensed under LGPL ('upgradeable' to your GPL3), demosaic-pack-GPL2 is licensed under GPL2+ (also no problem) and AMaZE is licensed under GPL3, no problem too.
Yes, DP1 images are unsupported.
I'm unable to reproduce crash, could you please make your problematic image available somewhere via file sharing service(s) like megaupload or rapidshare?
Thanks,
I'll modify distributed Makefile.mingw with possibility to build thread-safe
Pages