【问题标题】:Implement Sliding Window Algo in Matlab在 Matlab 中实现滑动窗口算法
【发布时间】:2017-09-23 12:29:33
【问题描述】:

我想实现滑动窗口算法。 目标是显示我所有的窗口。 但我只有 1 个窗口。 这是我的代码:

clc;clear all;`   
image = imread('tabTes.png');
imageWidth = size(image, 2);
imageHeight = size(image, 1);
windowWidth = 100;
windowHeight = 100;
for j = 1:imageHeight - imageHeight + 1
    for i = 1:imageWidth - imageWidth + 1
        SlideWindow = image(j:j + windowHeight - 1, i:i + windowWidth - 1, :);
     end
end
figure
imshow(SlideWindow);

【问题讨论】:

    标签: matlab sliding-window


    【解决方案1】:

    试试这个:

    clc;clear all;`   
    image = imread('tabTes.png');
    imageWidth = size(image, 2);
    imageHeight = size(image, 1);
    windowWidth = 100;
    windowHeight = 100;
    for j = 1:imageHeight - windowHeight + 1
        for i = 1:imageWidth - windowWidth + 1
            SlideWindow = image(j:j + windowHeight - 1, i:i + windowWidth - 1, :);
             figure
             imshow(SlideWindow);
         end
    end
    

    不过要小心。这会产生很多数字。

    【讨论】:

    • 您好,感谢您的回复。但是输出和我的一样:(
    • 很抱歉没有捕获您的索引变量。一分钟后查看我的编辑
    • 谢谢兄弟,它有效!还有另一个我想解决的问题。在接下来的几个小时里,我会把它贴在这里。如果你想(再次)帮助我,很高兴:D
    猜你喜欢
    • 2021-06-25
    • 2011-02-25
    • 2013-03-30
    • 2015-02-27
    • 2017-09-04
    • 2021-07-01
    • 2015-06-16
    • 1970-01-01
    • 2022-11-27
    相关资源
    最近更新 更多