Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I read an HEIC image in matlab?

Tags:

image

matlab

heic

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?

like image 624
xXx Avatar asked Jan 21 '26 08:01

xXx


1 Answers

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...

like image 69
Mark Setchell Avatar answered Jan 24 '26 09:01

Mark Setchell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!