Recent comments

Reply to: libraw to lipjpeg   4 years 5 months ago

Thank you very much for your help! I feel like I am close, but I am still getting an exception at
write_JPEG_file(outfn, 10);

This is the same function as in libjpeg-turbo example. (https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/example.txt)

Do you see any glaring errors? Thanks a lot in advance!

int main(int ac, char* av[])
{
int ret;
char outfn[1024];

LibRaw RawProcessor;

_putenv((char*)"TZ=UTC"); // dcraw compatibility, affects TIFF datestamp field

#define P1 RawProcessor.imgdata.idata
#define S RawProcessor.imgdata.sizes
#define C RawProcessor.imgdata.color
#define T RawProcessor.imgdata.thumbnail
#define P2 RawProcessor.imgdata.other
#define OUT RawProcessor.imgdata.params

OUT.output_bps = 8;

if ((ret = RawProcessor.open_file(av[1])) != LIBRAW_SUCCESS)
return 1;

if ((ret = RawProcessor.unpack()) != LIBRAW_SUCCESS)
return 1;

ret = RawProcessor.dcraw_process();
if (LIBRAW_SUCCESS != ret)
if (LIBRAW_FATAL_ERROR(ret))
return 1;

libraw_processed_image_t* image = RawProcessor.dcraw_make_mem_image(&ret);
if (LIBRAW_SUCCESS != ret)
if (LIBRAW_FATAL_ERROR(ret))
return 1;

_snprintf_s(outfn, sizeof(outfn), "%s.jpeg", av[1]);

image_height = image->height;
image_width = image->width;
image_buffer = (JSAMPLE*)image->data;
write_JPEG_file(outfn, 10);

LibRaw::dcraw_clear_mem(image);
RawProcessor.recycle(); // just for show this call

return 0;
}

Reply to: Brightness adjustment leads to oversaturation   4 years 5 months ago

imgdata.params.bright options affects only output (gamma) curve that used on (internal) linear data -> gamma corrected output. Is is very similar to Photoshop curve tool w/ linear curve that starts at 0,0 and ends, for example, at 100,255 (source, dest)

To adjust exposure one may use exp_correc/exp_shift/exp_preserve parameters.

Reply to: libraw to lipjpeg   4 years 5 months ago
use

use
libraw_processed_image_t *image = RawProcessor.dcraw_make_mem_image(&ret);
to make 3-channel RGB image (output_bps should be set to 8 for JPEG)

and
LibRaw::dcraw_clear_mem(image);
to clean (deallocate) libraw_processed_image_t after JPEG creation is done.

Reply to: No tiff/ppm C API setter   4 years 5 months ago

