📄 canon.pm
字号:
9 => { Name => 'SequenceNumber', Description => 'Sequence number in continuous burst', }, 15 => { Name => 'FlashExposureComp', Description => 'Flash Exposure Compensation', ValueConv => 'TagTables::Canon::CanonEv($val);', PrintConv => 'TagTables::Exif::ConvertFraction($val)', }, 16 => { Name => 'AutoExposureBracketing', PrintConv => { 0 => 'Off', -1 => 'On', }, }, 17 => { Name => 'AEBBracketValue', ValueConv => 'TagTables::Canon::CanonEv($val)', PrintConv => 'TagTables::Exif::ConvertFraction($val)', }, 19 => { Name => 'FocusDistanceUpper', ValueConv => '$val * 0.01', }, 20 => { Name => 'FocusDistanceLower', ValueConv => '$val * 0.01', }, 21 => { Name => 'FNumber', Description => 'Av(Aperture Value)', # approximate big translation table by simple calculation - PH ValueConv => '$val ? exp(TagTables::Canon::CanonEv($val)*log(2)/2) : undef()', PrintConv => 'sprintf("%.2g",$val);', }, 22 => { Name => 'ExposureTime', Description => 'Tv(Shutter Speed)', # approximate big translation table by simple calculation - PH ValueConv => '$val ? exp(-TagTables::Canon::CanonEv($val)*log(2)) : undef()', PrintConv => 'TagTables::Exif::PrintExposureTime($val);', }, 24 => { Name => 'BulbDuration', Format => 'Long', ValueConv => '$val / 10', }, 29 => { Name => 'Self-timer2', ValueConv => '$val / 10', },);# picture information (EXIF tag 0x12)%TagTables::Canon::PictureInfo = ( TableType => 'BinaryData', 2 => 'CanonImageWidth', 3 => 'CanonImageHeight', 4 => 'CanonImageWidthAsShot', 5 => 'CanonImageHeightAsShot', 22 => { Name => 'AFPointsUsed', Description => 'AF Points Used', # this works for my Rebel -- bits 6-0 correspond to focus points 1-7 respectively - PH PrintConv => 'TagTables::Canon::PrintAFPoints($val)', },);# The 300D writes a 1536x1024 preview image that is accessed# through this information - decoded by PH 12/14/03%TagTables::Canon::PreviewImageInfo = ( TableType => 'BinaryData', Format => 'ULong',# the size of the preview block in 2-byte increments# 0 => {# Name => 'PreviewImageInfoWords',# },# this value is always 2# 1 => {# Name => 'PreviewImageUnknown',# }, 2 => 'PreviewImageLength', 3 => 'PreviewImageWidth', 4 => 'PreviewImageHeight', 5 => 'PreviewImageStart', 6 => { Name => 'PreviewFocalPlaneXResolution', Format => 'LongRational', PrintConv => 'sprintf("%.1f",$val)' }, 8 => { Name => 'PreviewFocalPlaneYResolution', Format => 'LongRational', PrintConv => 'sprintf("%.1f",$val)' },# the following 2 values look like they are really 4 shorts# taking the values of 1,4,4 and 2 respectively - don't know what they are though# 10 => {# Name => 'PreviewImageUnknown1',# PrintConv => 'sprintf("0x%x",$val)',# },# 11 => {# Name => 'PreviewImageUnknown2',# PrintConv => 'sprintf("0x%x",$val)',# },);%TagTables::Canon::Canon1DSettings = ( TableType => 'BinaryData', 9 => 'ColorTemperature', 10 => 'ColorMatrix',);# canon composite tags# (the main script looks for the special 'Composite' hash)%TagTables::Canon::Composite = ( DriveMode => { Require => { 0 => 'ContinuousDrive', 1 => 'Self-timer', }, ValueConv => '$val[0] ? 0 : ($val[1] ? 1 : 2)', PrintConv => { 0 => 'Continuous shooting', 1 => 'Self-timer Operation', 2 => 'Single-frame shooting', }, }, Lens => { Require => { 0 => 'ShortFocal', 1 => 'LongFocal', 2 => 'FocalUnits', }, ValueConv => '$val[0] / $val[2]', PrintConv => 'TagTables::Canon::PrintFocalRange(@val)', }, Lens35efl => { Description => 'Lens', Require => { 0 => 'ShortFocal', 1 => 'LongFocal', 2 => 'FocalUnits', 4 => 'Lens', }, Desire => { 3 => 'ScaleFactor35efl', }, ValueConv => '$val[4] * ($val[3] ? $val[3] : 1)', PrintConv => '$valPrint[4] . ($val[3] ? sprintf(" (35mm equivalent: %s)",TagTables::Canon::PrintFocalRange(@val)) : "")', }, ShootingMode => { Require => { 0 => 'CanonExposureMode', 1 => 'EasyMode', }, ValueConv => '$val[0] ? $val[0] : $val[1] + 10', PrintConv => '$val[0] ? $valPrint[0] : $valPrint[1]', }, FlashType => { Require => { 0 => 'FlashBits', }, ValueConv => '$val[0] ? ($val[0]&(1<<14)? 1 : 0) : undef()', PrintConv => { 0 => 'Built-In Flash', 1 => 'External', }, }, RedEyeReduction => { Require => { 0 => 'CanonFlashMode', 1 => 'FlashBits', }, ValueConv => '$val[1] ? (($val[0]==3 or $val[0]==4 or $val[0]==6) ? 1 : 0) : undef()', PrintConv => { 0 => 'Off', 1 => 'On', }, }, # fudge to display simple Flash On/Off for Canon cameras only FlashOn => { Description => 'Flash', Desire => { 0 => 'FlashBits', 1 => 'Flash', }, ValueConv => 'TagTables::Canon::FlashOn(@val)', PrintConv => { 0 => 'Off', 1 => 'On', }, }, # same as FlashExposureComp, but undefined if no flash ConditionalFEC => { Description => 'Flash Exposure Compensation', Require => { 0 => 'FlashExposureComp', 1 => 'FlashBits', }, ValueConv => '$val[1] ? $val[0] : undef()', PrintConv => '$valPrint[0]', }, # hack to assume 1st curtain unless we see otherwise ShutterCurtainHack => { Description => 'Shutter Curtain Sync', Desire => { 0 => 'ShutterCurtainSync', }, Require => { 1 => 'FlashBits', }, ValueConv => '$val[1] ? (defined($val[0]) ? $val[0] : 0) : undef()', PrintConv => { 0 => '1st-curtain sync', 1 => '2nd-curtain sync', }, }, PreviewImage => { Require => { 0 => 'PreviewImageStart', 1 => 'PreviewImageLength', 2 => 'CanonFileLength', }, ValueConv => 'ExifTool::ExtractBinary($val[0]+12,$val[1],"PreviewImage")', PrintConv => '"(Preview image, use -b option to extract binary)"', }, PreviewImageSize => { Require => { 0 => 'PreviewImageWidth', 1 => 'PreviewImageHeight', }, ValueConv => '"$val[0]x$val[1]"', },);#------------------------------------------------------------------------------# Validate first word of Canon binary data# Inputs: 0) data pointer, 1) offset, 2) value# Returns: true if data value is the samesub Validate($$$){ my ($dataPt, $offset, $val) = @_; # the first 16-bit value is the length of the data in words my $dataVal = ExifTool::Get16u($dataPt, $offset); return $val == $dataVal;}#------------------------------------------------------------------------------# Print range of focal lengths# Inputs: 0) short focal, 1) long focal, 2) focal units, 3) optional scaling factorsub PrintFocalRange(@){ my ($short, $long, $units, $scale) = @_; $scale and $units /= $scale; # correct for 35efl scaling factor if given if ($short == $long) { return sprintf("%.1fmm", $short / $units); } else { return sprintf("%.1f - %.1fmm", $short / $units, $long / $units); }}#------------------------------------------------------------------------------# Print auto focus points# Inputs: 0) value to convertsub PrintAFPoints($){ my $val = shift; my @p; $val&1<<(7-$_) and push(@p,$_) foreach (1..7); return sprintf("%d (%s)",scalar @p,join(",",@p));}#------------------------------------------------------------------------------# Decide whether flash was on or offsub FlashOn(@){ my @val = @_; if (defined $val[0]) { return $val[0] ? 1 : 0; } if (defined $val[1]) { return $val[1]&0x07 ? 1 : 0; } return undef;}#------------------------------------------------------------------------------# Convert Canon hex-based EV (modulo 0x20) to real number# Inputs: 0) value to convert# ie) 0x00 -> 0# 0x0c -> 0.33333# 0x10 -> 0.5# 0x14 -> 0.66666# 0x20 -> 1 ... etcsub CanonEv($){ my $val = shift; my $sign; # temporarily make the number positive if ($val < 0) { $val = -$val; $sign = -1; } else { $sign = 1; } my $frac = $val & 0x1f; $val -= $frac; # remove fraction # Convert 1/3 and 2/3 codes if ($frac == 0x0c) { $frac = 0x20 / 3; } elsif ($frac == 0x14) { $frac = 0x40 / 3; } return $sign * ($val + $frac) / 0x20;}#------------------------------------------------------------------------------# Decode bit mask# Inputs: 0) value to decode, # 1) Reference to hash for decodingsub DecodeBits($$){ my $bits = shift; my $lookup = shift; my $outStr = ''; for (my $i=0; $i<32; ++$i) { next unless $bits & (1 << $i); $outStr .= ', ' if $outStr; if ($$lookup{$i}) { $outStr .= $$lookup{$i}; } else { $outStr .= "[$i]"; } } return $outStr || '(none)';}1; # end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -