如何使用 MATLAB 提取图像元数据?

How to extract image metadata using MATLAB?

如何使用 MATLAB 提取图像元数据,例如曝光、宽度、高度或位深度?

直到最近我还在使用exifread,但是这个函数在最新的MATLAB版本中已经不存在了。

另一个函数是imfinfo,但它无法读取'EXPOSURE DATA'图像。

如何阅读 'exposure' 图片?

您认为丢失的所有信息都存储在 iminfo 中,只是有所不同。你要的大部分参数(包括曝光数据)都在

info=iminfo(fname);
info.DigitalCamera

exifread() 已于 9 年前弃用。它已被替换为 imfinfo

info = imfinfo(filename) 将 return 您想要的所有信息。

来自Matlab reference

Additional fields returned by some file formats:

JPEG and TIFF only — If filename contains Exchangeable Image File Format (EXIF) tags, then info might also contain 'DigitalCamera' or 'GPSInfo' (global positioning system information) fields.

info.Widthinfo.Heightinfo.BitDepth。 曝光时间以及所有其他相机参数都存储在 1x1 结构 info.DigitalCamera

这是来自

的示例

https://de.mathworks.com/matlabcentral/answers/146651-missing-functionality-when-using-imfinfo-instead-of-exifread

>> info = imfinfo('img_1771.jpg')
info = 
            Filename: 'C:\Users\fhempel\Desktop\tmp\img_1771.jpg'
         FileModDate: '07-Aug-2014 12:09:45'
            FileSize: 32764
              Format: 'jpg'
       FormatVersion: ''
               Width: 480
              Height: 360
            BitDepth: 24
           ColorType: 'truecolor'
     FormatSignature: ''
     NumberOfSamples: 3
        CodingMethod: 'Huffman'
       CodingProcess: 'Sequential'
             Comment: {}
                Make: 'Canon'
               Model: 'Canon PowerShot S40'
         Orientation: 1
         XResolution: 180
         YResolution: 180
      ResolutionUnit: 'Inch'
            DateTime: '2003:12:14 12:01:44'
    YCbCrPositioning: 'Centered'
       DigitalCamera: [1x1 struct]
       ExifThumbnail: [1x1 struct]


>> info.DigitalCamera
ans = 
                ExposureTime: 0.0020
                     FNumber: 4.9000
                 ExifVersion: [48 50 50 48]
            DateTimeOriginal: '2003:12:14 12:01:44'
           DateTimeDigitized: '2003:12:14 12:01:44'
     ComponentsConfiguration: 'YCbCr'
      CompressedBitsPerPixel: 5
           ShutterSpeedValue: 8.9688
               ApertureValue: 4.6563
           ExposureBiasValue: 0
            MaxApertureValue: 2.9709
                MeteringMode: 'CenterWeightedAverage'
                       Flash: 'Flash did not fire, no strobe return detection function, auto flash mode, f...'
                 FocalLength: 21.3125
                   MakerNote: [1x450 double]
                 UserComment: [1x264 double]
             FlashpixVersion: [48 49 48 48]
                  ColorSpace: 'sRGB'
            CPixelXDimension: 2272
            CPixelYDimension: 1704
         InteroperabilityIFD: [1x1 struct]
       FocalPlaneXResolution: 8.1143e+03
       FocalPlaneYResolution: 8.1143e+03
    FocalPlaneResolutionUnit: 2
               SensingMethod: 'One-chip color area sensor'
                  FileSource: 'DSC'
              CustomRendered: 'Normal process'
                ExposureMode: 'Auto exposure'
                WhiteBalance: 'Auto white balance'
            DigitalZoomRatio: 1
            SceneCaptureType: 'Standard'