I am working with another developer in creating a revised version of a popular astronomical application for analysing starlight.
Many users of the software use a variety of DSLR cameras to capture their scientific star images.
The key requirement, other than being able to handle a wide range of DSLR cameras, is that the data from the camera sensor MUST NOT have ANY processing done. We must only get the unaltered signal from each pixel without any processing of any kind (except what some DSLR cameras do themselves :)). Our software handles all processing of the RAW data.
Whilst our program is written in VB.NET, as I cannot program in C or C++, I have been able to create the various data structures outlined in the libraw doco.
I have been able to use the .NET to access the various exposed functions in the Libraw.dll (I am using libraw_versionNumber = 5122).
I have read the doco and Forums extensively to gain a level of understanding - not yet complete by any means.
In essence, my calls are as follows:
A call to 'libraw_init'
A call to 'libraw_open_file', passing to it the pointer gained from 'libraw_init'
A call to 'libraw_unpack', passing to it the pointer gained from 'libraw_init'
In VB.NET, I am then able to tranfer the unmanaged data from pointer 'libraw_data_t' to data structures I have created in VB.NET which follow the libraw doco.
I can see all sorts of data in the various structures in my VB.NET code, such as:--
progress_flags
process_warnings
libraw_iparams_t
libraw_image_sizes_t
libraw_lensinfo_t
libraw_makernotes_t
libraw_colordata_t
libraw_imgother_t
libraw_thumbnail_t
libraw_rawdata_t
In structure 'libraw_rawdata_t', the various pointers refer to memory areas holding data from executing unpack(). Am I correct? If not correct, what are the pointers to the memory areas that contain the RAW sensor data?
My question is this: If I am correct, what are the datatypes used for the various memory areas? I have not been able to get the data from 'libraw_rawdata_t', using any of the pointers contained within 'libraw_rawdata_t'. This may well be a VB.NET issue, but to solve it, I need to understand the datatypes that the 'libraw_rawdata_t' pointers are pointing to.
Many thanks for taking Dave's code and improving and continuing to support Libraw.
libraw_rawdata_t is described
libraw_rawdata_t is described in documentation: https://www.libraw.org/docs/API-datastruct-eng.html#libraw_rawdata_t
samples/unprocessed_raw.cpp code sample shows how to use imgdata.rawdata.raw_image array (other cases: 3/4 color images, float images are not covered by this sample)
Sorry, know nothing about VB.NET, so I don't know what your problems might be
-- Alex Tutubalin @LibRaw LLC
Is RAW data in one of the data structures previously listed
Thanks. However, I don't believe I can create an instance in VB.NET of imgdata to be able to access the raw_image array
I can access the various data structures in VB.NET, as listed previously.
Does one of the data structures contain the RAW values from the sensor pixels?
SteveR
Dear SteveR:
Dear SteveR:
Quoting from datastructures API (https://www.libraw.org/docs/API-datastruct-eng.html#libraw_rawdata_t already quoted above):
unsigned short *raw_image;
Pointer to buffer with one-component (bayer) data.
Have you looked at the source code of the unprocessed_raw.cpp (also quoted above)?
-- Alex Tutubalin @LibRaw LLC
Thank you for confirmation
Thanks. This gives me the confidence that I am looking at the correct data structure.
I have looked at unprocessed_raw.cpp, but it is slow going for me, not being a C or C++ developer, but I will keep at it.
I now have the confidence that I should be able to solve my issue in VB.NET.
Will keep you posted.
SteveR
SteveR
Pointer "raw_image" is 0
Hi Lexa
I have made some progress in VB.NET to get camera sensor data from "libraw.dll".
For example, I see image size data but all values in "libraw_rawdata_t" are 0 or Nothing, including pointer "raw_image". So therefore I don't see any pixel data.
Recall that I am only executing "libraw_init" , "libraw_open_file" and "libraw_unpack" as I only want to get the raw unprocessed data from the camera sensor.
I am not asking about how to use VB.NET, but whether I have included all typedefs from libraw_types.h.
I have created in VB.NET all the data structures that are defined in "libraw_data_t" (from "libraw_types.h").
I have also included all nested data structures that are referenced by those data structures in "libraw_data_t".
My question is: Are there any other data structures that I have to include from other C or C++ files to get the raw unprocessed data from the camera sensor? For example, in "unprocessed_raw.cpp", will I need to include data structures defined in "#include "libraw/libraw.h"?
SteveR
Sorry, know nothing about VB
Sorry, know nothing about VB.NET
In C/C++ libraw/libraw.h is enough, all needed files will be included automatically via #include directives in libraw.h
-- Alex Tutubalin @LibRaw LLC
Hi Steve, I had the same
Hi Steve, I had the same requirements for colorimetry applications and ended up writing a C++/CLI wrapper for libraw some time ago (i.e. direct API rather than PInvoke). Look for the LibRawWrapper NuGet package, should be usable in VB.NET, with imgdata.rawdata accessible via LibRawProcessor.RawData.
Thanks jantheman
Thanks jantheman. I will contact you outside this forum.
Regards
SteveR