Recent comments

Reply to: dcraw and libraw mangles image metadata   4 years 10 months ago

not too convenient to look at tags as a flat list.

In verbose output I see PrimaryPlatform set to four zeroes in ICC profile section.
I don’t think this is a big problem (unless some real software will complain about it).

Reply to: dcraw and libraw mangles image metadata   4 years 10 months ago

Thank you for the quick response; I downloaded compiled and ran the latest github version.

I had another question; the tiff version adds a property, this one in particular looks like the malformed gps info.
[+Primary Platform : Unknown ()]
Is that a normal property value

Also properties such as gimbal pitch, yaw, roll among others are removed.

--- RAW01	2020-07-04 16:29:18.567144467 +0800
+++ TIFF01	2020-07-04 16:29:26.662419543 +0800
@@ -1,138 +1,80 @@
 ExifTool Version Number         : 11.88
-File Name                       : IMG_0999.DNG
+File Name                       : IMG_0999.DNG.tiff
 Directory                       : .
-File Size                       : 40 MB
-File Modification Date/Time     : 2020:07:04 13:48:55+08:00
-File Access Date/Time           : 2020:07:04 13:48:55+08:00
-File Inode Change Date/Time     : 2020:07:04 13:48:55+08:00
-File Permissions                : rwxr-xr-x
-File Type                       : DNG
-File Type Extension             : dng
-MIME Type                       : image/x-adobe-dng
+File Size                       : 57 MB
+File Modification Date/Time     : 2020:07:04 16:26:51+08:00
+File Access Date/Time           : 2020:07:04 16:26:51+08:00
+File Inode Change Date/Time     : 2020:07:04 16:26:51+08:00
+File Permissions                : rw-rw-r--
+File Type                       : TIFF
+File Type Extension             : tif
+MIME Type                       : image/tiff
 Exif Byte Order                 : Little-endian (Intel, II)
-Make                            : Hasselblad
-Camera Model Name               : L1D-20c
-Orientation                     : Horizontal (normal)
-Software                        : 10.00.11.04
-Modify Date                     : 2020:06:30 16:02:39
-Image Width                     : 5568
+Subfile Type                    : Full-resolution image
+Image Width                     : 5472
 Image Height                    : 3648
-Bits Per Sample                 : 16
+Bits Per Sample                 : 8 8 8
 Compression                     : Uncompressed
-Photometric Interpretation      : Color Filter Array
-Strip Offsets                   : 1041083
-Samples Per Pixel               : 1
+Photometric Interpretation      : RGB
+Image Description               : 
+Make                            : Hasselblad
+Camera Model Name               : L1D-20c
+Strip Offsets                   : 1872
+Samples Per Pixel               : 3
 Rows Per Strip                  : 3648
-Strip Byte Counts               : 40624128
+Strip Byte Counts               : 59885568
+X Resolution                    : 300
+Y Resolution                    : 300
 Planar Configuration            : Chunky
-CFA Repeat Pattern Dim          : 2 2
-CFA Pattern 2                   : 0 1 1 2
-CFA Plane Color                 : Red,Green,Blue
-CFA Layout                      : Rectangular
-Black Level Repeat Dim          : 2 2
-Black Level                     : 4096 4092 4091 4096
-White Level                     : 65535
-Default Scale                   : 1 1
-Default Crop Origin             : 4 4
-Default Crop Size               : 5464 3640
-Bayer Green Split               : 0
-Anti Alias Strength             : 1
-Best Quality Scale              : 1
-Active Area                     : 0 96 3648 5568
-Opcode List 3                   : GainMap, WarpRectilinear
-Default User Crop               : 0 0 1 1
-Subfile Type                    : Reduced-resolution image
-Preview Image Start             : 75970
-Preview Image Length            : 965113
-Y Cb Cr Coefficients            : 0.299 0.587 0.114
-Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
-Y Cb Cr Positioning             : Co-sited
-Reference Black White           : 0 255 128 255 128 255
-About                           : DJI Meta Data
-Format                          : image/dng
-Absolute Altitude               : +254.35
-Relative Altitude               : +120.20
-Gimbal Roll Degree              : +0.00
-Gimbal Yaw Degree               : +12.20
-Gimbal Pitch Degree             : -90.00
-Flight Roll Degree              : -4.90
-Flight Yaw Degree               : +8.50
-Flight Pitch Degree             : +4.50
-Cam Reverse                     : 0
-Gimbal Reverse                  : 0
-Self Data                       : DJI Self data
-Version                         : 7.0
-Has Settings                    : False
-Has Crop                        : False
-Already Applied                 : False
+Resolution Unit                 : inches
+Software                        : dcraw v9.26
+Modify Date                     : 2020:06:30 16:02:39
+Artist                          : 
 Exposure Time                   : 1/120
 F Number                        : 4.0
