问题
I have an HEIC image from my iPhone (it contains depth data) and I want to import it in Matlab (on Mac). but imread() does not support this format. How could I achive this anyway?
回答1:
If you use homebrew to manage packages on your Mac, you can install ImageMagick with HEIC support (via libde265
) like this (order is important):
brew install libde265
brew install imagemagick
You should then be able to run the following command to check you have HEIC support:
magick identify -list format | grep -Ei "HEIC|HEIF"
Sample Output
Format Module Mode Description
-------------------------------------------------------------------------------
3FR DNG r-- Hasselblad CFV/H3D39II
3G2 MPEG r-- Media Container
3GP MPEG r-- Media Container
AAI* AAI rw+ AAI Dune image
AI PDF rw- Adobe Illustrator CS2
ART* ART rw- PFS: 1st Publisher Clip Art
ARW DNG r-- Sony Alpha Raw Image Format
AVI MPEG r-- Microsoft Audio/Visual Interleaved
AVS* AVS rw+ AVS X image
BGR* BGR rw+ Raw blue, green, and red samples
...
...
HEIC* HEIC rw- High Efficiency Image Format <--- THERE IT IS
If all that works, you should be able to inspect one of your HEIC images with:
magick identify -verbose SomeImage.HEIC
Then we should be able to extract whatever you want from the image and put it into some format that Matlab can read - but it is all pretty new and I'll need feedback from you as to progress...
来源:https://stackoverflow.com/questions/54556739/how-can-i-read-an-heic-image-in-matlab