Recent comments

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

There is no such program in LibRaw 'sample code' programs.

One could implement such program using LibRaw or Adobe DNG sdk for raw (dng) decode and something like libtiff for tiff write.

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

Apologies for the long response.

Do you have a program that can just convert the dng file to tiff without changing any of the dng's exif metadata?

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

Sorry, missed these notices because of *very long* reply:

>> Also properties such as gimbal pitch, yaw, roll among others are removed.
>>Should I give you a copy of this image to take a look at the fields that are removed?

LibRaw::write_tiff_ppm() used in dcraw_emu creates very minimal set of EXIF tags.
There is no plans to extend this.

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

I just downloaded the sample image and the exif file; I ran the test and still get the same errors when I try to load the .tiff file.

I ran a exiftool -v and there were some warnings

[Warning = ValueConv GPSTimeStamp: Argument "undef" isn't numeric in addition (+)]

  ExifToolVersion = 11.88
  FileName = DJI_0325.tiff
  Directory = images
  FileSize = 59887440
  FileModifyDate = 1593857589
  FileAccessDate = 1593857589
  FileInodeChangeDate = 1593857595
  FilePermissions = 33204
  FileType = TIFF
  FileTypeExtension = TIF
  MIMEType = image/tiff
  ExifByteOrder = II
  + [IFD0 directory with 23 entries]
  | 0)  SubfileType = 0
  | 1)  ImageWidth = 5472
  | 2)  ImageHeight = 3648
  | 3)  BitsPerSample = 8 8 8
  | 4)  Compression = 1
  | 5)  PhotometricInterpretation = 2
  | 6)  ImageDescription = 
  | 7)  Make = Hasselblad
  | 8)  Model = L1D-20c
  | 9)  StripOffsets = 1872
  | 10) SamplesPerPixel = 3
  | 11) RowsPerStrip = 3648
  | 12) StripByteCounts = 59885568
  | 13) XResolution = 300 (300/1)
  | 14) YResolution = 300 (300/1)
  | 15) PlanarConfiguration = 1
  | 16) ResolutionUnit = 2
  | 17) Software = dcraw v9.26
  | 18) ModifyDate = 2020:02:15 14:41:53
  | 19) Artist = 
  | 20) ExifOffset (SubDirectory) -->
  | + [ExifIFD directory with 4 entries]
  | | 0)  ExposureTime = 0.005 (5000/1000000)
  | | 1)  FNumber = 5 (5000000/1000000)
  | | 2)  ISO = 100
  | | 3)  FocalLength = 10.26 (10260000/1000000)
  | 21) ICC_Profile (SubDirectory) -->
  | + [ICC_Profile directory with 10 entries, 496 bytes]
  | | ProfileHeader (SubDirectory) -->
  | | + [BinaryData directory, 128 bytes]
  | | | ProfileCMMType = 
  | | | ProfileVersion = 528
  | | | ProfileClass = mntr
  | | | ColorSpaceData = RGB 
  | | | ProfileConnectionSpace = XYZ 
  | | | ProfileDateTime = 0 0 0 0 0 0
  | | | ProfileFileSignature = acsp
  | | | PrimaryPlatform = 
  | | | CMMFlags = 0
  | | | DeviceManufacturer = none
  | | | DeviceModel = 
  | | | DeviceAttributes = 0 0
  | | | RenderingIntent = 0
  | | | ConnectionSpaceIlluminant = 0.9642 1 0.82491
  | | | ProfileCreator = 
  | | | ProfileID = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  | | 0)  ProfileCopyright = auto-generated by dcraw
  | | 1)  ProfileDescription = sRGB gamma 2.222 toe slope 4.5
  | | 2)  MediaWhitePoint = 0.95045 1 1.08905
  | | 3)  MediaBlackPoint = 0 0 0
  | | 4)  RedTRC = curv...
  | | 5)  GreenTRC = curv...
  | | 6)  BlueTRC = curv...
  | | 7)  RedMatrixColumn = 0.43608 0.2225 0.01393
  | | 8)  GreenMatrixColumn = 0.38509 0.71689 0.09709
  | | 9)  BlueMatrixColumn = 0.14305 0.06061 0.71402
  | 22) GPSInfo (SubDirectory) -->
  | + [GPS directory with 10 entries]
  | | 0)  GPSVersionID = 2 2 0 0
  | | 1)  GPSLatitudeRef = N
  | | 2)  GPSLatitude = xxx
  | | 3)  GPSLongitudeRef = E
  | | 4)  GPSLongitude = xxx
  | | 5)  GPSAltitudeRef = 0
  | | 6)  GPSAltitude = 500 (500/1)
  | | 7)  GPSTimeStamp = undef undef undef (0/0 0/0 0/0)
  | | 8)  GPSMapDatum = 
  | | 9)  GPSDateStamp = 
  Warning = ValueConv GPSTimeStamp: Argument "undef" isn't numeric in addition (+)
  Warning = ValueConv GPSTimeStamp: Argument "undef" isn't numeric in addition (+)