-Exposure Program                : Program AE
 ISO                             : 100
-Exif Version                    : 0230
-Date/Time Original              : 2020:06:30 16:02:39
-Create Date                     : 2020:06:30 16:02:39
-Exposure Compensation           : 0
-Max Aperture Value              : 2.8
-Metering Mode                   : Center-weighted average
-Light Source                    : Fluorescent
-Flash                           : No Flash
 Focal Length                    : 10.3 mm
-File Source                     : Digital Camera
-Scene Type                      : Directly photographed
-Exposure Mode                   : Auto
-White Balance                   : Auto
-Digital Zoom Ratio              : 1
-Focal Length In 35mm Format     : 28 mm
-Scene Capture Type              : Standard
-Gain Control                    : None
-Contrast                        : Normal
-Saturation                      : Normal
-Sharpness                       : Normal
-Serial Number                   : 0K8TFAA0020268
-Lens Info                       : 28mm f/2.8-11
-GPS Version ID                  : 2.3.0.0
+Profile CMM Type                : 
+Profile Version                 : 2.1.0
+Profile Class                   : Display Device Profile
+Color Space Data                : RGB
+Profile Connection Space        : XYZ
+Profile Date Time               : 0000:00:00 00:00:00
+Profile File Signature          : acsp
+Primary Platform                : Unknown ()
+CMM Flags                       : Not Embedded, Independent
+Device Manufacturer             : none
+Device Model                    : 
+Device Attributes               : Reflective, Glossy, Positive, Color
+Rendering Intent                : Perceptual
+Connection Space Illuminant     : 0.9642 1 0.82491
+Profile Creator                 : 
+Profile ID                      : 0
+Profile Copyright               : auto-generated by dcraw
+Profile Description             : sRGB gamma 2.222 toe slope 4.5
+Media White Point               : 0.95045 1 1.08905
+Media Black Point               : 0 0 0
+Red Tone Reproduction Curve     : (Binary data 14 bytes, use -b option to extract)
+Green Tone Reproduction Curve   : (Binary data 14 bytes, use -b option to extract)
+Blue Tone Reproduction Curve    : (Binary data 14 bytes, use -b option to extract)
+Red Matrix Column               : 0.43608 0.2225 0.01393
+Green Matrix Column             : 0.38509 0.71689 0.09709
+Blue Matrix Column              : 0.14305 0.06061 0.71402
+GPS Version ID                  : 2.2.0.0
 GPS Latitude Ref                : North
 GPS Longitude Ref               : East
 GPS Altitude Ref                : Above Sea Level
-DNG Version                     : 1.4.0.0
-DNG Backward Version            : 1.3.0.0
-Unique Camera Model             : Hasselblad L1D-20c
-Color Matrix 1                  : 1.2385 -0.7159 -0.0657 -0.0982 1.0352 0.0721 0.0457 0.0241 0.7437
-Color Matrix 2                  : 0.731 -0.2746 -0.0646 -0.2991 1.0847 0.2469 0.0163 0.0585 0.6324
-Analog Balance                  : 1 1 1
-As Shot Neutral                 : 0.356545961 1 0.5400843882
-Baseline Exposure               : 0
-Baseline Noise                  : 1
-Baseline Sharpness              : 1
-Linear Response Limit           : 1
-Camera Serial Number            : 0K8TFAA0020268
-Shadow Scale                    : 1
-DNG Private Data                : (Binary data 19829 bytes, use -b option to extract)
-Calibration Illuminant 1        : Standard Light A
-Calibration Illuminant 2        : D65
-Profile Name                    : Embedded
-Profile Hue Sat Map Dims        : 18 6 1
-Profile Hue Sat Map Data 1      : (Binary data 3408 bytes, use -b option to extract)
-Profile Hue Sat Map Data 2      : (Binary data 3439 bytes, use -b option to extract)
-Profile Embed Policy            : Allow Copying
-Noise Profile                   : 8.108e-05 6e-08
-Original Default Final Size     : 0 0
-Original Best Quality Size      : 0 0
-Original Default Crop Size      : 0 0
+GPS Time Stamp                  : 00:00:00
+GPS Map Datum                   : 
+GPS Date Stamp                  : 
 Aperture                        : 4.0
