【问题标题】:Processing multiple images in MATLAB在 MATLAB 中处理多个图像
【发布时间】:2015-01-21 03:48:33
【问题描述】:

我正在对文件夹中的一系列图像(大约 100 个)执行一些图像分割/处理。这些图像实际上是与视频分开的帧。

所以无论我在做什么都是有效的,但处理所有图像需要很长时间。有没有其他方法可以加快这个过程?

这是如何完成的: (1) 在单元格数组中加载图像 (2)通过单元格数组取出每个图像并将其发送到适当的函数 (3) 显示返回的

谢谢

这就是我的做法:

A = size(handles.sortedImage_depth);
tic

for k = 1: A(1,1)

handles.depth_img =       imread(fullfile(handles.myFolderdepth,handles.sortedImage_depth{k})); %loads one depth image

handles.color_img = imread(fullfile(handles.myFoldercolor,handles.sortedImage_color{k})); %loads one color image

[unRGB, unDepth] = undistort(handles.color_img,handles.depth_img);%undistorts the depth n color
[mapped_depth] = depth_mapping(unDepth); %Maps the depth images to a bigger Resolution
handles.depth_mapped{k} = mapped_depth; %saves the resulting images in a cell array

[coordinates] = segmentation(handles,unRGB); %performs image segmentation on RGB

handles.allcoordinates = coordinates;
EE{k} = handles.allcoordinates;
end
EE
toc

【问题讨论】:

  • 我能想到的唯一优化(使用您提供的信息)是加载每个图像,处理它,然后加载下一个图像,覆盖当前图像。这样您就不需要将所有图像都保存在内存中,如果它们需要大量内存(磁盘分页),这可能会减慢速度
  • 我还要补充一点,使用常规数组而不是元胞数组可能会有所帮助。如果没有看到您的代码,很难比它更精确。
  • 您的代码与您的描述不符。它一次加载一个或两个图像,而不是像您在问题中写的那样一次加载所有图像
  • 使用profile 运行您的代码并检查结果。
  • 对不起,这是我一小时前所做的最后一次更改。我尝试了不同的事情,所花费的时间大致相同。

标签: matlab image-processing video-processing image-segmentation


【解决方案1】:

如果不知道对每个图像进行操作的函数的详细信息,很难说,但您可以将代码转换为 GPU 处理(这通常要快得多)。要了解如何将 MATLAB 代码转换为基于 GPU 的代码,这里有一些有用的链接:

GPU-arrays(告诉 MATLAB 尝试 GPU 处理的文件格式)

Element-wise GPU-enabled functions

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    相关资源
    最近更新 更多