任何其他实现Fasters的方法-MATLAB cell array [英] Any other approach for Fasters implementation - matlab cell array

查看:75
本文介绍了任何其他实现Fasters的方法-MATLAB cell array的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张图片;我在上面运行一个循环并创建一个单元格数组.但是,所有值的处理过程都很慢.有什么办法可以加快这个过程吗?

I have an image; I am running a loop over it and creating a cell array. But the process for all the values is very slow. Is it any way possible to fasten the process?

还是其他任何方式可以更快地做到这一点?

Or any other way to do this faster?

任何帮助将不胜感激.

  [a,b] = size(depth);
  for i=1:a   % a = 1024
   for j=1:b  %b = 1360

    if isfinite(depth(i,j))
                segId = (label(i,j));
                if (segId > 0)
                  mycell{1,idx,segId} = {i,j,depth(i,j)};
                  idx=idx+1;       
                end 
             end
           end
         end

推荐答案

而不是每次交互时都更新mycell的大小,而是预先创建单元结构.那应该把它固定一点.

Instead of updating the size of mycell each interaction, create the cell structure beforehand. That should fasten it a bit.

尽管如此,您正在评估图像的所有点.为什么不做一些数学运算呢?

Nevertheless, you are evaluating all the points of a image. Why not make some mathematical operations?

[rol,col] = find(depth(depth> depth)0)-我快速扫描您的代码,您正在寻找我认为的值.

[rol,col] = find(depth(depth>0)) - I quick scan your code, your are looking for this values I think.

这将为您提供您想要在图像中找到的位置.也许您只需要将它放在for循环上,它将更快.

this gives you the positions in your image that you wanna find. Maybe you just need to put this on a for cycle and it will be faster.

这篇关于任何其他实现Fasters的方法-MATLAB cell array的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