-CFA Pattern                     : [Red,Green][Green,Blue]
-Image Size                      : 5568x3648
-Megapixels                      : 20.3
-Preview Image                   : (Binary data 965113 bytes, use -b option to extract)
-Scale Factor To 35 mm Equivalent: 2.7
+Image Size                      : 5472x3648
+Megapixels                      : 20.0
 Shutter Speed                   : 1/120
 GPS Altitude                    : 254 m Above Sea Level
+GPS Date/Time                   :  00:00:00Z
 GPS Latitude                    : xxx
 GPS Longitude                   : xxx
-Circle Of Confusion             : 0.011 mm
-Field Of View                   : 65.5 deg
-Focal Length                    : 10.3 mm (35 mm equivalent: 28.0 mm)
+Focal Length                    : 10.3 mm
 GPS Position                    : xxx
-Hyperfocal Distance             : 2.39 m
 Light Value                     : 10.9

Should I give you a copy of this image to take a look at the fields that are removed?

Reply to: dcraw and libraw mangles image metadata   4 years 10 months ago

Followup:

was able to reproduce, fixed by this patch: https://github.com/LibRaw/LibRaw/commit/5a5b227a715c914e8fbd3ee7f97c0d76...

Reply to: dcraw and libraw mangles image metadata   4 years 10 months ago

Please provide sample RAW file(s) to play with.

Reply to: Image Sizes issue with Fuji RAF files   4 years 10 months ago

Alex,
Thanks for your help. FC(r, c) worked as expected. I believe I am all set.

Dinesh

Reply to: Image Sizes issue with Fuji RAF files   4 years 10 months ago

yes, is_fuji_rotated() could be used to identify 'rotated processing' used in LibRaw/dcraw.c

COLOR(r,c) is correct in raw-coordinates (and FC(r,c) is correct in imgdata.image[] coordinates)

Reply to: Image Sizes issue with Fuji RAF files   4 years 10 months ago

Hi Alex,
Is the API call is_fuji_rotated() the one to use to identify Super CCD sensors?

Also it looks like number of pixels in imgdata.rawdata.raw_image and number of pixels in imgdata.image seem to be consistent with raw_height/raw_width and height/width.

Dinesh

Reply to: Image Sizes issue with Fuji RAF files   4 years 10 months ago

Alex,
I think I figured it out.

For Super-CCD sensors, there is a 45 degree rotation applied to the image. So the height/width fields in sizes report the bounding box that is needed to store this rotated image i.e. if you apply a 45 degree rotation on an image with dimensions 2177 rows and 2894 cols, u will need a buffer of size 3587 x 3588 pixels to store it. It will have a bunch of black pixels around the image. So, image contains height*width*4*2 bytes.

A few follow up questions I have are:
1. Does COLOR() function work for these types of images? Because for this specific image, cdesc is "RGBG" and COLOR(0, 0), COLOR(0, 1), COLOR(1, 0) and COLOR(1, 1) are 0, 2, 1, 3 respectively which results in a "RBGG" Bayer Pattern but I don't think that is correct because these are not really Bayer images?

2. Which fields/props in imgdata do I use to detect these kinds of files such that i can update my copying code suitably? The call to raw2image is not needed for typical Bayer or X-Trans sensors. You can copy from raw_image or color3_image etc.

Appreciate your help.

Reply to: Image Sizes issue with Fuji RAF files   4 years 10 months ago

imgdata.image buffer is NOT equal to iheight*iwidth*2

Reply to: Image Sizes issue with Fuji RAF files   4 years 10 months ago

So raw2image() works the same way for these files i.e. only one of the 4 channels will have a valid value and this will correspond to COLOR(r, c).

Is the size of the buffer (n bytes) allocated after raw2image() equal iheight*iwidth*2? This info is necessary for me to allocate the suitable output buffer in my code.

Reply to: Image Sizes issue with Fuji RAF files   4 years 10 months ago

I think it will be faster and more productive to try raw2image() than discuss this here.

Reply to: Image Sizes issue with Fuji RAF files   4 years 10 months ago

Alex,
This API call appears to only impact the output width/height. Do we treat this to be the visible dimensions (height/width) to just extract the visible portion of the RAW data?

Does this mean the COLOR(r, c) does not work for these formats?

To reiterate, what I am trying to do is extract the Visible Portion of the RAW Image and implement the pipeline myself? Will calling raw2image() on this image only give me the visible portion of the CFA? If so, what dimensions should I assume the resulting buffer has

So, is there a way to identify if the file is from a Super-CCD sensor such that I can branch my code to handle it separately.

