Comments (3)
FYI, https://github.com/dnglab/dnglab has full support for CR3 Raw Burst Frame extraction inluding metadata and CTMD.
from canon_cr3.
I did this to get me far enough with my R8 CR3s:
Mac-Studio:canon_cr3 koen$ git diff
diff --git a/CRaw3/TiffIfd.py b/CRaw3/TiffIfd.py
index 8d2f71e..136b27b 100644
--- a/CRaw3/TiffIfd.py
+++ b/CRaw3/TiffIfd.py
@@ -4,7 +4,10 @@ from collections import namedtuple, OrderedDict
from binascii import hexlify
def getShortLE(d, a):
- return unpack('<H',(d)[a:a+2])[0]
+ if len(d) >1:
+ return unpack('<H',(d)[a:a+2])[0]
+ else:
+ return 0
def getLongLE(d, a):
return unpack('<L',(d)[a:a+4])[0]
diff --git a/parse_cr3.py b/parse_cr3.py
old mode 100644
new mode 100755
index f4041e3..bf3b722
--- a/parse_cr3.py
+++ b/parse_cr3.py
@@ -376,20 +376,23 @@ elif cr3[b'CNCV'].find(b'CanonCR3')>=0:
#now we want raw data of TIFF entry 0x4016 (TIFF_CANON_VIGNETTING_CORR2), in subdir TIFF_MAKERNOTE, in CTMD record #7. We know it is type=4=long, little endian 32 bits
ctmd_makernote7 = getIfd( b'CTMD', { 'type':7, 'tag':TiffIfd.TIFF_MAKERNOTE } ) #picture 0 by default
- if TiffIfd.TIFF_CANON_VIGNETTING_CORR2 in ctmd_makernote7.ifd:
- vignetting_corr2 = ctmd_makernote7.ifd[ TiffIfd.TIFF_CANON_VIGNETTING_CORR2 ]
- r = Struct('<%dL' % vignetting_corr2.length).unpack_from( data, ctmd_makernote7.base+vignetting_corr2.value )
- if options.verbose>1:
- print(r)
+ if ctmd_makernote7:
+ if TiffIfd.TIFF_CANON_VIGNETTING_CORR2 in ctmd_makernote7.ifd:
+ vignetting_corr2 = ctmd_makernote7.ifd[ TiffIfd.TIFF_CANON_VIGNETTING_CORR2 ]
+ r = Struct('<%dL' % vignetting_corr2.length).unpack_from( data, ctmd_makernote7.base+vignetting_corr2.value )
+ if options.verbose>1:
+ print(r)
cmt3 = getIfd( b'CMT3', None )
- if TiffIfd.TIFF_MAKERNOTE_ROLLINFO in cmt3.ifd: # only in CSI_* files (raw burst mode)
- rollInfoTag = cmt3.ifd[ TiffIfd.TIFF_MAKERNOTE_ROLLINFO ]
- #print( rollInfoTag )
- length, current, total = Struct('<%d%s' % (rollInfoTag.length, TiffIfd.tiffTypeStr[rollInfoTag.type-1])).unpack_from( data, cmt3.base+rollInfoTag.value )
- #exif IFD for current picture in the roll
- ifd = getIfd( b'CTMD', { 'picture':current, 'type':7, 'tag':TiffIfd.TIFF_MAKERNOTE } )
- ifd.display()
+ if cmt3:
+ if TiffIfd.TIFF_MAKERNOTE_ROLLINFO in cmt3.ifd: # only in CSI_* files (raw burst mode)
+ rollInfoTag = cmt3.ifd[ TiffIfd.TIFF_MAKERNOTE_ROLLINFO ]
+ #print( rollInfoTag )
+ length, current, total = Struct('<%d%s' % (rollInfoTag.length, TiffIfd.tiffTypeStr[rollInfoTag.type-1])).unpack_from( data, cmt3.base+rollInfoTag.value )
+ #exif IFD for current picture in the roll
+ ifd = getIfd( b'CTMD', { 'picture':current, 'type':7, 'tag':TiffIfd.TIFF_MAKERNOTE } )
+ if ifd:
+ ifd.display()
NT_SENSOR_INFO = namedtuple('sensorInfo','w h lb tb rb bb')
sensorInfo = cmt3.ifd[ TiffIfd.TIFF_MAKERNOTE_SENSORINFO ]
from canon_cr3.
Related Issues (16)
- No mdata with Canon EOS RP image files HOT 5
- Support for burst files HOT 6
- Convert .cr3 to .tiff or .png HOT 5
- PyPI package ownership
- Canon R3 Samples HOT 6
- Pixel Data into an array HOT 1
- Canon R7 HEIF HOT 4
- fail to install by `pip setup.py` HOT 1
- Canon R3 HEIF HOT 7
- Canon R8 HOT 19
- Completing the M6 Mark II sample set
- Unable to find the Image class
- Canon r6mk2 samples HOT 5
- Wrong definition for records in CTMD box HOT 3
- CMP1 structure HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from canon_cr3.