如何在Matlab中读取HEIC图像?

时间:2019-02-06 15:10:30

标签: image matlab heic

我有一个来自iPhone的HEIC图像(它包含深度数据),我想将其导入Matlab(在Mac上)。但是imread()不支持此格式。反正我怎么能做到?

1 个答案:

答案 0 :(得分:2)

如果您使用 homebrew 在Mac上管理软件包,则可以通过以下方式安装具有HEIC支持的 ImageMagick (通过export { * as stuff } from './stuff' export { * as stuff2 } from './stuff2' )(顺序很重要) :

function buildTree(arr: Item[]): NestedItem[] {
  /* first split the input into separate arrays based on their nested level */
  const roots = arr.filter(r => /^\w{1}$/.test(r.id));
  const levelOne = arr.filter(r => /^\w{1}\d{1}$/.test(r.id));
  const levelTwo = arr.filter(r => /^\w{1}\d{1}-\d{1}$/.test(r.id));

  /* then create the bottom most level based on their relationship to their parent*/
  const nested = levelOne.map(item => {
    const children = levelTwo.filter(c => c.parentId === item.id);
    if (children) {
      return {
        ...item,
        count: children.length,
        children
      };
    } else return item;
  });

  /* and finally do the same with the root items and return the result */
  return roots.map(item => {
    const children = nested.filter(c => c.parentId === item.id);
    if (children) {
      return {
        ...item,
        count: children.length,
        children,
        root: true
      };
    } else return { ...item, root: true };
  });
}

然后,您应该能够运行以下命令来检查您是否具有HEIC支持:

libde265

示例输出

brew install libde265
brew install imagemagick

如果一切正常,您应该可以使用以下方法检查一张HEIC图像:

magick identify -list format | grep -Ei "HEIC|HEIF"

然后,我们应该能够从图像中提取所需内容,并将其设置为Matlab可以读取的某种格式-但这一切都是很新的,我将需要您的反馈以取得进展...