Dinesh

Reply to: Image Sizes issue with Fuji RAF files   4 years 10 months ago

Alex,
Thanks for that. I will read up on Fuji Super CCD images and go over the dcraw code.

Does that mean that some of the properties in the sizes field such as width, height are incorrect/invalid for these files? I was just trying to just read out the visible part of the raw image for me to apply my own camera pipeline.

Also, how do I identify if a file has Super-CCD sensor?

Reply to: Image Sizes issue with Fuji RAF files   4 years 10 months ago

This is the way how Fuji Super-CCD files are processed (this method borrowed from dcraw.c):
- raw data is not 2:3 but stretched in one dimension (different for different cameras)
- color order is not rg/gb, but green columns and r/b columns

On processing:
- entire image is rotated 45 deg to get normal bayer pattern with diagonal greens (it is also unstretched to get 2:3 aspect ratio)
- standard debayering is used
- output rotated back and cropped

Reply to: Questions about color matrices in colordata   4 years 10 months ago

Matrix conversion is not gamut limited (unless you cut negative values in some intermediate steps)

ccm is 'camera matrix parsed from metadata. period', it is preserved as is (w/ possible value normalization). Usually it 'just some color data with not known camera/vendor specific meaning'.

Reply to: Questions about color matrices in colordata   4 years 10 months ago

That makes perfect sense. So, the matrix to convert from camera space to XYZ becomes xyz_rgb*rgb_cam. Does that impact the gamut of colors that can be represented as Camera Space -> sRGB is a narrowing conversion?

But, what exactly is ccm? I know in your earlier comment you mentioned

"ccm is also 'camera color matrix' retireved from RAW in 'as is' (excl. normalizing) form."

but could you provide more details?

Thanks,
Dinesh

Reply to: Questions about color matrices in colordata   4 years 10 months ago

ccm is not similar to cmatrix.

To convert to XYZ use cmatrix or rgb_cam, multiplied by srgb2xyz conversion matrix, see convert_to_rgb() source for details.

Reply to: Questions about color matrices in colordata   4 years 10 months ago

Alex,
A quick follow up. So based on your descriptions, cmatrix is the transformation from Camera Space to sRGB.

Is ccm similar to cam_xyz i.e. transformation between Camera Space and XYZ?

I have a DNG file shot from a Google Pixel 3 that has all-zeros for cam_xyz and ccm. The rgb_cam and cmatrix have the same values. The profile is also not available.

For such files, how do I convert from input space/camera space to XYZ?

Reply to: Fuji X-Trans sensor Layout   4 years 10 months ago

I'm not sure, that margins are also multiple of 6 in 0.19. Extra effort is needed to analyze (source inspection, may be debugger session), so I won’t do it,

If not, xtrans[][] is for visible area, xtrans_abs[][] is for entire sensor (make sure you use LibRaw-provided margins).

0 is 'channel #0', 1 is 'channel #1', etc. Index to name mapping is in imgdata.idata.cdesc[] string.

Reply to: Fuji X-Trans sensor Layout   4 years 10 months ago

Alex,
Thanks for the clarification. I am currently on 0.19.5 and so wanted to know if the information about margins still holds.

Also, is my understanding of what xtrans represents i.e. 0 -> R, 1 -> G, 2->B correct?

Reply to: Fuji X-Trans sensor Layout   4 years 10 months ago

LibRaw provided margins (left_margin, top_margin) are multiple of 6 (at least in 0.20 beta and in latest snapshots), so xtrans and xtrans_abs are the same.

Reply to: Question for LibRaw installation   4 years 10 months ago

I have had trouble with this for years
Not there
Not where if is suppose to be
Permission problems
Different versions

In the end it is so much easier to use a different compile
Like mingw

Reply to: Accessing Raw Bayer data   4 years 10 months ago

I think that matching pixel by exact values will not work well due to value differences (because of noise, for example).

Reply to: Accessing Raw Bayer data   4 years 10 months ago

Thanks for the quick reply. Then I think I will need to do heavy processing for useful data.
Can I ask your opinion on this matter:
-I am currently working on "image matching with stereo camera". I am looking for away to match the same pixel between left image and right image.
-With the 8 bit data in jpg, sometimes the matching will not be so correct, for example: (pixel of 112.02 will become 112) and (pixel of 111.8 will also become 112). Therefore, they might be considered as a match but it is not true.
Do you think by taking the raw data for processing I can get better matching result? or Raw data are just too noisy for the matching task?
Thanks

Pages