代码之家  ›  专栏  ›  技术社区  ›  Abdul Rehman

在图像中寻找像素变化最大的区域

  •  0
  • Abdul Rehman  · 技术社区  · 6 年前

    我正在努力从像素变化最大的图像中提取区域。经过预处理后,我得到了下面的图像。 enter image description here

    x = imread('test2.jpg');
    gray_x = rgb2gray(x);
    I = medfilt2(gray_x,[3 3]);
    gray_x = I;
    
    %%
    canny_x = edge(gray_x,'canny',0.3);
    figure,imshow(canny_x);
    
    %%
    s = strel('disk',3);
    si = imdilate(canny_x,s);
    %figure5
    figure; imshow(si);
    se = imerode(canny_x,s);title('dilation');
    %figure6
    figure; imshow(se);title('Erodsion');
    I = imsubtract(si,se);
    %figure7
    figure; imshow(I);
    

    基本上我所奋斗的,是使武器检测系统使用图像处理。我想定位可能成为武器的区域,这样我就可以把它们提供给我的分类器来识别它是否是武器。有什么建议吗?谢谢你

    1 回复  |  直到 6 年前
        1
  •  0
  •   user8190410    6 年前

    一个可能的解决方案是:

    • 在图像中查找角点(Harris角点等)
    • 取一个矩形窗口,在整个图像上遍历它
    • 矩形窗口中所有白色像素的总和
    • 选择所有区域之和最大的区域