Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在matlab中突出显示滑动窗口_Matlab_Image Processing - Fatal编程技术网

在matlab中突出显示滑动窗口

在matlab中突出显示滑动窗口,matlab,image-processing,Matlab,Image Processing,我有下面的代码,它在最终图像上创建了一个滑动窗口 我创建了原始图像的副本: ZwindowedMarked=Final; 我将滑动图像应用于原始图像 N = 32; info = repmat(struct, ceil(size(Final, 1) / N), ceil(size(Final, 2) / N)); for row = 1:N:size(Final, 1)%loop through each pixel in the image matrix for col =

我有下面的代码,它在最终图像上创建了一个滑动窗口

我创建了原始图像的副本:

ZwindowedMarked=Final;
我将滑动图像应用于原始图像

N = 32;
 info = repmat(struct, ceil(size(Final, 1) / N), ceil(size(Final, 2) / N)); 
  for row = 1:N:size(Final, 1)%loop through each pixel in the image matrix
     for col = 1:N:size(Z, 2)
         r = (row - 1) / N + 1;
         c = (col - 1) / N + 1;

          imgWindow = Final(row:min(end,row+N-1), col:min(end,col+N-1));           
          average = mean(imgWindow(:)); 
          window(r, c).average=average;
          display(window(r, c).average);



        % if mean pixel intensity is greater than 200 then highlight the window

        if average>180  
        ZWindowedMarked  = insertShape(Z, 'rectangle', [col row 32 32]);
        end 

    end 
 end 
 figure(2);
 imshow(ZWindowedMarked)
然而,尽管有许多窗口的平均值大于180,但它在图像上只显示一个矩形。有人能告诉我如何在同一张图片上突出显示平均值大于180的所有滑动窗口吗


感谢上面的代码,我们是否可以假设FinalZZWindowedMarked最初都是相同的图像(在迭代之前)?您可能希望在代码中明确这一点,然后决定使用ZFinal,但不能同时使用两者

您需要做些什么来确保在窗口图像上绘制所有矩形(ZWindowedMarked),并将标记图像传递给insertShape函数

 % if mean pixel average is greater than 180 then highlight the window
 if average>180  
   ZWindowedMarked  = insertShape(ZWindowedMarked, 'rectangle', [col row 32 32]);
 end 
而不是将原始未接触的Z传递给上述函数。(还要注意对注释的更改。)

希望这有帮助