Recent comments

Reply to: libraw to lipjpeg   5 years 3 days ago

Thanks a lot for your support! This works. Somehow my code didn't work with release-DLL version, VCRT kept giving errors. However, it works nice with static lib or debug build. Go figure! :)

Again, thanks for your help. It gave me the assurance that I was on the right path.

Reply to: Uninstall LibRaw on Linux   5 years 3 days ago

I got it solved by myself:

I had the libraw-package of my distribution installed and g++ seams to find the files first, where the package-manager has put them. Deinstalling the package resolved the error. Everything works as expected now.

Reply to: libraw to lipjpeg   5 years 3 days ago

I could not see what exceptions you get.
This snippet, created from your code (removed _putenv, _snprintf_s replaced w/ simple sprintf) compiles and converts single ARW file to jpeg: https://www.dropbox.com/s/1lq7npmuip2xne5/raw2jpeg.zip?dl=0

example.txt cut to write function only (JPEG read complains about put_scanline_someplace, so entire JPEG reading code removed).

Needed #includes added to example.txt and main (stdlib.h)

Compiled/tested under FreeBSD (under Linux is should be the same) using this command line:
clang -I/usr/local/include -I../LibRaw -o raw2jpeg main.cpp example.cpp -L/usr/local/lib -ljpeg -L../LibRaw/lib -lraw -lcxxrt

libjpeg-turbo 2.0.2 is installed in /usr/local
LibRaw is compiled in ../LibRaw

Reply to: libraw to lipjpeg   5 years 4 days ago

It looks like it is simpler to implement it for one time in one of libraw samples: https://github.com/LibRaw/LibRaw/commit/52b7066b3ed285ed84c20a2442c59331...

Reply to: libraw to lipjpeg   5 years 4 days 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   5 years 5 days 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   5 years 5 days 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   5 years 6 days 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   5 years 6 days 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   5 years 1 week 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   5 years 1 week 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   5 years 1 week 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   5 years 1 week 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   5 years 1 week ago

my reply says nothing about gamma

Reply to: alteration of RAW files   5 years 1 week 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   5 years 1 week ago

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

Reply to: GoPro sdk with latest Adobe dng SDK   5 years 1 week 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   5 years 1 week 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   5 years 2 weeks 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   5 years 2 weeks ago

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

Reply to: GoPro sdk with latest Adobe dng SDK   5 years 2 weeks 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   5 years 2 weeks ago

Sorry, we still use Adobe DNG SDK v1.4

Reply to: CR3 support   5 years 2 weeks ago

We are integrating it now.

Pages