资源简介
区域性特征提取MSER,1.对于图像灰度的仿射变化具有不变性
2.稳定性,区域的支持集相对灰度变化稳定
3.可以检测不同精细程度的区域
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This code implements the MSER small target detection algorithm in the following paper:
%
% Jing Lou Wei Zhu Huan Wang Mingwu Ren “Small Target Detection Combining Regional Stability and Saliency in a Color Image“
% Multimedia Tools and Applications pp. 1-18 2016. doi:10.1007/s11042-016-4025-7
%
% Project page: http://www.loujing.com/rss-small-target/
%
% Copyright (C) 2016 Jing Lou
%
% The usage of this code is restricted for non-profit research usage only and using of the code is at the user‘s risk.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc; clear; close all;
%% VLFeat setup
run(‘vlfeat-0.9.19\toolbox\vl_setup‘)
%% Dataset
data = ‘Data1‘; % Data1 Data2 or Data3
%% Parameters
param.Delta = 20; % \delta
param.MinDiversity = 0.7; % d_m
param.MaxVariation = 0.7; % v_m
% target area (fixed value)
param.minarea = 4; % pixels
param.maxarea = 0.2; % ratio
%% MSER
% make folder
if exist([data‘\MSER‘] ‘dir‘) ~= 7 % detected small targets (.mat and .png)
system([‘md ‘data‘\MSER‘]);
end
imgs = dir([data‘\Image\*.png‘]);
for imgno = 1:length(imgs)
fprintf(‘ %3d/%3d : ‘ imgno length(imgs));
tic;
rgb = imread([data‘\Image\‘int2str(imgno)‘.png‘]);
if ndims(rgb) == 3
gray = rgb2gray(rgb);
end
[r~] = vl_mser(gray ‘MinDiversity‘param.MinDiversity ‘MaxVariation‘param.MaxVariation ‘Delta‘param.Delta...
‘BrightOnDark‘0‘DarkOnBright‘1);
Regions = {};
RegNo = 1;
for rno=r‘
s = vl_erfill(grayrno) ;
if length(s) >= param.minarea && length(s)<=numel(gray)*param.maxarea
[rowcol] = ind2sub(size(gray) s);
if isempty(find(row==1)) && isempty(find(row==size(gray1))) &&...
isempty(find(col==1)) && isempty(find(col==size(gray2)))
% Pixel List
Regions{RegNo}.PixelList = [colrow];
% Bounding Box
x = min(col);
y = min(row);
w = max(col)-x+1;
h = max(row)-y+1;
Regions{RegNo}.BoundingBox = [xywh];
RegNo = RegNo + 1;
end
end
end
% remove the region which is contained in another bigger region
MSERs = [];
if ~isempty(Regions)
RetainedRgns = ones(size(Regions));
for m = 1:length(Regions)
bbm = Regions{m}.BoundingBox;
for n = 1:length(Regions)
bbn = Regions{n}.BoundingBox;
if m~=n && bbn(1)>=bbm(1) && bbn(2)>=bbm(2) && ...
bbn(1)+bbn(3)<=bbm(1)+bbm(3) && bbn(2)+bbn(4)<=bbm(2)+bbm(4)
RetainedRgns(n) = 0;
end
end
end
RegNo = 1;
for k = 1:length(Regions)
if RetainedRgns(k) == 1
MSERs(RegNo).PixelList = Regions{k}.PixelList;
MSERs(RegNo).BoundingBox = Regions{k}.BoundingBox;
RegNo = RegNo + 1;
end
end
end
% save
bin = false(size(gray));
if ~isempty(MSERs)
for k = 1:length(MSERs)
pixellist = MSERs(k).Pix
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-11-13 09:50 MSER\
目录 0 2016-11-12 00:54 MSER\Data1\
目录 0 2016-11-12 00:54 MSER\Data1\Image\
文件 59278 2016-08-16 10:32 MSER\Data1\Image\1.png
文件 59764 2016-08-16 10:32 MSER\Data1\Image\10.png
文件 59977 2016-08-16 10:32 MSER\Data1\Image\100.png
文件 60560 2016-08-16 10:32 MSER\Data1\Image\101.png
文件 61011 2016-08-16 10:32 MSER\Data1\Image\102.png
文件 60632 2016-08-16 10:32 MSER\Data1\Image\103.png
文件 60722 2016-08-16 10:32 MSER\Data1\Image\104.png
文件 61185 2016-08-16 10:32 MSER\Data1\Image\105.png
文件 61172 2016-08-16 10:32 MSER\Data1\Image\106.png
文件 61263 2016-08-16 10:32 MSER\Data1\Image\107.png
文件 61173 2016-08-16 10:32 MSER\Data1\Image\108.png
文件 58517 2016-08-16 10:32 MSER\Data1\Image\109.png
文件 60075 2016-08-16 10:32 MSER\Data1\Image\11.png
文件 60369 2016-08-16 10:32 MSER\Data1\Image\110.png
文件 60497 2016-08-16 10:32 MSER\Data1\Image\111.png
文件 60798 2016-08-16 10:32 MSER\Data1\Image\112.png
文件 60798 2016-08-16 10:32 MSER\Data1\Image\113.png
文件 60446 2016-08-16 10:32 MSER\Data1\Image\114.png
文件 60314 2016-08-16 10:32 MSER\Data1\Image\115.png
文件 60413 2016-08-16 10:32 MSER\Data1\Image\116.png
文件 60614 2016-08-16 10:32 MSER\Data1\Image\117.png
文件 60987 2016-08-16 10:32 MSER\Data1\Image\118.png
文件 61886 2016-08-16 10:32 MSER\Data1\Image\119.png
文件 60340 2016-08-16 10:32 MSER\Data1\Image\12.png
文件 60026 2016-08-16 10:32 MSER\Data1\Image\120.png
文件 60091 2016-08-16 10:32 MSER\Data1\Image\121.png
文件 60202 2016-08-16 10:32 MSER\Data1\Image\122.png
文件 61748 2016-08-16 10:32 MSER\Data1\Image\123.png
............此处省略1072个文件信息
评论
共有 条评论