There's no such errors in the raw file

  ExifToolVersion = 11.88
  FileName = DJI_0325.DNG
  Directory = /home/blubee/PICTURES
  FileSize = 41454818
  FileModifyDate = 1581748912
  FileAccessDate = 1581757918
  FileInodeChangeDate = 1581757918
  FilePermissions = 33279
  FileType = DNG
  FileTypeExtension = DNG
  MIMEType = image/x-adobe-dng
  ExifByteOrder = II
  + [IFD0 directory with 43 entries]
  | 0)  SubfileType = 1
  | 1)  ImageWidth = 160
  | 2)  ImageHeight = 112
  | 3)  BitsPerSample = 8 8 8
  | 4)  Compression = 7
  | 5)  PhotometricInterpretation = 6
  | 6)  Make = Hasselblad
  | 7)  Model = L1D-20c
  | 8)  PreviewImageStart = 45450
  | 9)  Orientation = 1
  | 10) SamplesPerPixel = 3
  | 11) PreviewImageLength = 29218
  | 12) Software = 10.00.11.04
  | 13) ModifyDate = 2020:02:15 14:41:53
  | 14) SubIFD (SubDirectory) -->
  | + [SubIFD directory with 27 entries]
  | | 0)  SubfileType = 0
  | | 1)  ImageWidth = 5568
  | | 2)  ImageHeight = 3648
  | | 3)  BitsPerSample = 16
  | | 4)  Compression = 1
  | | 5)  PhotometricInterpretation = 32803
  | | 6)  StripOffsets = 830690
  | | 7)  SamplesPerPixel = 1
  | | 8)  RowsPerStrip = 3648
  | | 9)  StripByteCounts = 40624128
  | | 10) PlanarConfiguration = 1
  | | 11) CFARepeatPatternDim = 2 2
  | | 12) CFAPattern2 = 0 1 1 2
  | | 13) CFAPlaneColor = 0 1 2
  | | 14) CFALayout = 1
  | | 15) BlackLevelRepeatDim = 2 2
  | | 16) BlackLevel = 4096 4093 4093 4095 (4096/1 4093/1 4093/1 4095/1)
  | | 17) WhiteLevel = 65535
  | | 18) DefaultScale = 1 1 (1/1 1/1)
  | | 19) DefaultCropOrigin = 4 4 (4/1 4/1)
  | | 20) DefaultCropSize = 5464 3640 (5464/1 3640/1)
  | | 21) BayerGreenSplit = 0
  | | 22) AntiAliasStrength = 1 (100/100)
  | | 23) BestQualityScale = 1 (1/1)
  | | 24) ActiveArea = 0 96 3648 5568
  | | 25) OpcodeList3 = ....0L.@.`...  ?..!.B..?..!.B...@)..@.K.@..r@...@..\@.a@...?...[snip]
  | | 26) DefaultUserCrop = 0 0 1 1 (0/1 0/1 1/1 1/1)
  | + [SubIFD1 directory with 15 entries]
  | | 0)  SubfileType = 1
  | | 1)  ImageWidth = 960
  | | 2)  ImageHeight = 640
  | | 3)  BitsPerSample = 8 8 8
  | | 4)  Compression = 7
  | | 5)  PhotometricInterpretation = 6
  | | 6)  PreviewImageStart = 74668
  | | 7)  SamplesPerPixel = 3
  | | 8)  RowsPerStrip = 640
  | | 9)  PreviewImageLength = 756022
  | | 10) PlanarConfiguration = 1
  | | 11) YCbCrCoefficients = 0.299 0.587 0.114 (299/1000 587/1000 114/1000)
  | | 12) YCbCrSubSampling = 2 2
  | | 13) YCbCrPositioning = 2
  | | 14) ReferenceBlackWhite = 0 255 128 255 128 255 (0/1 255/1 128/1 255/1 128/1 255/1)
  | 15) ApplicationNotes (SubDirectory) -->
  | + [XMP directory, 8192 bytes]
  | | About = DJI Meta Data
  | | ModifyDate = 2017-09-14
  | | CreateDate = 2017-09-14
  | | Make = DJI
  | | Model = Test_Pro
  | | Format = image/dng
  | | GPSLatitude = xxx
  | | GPSLongitude = xxx
  | | AbsoluteAltitude = +500.17
  | | RelativeAltitude = +199.90
  | | GimbalRollDegree = +0.00
  | | GimbalYawDegree = -128.70
  | | GimbalPitchDegree = -89.90
  | | FlightRollDegree = +3.10
  | | FlightYawDegree = -89.90
  | | FlightPitchDegree = -7.00
  | | CamReverse = 0
  | | GimbalReverse = 0
  | | SelfData = DJI Self data
  | | Version = 7.0
  | | HasSettings = False
  | | HasCrop = False
  | | AlreadyApplied = False
  | 16) ExifOffset (SubDirectory) -->
  | + [ExifIFD directory with 26 entries]
  | | 0)  ExposureTime = 0.005 (1/200)
  | | 1)  FNumber = 5 (500/100)
  | | 2)  ExposureProgram = 2
  | | 3)  ISO = 100
  | | 4)  ExifVersion = 0230
  | | 5)  DateTimeOriginal = 2020:02:15 14:41:53
  | | 6)  CreateDate = 2020:02:15 14:41:53
  | | 7)  ExposureCompensation = 0 (0/10)
  | | 8)  MaxApertureValue = 2.971 (2971/1000)
  | | 9)  MeteringMode = 2
  | | 10) LightSource = 1
  | | 11) Flash = 0
  | | 12) FocalLength = 10.26 (10260/1000)
  | | 13) FileSource = 3
  | | 14) SceneType = 1
  | | 15) ExposureMode = 0
  | | 16) WhiteBalance = 0
  | | 17) DigitalZoomRatio = 1 (1/1)
  | | 18) FocalLengthIn35mmFormat = 28
  | | 19) SceneCaptureType = 0
  | | 20) GainControl = 0
  | | 21) Contrast = 0
  | | 22) Saturation = 0
  | | 23) Sharpness = 0
  | | 24) SerialNumber = 0K8TFAA0020268
  | | 25) LensInfo = 28 28 2.8 11 (280/10 280/10 280/100 1100/100)
  | 17) GPSInfo (SubDirectory) -->
  | + [GPS directory with 7 entries]
  | | 0)  GPSVersionID = 2 3 0 0
  | | 1)  GPSLatitudeRef = N
  | | 2)  GPSLatitude = xxx
  | | 3)  GPSLongitudeRef = E
  | | 4)  GPSLongitude = xxx
  | | 5)  GPSAltitudeRef = 0
  | | 6)  GPSAltitude = 500 (500/1)
  | 18) DNGVersion = 1 4 0 0
  | 19) DNGBackwardVersion = 1 3 0 0
  | 20) UniqueCameraModel = Hasselblad L1D-20c
  | 21) ColorMatrix1 = 1.2385 -0.7159 -0.0657 -0.0982 1.0352 0.0721 0.0457 0.0241 0.743[snip]
  | 22) ColorMatrix2 = 0.731 -0.2746 -0.0646 -0.2991 1.0847 0.2469 0.0163 0.0585 0.6324[snip]
  | 23) AnalogBalance = 1 1 1 (1000000/1000000 1000000/1000000 1000000/1000000)
  | 24) AsShotNeutral = 0.3372859025 1 0.6052009456 (256/759 256/256 256/423)
  | 25) BaselineExposure = 0 (0/100)
  | 26) BaselineNoise = 1 (100/100)
  | 27) BaselineSharpness = 1 (100/100)
  | 28) LinearResponseLimit = 1 (100/100)
  | 29) CameraSerialNumber = 0K8TFAA0020268
  | 30) ShadowScale = 1 (1/1)
  | 31) DNGPrivateData = [ae_dbg_info:.....d...dd. ....&^.....j.c.....7.......>.][ae_hi[snip]
  | 32) CalibrationIlluminant1 = 17
  | 33) CalibrationIlluminant2 = 21
  | 34) ProfileName = Embedded
  | 35) ProfileHueSatMapDims = 18 6 1
  | 36) ProfileHueSatMapData1 = 0 1 1 0.538309991359711 1.08341300487518 1 0.4128620028[snip]
  | 37) ProfileHueSatMapData2 = 0 1 1 -0.644068002700806 1.12516498565674 1 -1.43428194[snip]
  | 38) ProfileEmbedPolicy = 0
  | 39) NoiseProfile = 8.108e-05 6e-08
  | 40) OriginalDefaultFinalSize = 0 0
  | 41) OriginalBestQualitySize = 0 0
  | 42) OriginalDefaultCropSize = 0 0
Reply to: dcraw and libraw mangles image metadata   4 years 10 months ago

Here are tiff file produced by dcraw_emu -T (from github/LibRaw/master branch) and result of exiftool -v3 tiff-file: https://www.dropbox.com/sh/6q9d3hd10z8x06m/AAA7QgHY9yf_KFK38JmZ5WF9a?dl=0

There are no tags 0xa40.. in this file.

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

apologies about the output, I sent a sample DNG file through the contact link.

I am still getting errors when trying to open the .tiff files

TIFFFieldWithTag: Internal error, unknown tag 0xa406.
TIFFFieldWithTag: Internal error, unknown tag 0xa407.
TIFFFieldWithTag: Internal error, unknown tag 0xa408.
TIFFFieldWithTag: Internal error, unknown tag 0xa409.
TIFFFieldWithTag: Internal error, unknown tag 0xa40a.
TIFFFieldWithTag: Internal error, unknown tag 0xa40b.

I am using colmap; which uses freeimage to import supported files. DNG files are unsupported but TIFF's are.

I think those unknown() values trips up freeimage.

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 11 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 11 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 11 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 11 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?

Pages