Sorry, there is no way to provide getters for all points in LibRaw that may be need by user (user's code)
(and, also, maintain this when LibRaw internals get changed).

C-wrappers are trivial, you may implement your own via banal copy/paste/change accessed field name.

Reply to: No tiff/ppm C API setter   4 years 5 months ago

Alex,
I don't know how to program in C or C++. I rely on being able to access LibRaw using either the C getters/putters or an executable. Accessing the libraw_rawdata_t structure is not available via the C getters/putters.

Peter

Reply to: No tiff/ppm C API setter   4 years 5 months ago

It looks like your problem is different from 'no way to set output_tiff=1 via C-API':
- LibRaw internals are different from dcraw's while we keep some compatibility via dcraw_emu sample
- in particular, there is no document_mode (-d/-D options in dcraw), because unaltered raw data is already accessible via https://www.libraw.org/docs/API-datastruct.html#libraw_rawdata_t

So, it looks like you need to implement direct access to this data from your app (I'm not sure you need intermediate TIFF storage because data is already here).

Reply to: No tiff/ppm C API setter   4 years 5 months ago

Alex,
I should have explained that I program in a language call LabVIEW. It has very limited ability to interact with LibRaw. The only method available is to use calls to the dll which is why I am trying to use the C setter/getters. If I could determine the pointer to the libraw_output_params_t structure I might be able to write to the structure but I see a long road ahead of me if I go down that road.

I need access to the RAW RGGB data for my astronomy image calibration application which I had based on
"DCRAW -v -D -4 -T filename" and am now trying to migrate to LibRaw. I suspect the quickest way for me to proceed is to use the example 4channels.exe. Do you agree or it there another way to proceed?

Reply to: No tiff/ppm C API setter   4 years 5 months ago

Unless you want to survive ABI change (e.g. libraw.dll/.so upgrade to very different version), you do not need setter.
Look into half_mt.c sample how to set fields in params w/o setter.

Reply to: alteration of RAW files   4 years 5 months ago

Yes I know: I wrote “understand” instead of “guess”, because I was trying to fix the thing in one time, instead of by instalments . Then:
I’ve read that a raw file stores exposition (E) values linearly, and that a GAMMA function can be applied to them during raw conversion in order to increase the range of pixel values in the lower zones of exposition. This last result can be achieved if E values have not yet been rounded to nearest integers, otherwise the GAMMA application adds no information about these zones. As a first step, could you tell whether or not you agree on this point?

Reply to: alteration of RAW files   4 years 5 months ago

my reply says nothing about gamma

Reply to: alteration of RAW files   4 years 5 months ago

Many thanks. From your answer, I understand that a camera applies the “GAMMA” function (with gamma 2.2, I suppose) to the inside-registered exposure values and converts them to integer numbers. No common user of a common digital camera can access the original exposure values in order to apply a different gamma and enhance the number of pixel levels in a low-exposure zone. Is this right? And does it also apply to any user, and any camera?

Reply to: alteration of RAW files   4 years 5 months ago

All out-of-camera RAW files are 'integer', not continuous

Reply to: GoPro sdk with latest Adobe dng SDK   4 years 5 months ago

Thank you for detailed explanation, we'll add cmake/gpr related section to readme.gopro.

Note: register keyword results into warning, not error on c++11

Reply to: GoPro sdk with latest Adobe dng SDK   4 years 5 months ago

I managed to build gpr and libraw against Adobe's stock dng sdk v1.5. It seems to work. In case someone else needs this:

I: Build gopro/gpr:

1. replace gopro's toplevel CMakeLists.txt with this one (this builds only a subset of the libraries):
------------------------------------
# minimum required cmake version
cmake_minimum_required( VERSION 3.5 FATAL_ERROR )

set(CMAKE_SUPPRESS_REGENERATION true)
set(CMAKE_C_FLAGS "-std=c99")

# project name
project( gpr )

option(DNGINCLUDEDIR "Adobe DNG toolkit include directory")
INCLUDE_DIRECTORIES( ${DNGINCLUDEDIR} )

# DNG toolkit requires C++11 minimum:
set_property(GLOBAL PROPERTY CXX_STANDARD 17)

# add needed subdirectories
add_subdirectory( "source/lib/common" )
add_subdirectory( "source/lib/vc5_common" )
add_subdirectory( "source/lib/vc5_decoder" )
add_subdirectory( "source/lib/gpr_sdk" )

set_property(TARGET gpr_sdk PROPERTY CXX_STANDARD 17)

IF (WIN32)
TARGET_COMPILE_DEFINITIONS( gpr_sdk PUBLIC -DqWinOS=1 -DqMacOS=0 -DqLinux=0)
ELSEIF (APPLE)
TARGET_COMPILE_DEFINITIONS( gpr_sdk PUBLIC -DqWinOS=0 -DqMacOS=1 -DqLinux=0)
ELSE()
TARGET_COMPILE_DEFINITIONS( gpr_sdk PUBLIC -DqWinOS=0 -DqMacOS=0 -DqLinux=1)
ENDIF()
----------------------------------------

2. apply the two patches of README.GoPro.txt section II b.
the patch of section IIa is not needed with libdng1.5.

3. delete these two files:
/source/lib/gpr_sdk/private/gpr.cpp
/source/lib/gpr_sdk/private/gpr_image_writer.cpp

4. run CMAKE with -DDNGINCLUDEDIR, pointing to the headers from Adobe dng 1.5.

5. build. You get 4 libraries "gpr_sdk", "vc5_common", "vc5_decoder", "common", the rest is ignored.

II build libraw:
1. pass the following to ./configure:
CXXFLAGS="-stdlib=libc++ -std=c++17" CPPFLAGS="-DUSE_DNGSDK -DUSE_GPRSDK"
(and also add -I... for the header paths of the dng library and gopro's headers)

2. remove the 'register' keyword from these files:
src/utils/phaseone_processing.cpp
src/x3f/x3f_parse_process.cpp

Or probably -std=c++11 should work as well. dng1.5 seems to require c++11 at least.

Reply to: compile latest code   4 years 5 months ago

ok it all works but I had to use a different mingw compiler to get it all working
and even though it worked fine on the samples - my code which is based on the
samples was a bit fussy
I recommend using the latest compiler if on windows 10

Reply to: GoPro sdk with latest Adobe dng SDK   4 years 5 months ago

Thanks, that clarifies things. I'll give it a try.

Reply to: GoPro sdk with latest Adobe dng SDK   4 years 5 months ago

BTW, you may not include gpr_sdk/private/gpr.cpp in your gpr_sdk build, LibRaw do not use this high level interface.

(looks like we need to update GPR readme)

Reply to: GoPro sdk with latest Adobe dng SDK   4 years 5 months ago

Sorry, we still use Adobe DNG SDK v1.4

Reply to: CR3 support   4 years 5 months ago

We are integrating it now.

Reply to: CR3 support   4 years 5 months ago
Reply to: compile latest code   4 years 5 months ago

I've checked this commit (using Qt Creator/libraw.pro build file).

OK, it looks like that relying that MinGW does not defines WIN32, but defines _WIN32 only is not correct. This assumption is fixed in this commit: https://github.com/LibRaw/LibRaw/commit/0ebd8a4e1846a3d265f823ac9b2f52ed...

(just use git pull to updated from github).

Checked w/ MinGW-W64/7.30, I do not see any problems

Reply to: compile latest code   4 years 5 months ago

I ran in to a syntax error at #endif /* _LIBRAW_CLASS_H */

This may not be the correct endif (the compiler says there is an extra ( or maybe an extra if

I think I have not repaired this correctly as my fix then causes a bunch of errors
in libraw_c_api.cpp

If I knew what I was doing this would be an easy fix

Pages