Recent comments

Reply to: Usage Examples   14 years 6 months ago

Please describe, what kind of data do you want:

- compressed (as in file)
- or unpacked ?

If you wand 'file' data (compressed by lossless jpeg or so), you need to position to data offset and read the data manually (and unpack them)

If you want unpacked data (huffman decoded or so), just use unprocessed_raw sample as your base.

Reply to: Usage Examples   14 years 6 months ago

Thanks for the "dirty trick" info.
I will add the P1.colors=1 to my code and try again.

About your first suggestion, you mention three steps:
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

So i try to code you suggestion:

int main(int i, char *img[])
{
  i=1;
  int tempimg, row, col;
 
// step one: Open file
  LibRaw RawProcessor;
  tempimg = RawProcessor.open_file(img[i]);
#define RAW RawProcessor.libraw_internal_data.unpacker_data
 
// step two: positioning libraw_internal_data.unpacker_data.data_offset
  tmpimg = RawProcessor.unpack();
 
/* how to position it in data.offset?... */
 
// step three: Read libraw_internal_data.unpacker_data.data_size
  for(row=0;row<RAW.data_size.iheight;row++)
    for(col=0;col<RAW.data_size.iwidth;col++)
      RAW[row*RAW.data_size.iwidth+col][0] = RAW[row*RAW.data_size.iwidth+col][RawProcessor.COLOR(row,col)];
 
// mode coding, not finished yet...
 
  RawProcessor.recycle();
  return 0;
}

Am i in the right direction or i'm completely lost?...

Really appreciate any comments you can give me.

Reply to: Shared library   14 years 6 months ago

That's fine, I understand that when the API/ABI changes this isn't so simple. But that doesn't mean each version can't be a shared library (i.e. libraw.so). That way if a user upgrades from 0.12.2 to 0.12.3, they get all the benefits of bug fixes without having to recompile all the software that uses libraw.

Reply to: Usage Examples   14 years 6 months ago

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...

Reply to: Usage Examples   14 years 6 months ago
Sorry for bad formatting, 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:

  • The source RAW is compressed, while resulting .tiff is uncompressed
  • The source RAW has 12 or 14 (or, may be, 10) bits per pixel, while resulting .tiff is stored in 16-bit per pixel format.
Reply to: Usage Examples   14 years 6 months ago

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:
---

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.

Thank you for your time and help.

Reply to: Usage Examples   14 years 6 months ago

If you use unchanged unprocessed_raw sample, what size has the result?

Reply to: Usage Examples   14 years 6 months ago

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.

Reply to: Shared library   14 years 6 months ago

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....

Reply to: [patch] fix dcraw emulation binary   14 years 6 months ago

This is not bug, this is feature. So, no need to fix it

Reply to: [patch] fix build with lcms2   14 years 6 months ago

LibRaw 0.12 is updated too.

Reply to: [patch] fix build with lcms2   14 years 6 months ago

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...

Reply to: link order   14 years 6 months ago

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

Reply to: About LibRaw   14 years 6 months ago

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.

Reply to: About LibRaw   14 years 6 months ago

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.

Reply to: Usage Examples   14 years 6 months ago

Thanks for your answer.
i used the -fopenmp and compiled flawlessly.

I really appreciate your help.

Reply to: Usage Examples   14 years 6 months ago

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

Reply to: Usage Examples   14 years 6 months ago

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!.

Reply to: Usage Examples   14 years 6 months ago

What references are undefined?

Usually, you need math library added to linker command line (-lm switch)

Reply to: Usage Examples   14 years 6 months ago

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.

Reply to: libraw in a DSO plug-in   14 years 7 months ago

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.

Reply to: libraw in a DSO plug-in   14 years 7 months ago

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.

Reply to: Usage Examples   14 years 7 months ago

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

Reply to: Usage Examples   14 years 7 months ago

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.

Reply to: [patch] pkg-config fixes   14 years 7 months ago

Thanks!

To be included into next releases!

Pages