博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【计算机视觉领域】常用的 feature 提取方法,feature 提取工具包
阅读量:6340 次
发布时间:2019-06-22

本文共 2670 字,大约阅读时间需要 8 分钟。

 

【计算机视觉领域】常用的 feature 提取方法,feature 提取工具包

 

  利用 VL 工具包进行各种特征的提取:

  VL 工具包官网地址:http://www.vlfeat.org/index.html

 

%% Extract Every kind of Features

% the VL_tool box for feature extraction.
clc;
run('/home/wangxiao/Documents/MATLAB/vlfeat-0.9.20-bin/vlfeat-0.9.20/toolbox/vl_setup.m')
imagePath = '/home/wangxiao/Documents/Sun-80-dataset/Sun_80_dataset/train_image_sun_256_256/' ;
Labeled_data = importdata('/home/wangxiao/Documents/Sun-80-dataset/Sun_80_dataset/SUN100_Label_train_0.5_.txt');
Unlabel_data = importdata('/home/wangxiao/Documents/Sun-80-dataset/Sun_80_dataset/SUN100_Unlabel_train_0.5_.txt');

for i = 1:size(Labeled_data.data, 1)

imageName = Labeled_data.textdata{i, 1};
% image = imread([imagePath, imageName]);
image = imread('/home/wangxiao/Pictures/wallhaven-382471.png');
image = imresize(image, [224, 224]);
% change the image into single precision.
figure; imshow(image);
imgs = im2single(rgb2gray(image)) ;

 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% use vl_covdet to compute and visualize co-variant features.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

frames = vl_covdet(imgs, 'verbose') ;
hold on ;
vl_plotframe(frames) ; % visualize the features.

 

 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% use vl_hog to extract the hog feature.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

cellSize = 8 ;
hog = vl_hog(imgs, cellSize, 'verbose') ;
imhog = vl_hog('render', hog, 'verbose') ;
clf ; imagesc(imhog) ; colormap gray ;

 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% use vl_sift to extract the sift feature.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[f,d] = vl_sift(imgs) ;
perm = randperm(size(f,2)) ;
sel = perm(1:50) ;
h1 = vl_plotframe(f(:,sel)) ;
h2 = vl_plotframe(f(:,sel)) ;
set(h1,'color','k','linewidth',3) ;
set(h2,'color','y','linewidth',2) ;

 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% use vl_mser to extact the mser feature.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I = uint8(rgb2gray(image)) ;
[r,f] = vl_mser(I,'MinDiversity',0.7,...
'MaxVariation',0.2,...
'Delta',10) ;
f = vl_ertr(f) ;
vl_plotframe(f) ;
M = zeros(size(I)) ;
for x=r'
s = vl_erfill(I,x) ;
M(s) = M(s) + 1;
end
figure(2) ;
clf ; imagesc(I) ; hold on ; axis equal off; colormap gray ;
[c,h]=contour(M,(0:max(M(:)))+.5) ;
set(h,'color','y','linewidth',3) ;

 

 

 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% use vl_quickseg to execute Quick shift.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I = uint8(rgb2gray(image));

ratio = 0.5;
kernelsize = 2;
maxdist = 50;
ndists = 10;
Iseg = vl_quickseg(I, ratio, kernelsize, maxdist);
Iedge = vl_quickvis(I, ratio, kernelsize, maxdist, ndists) ;
imagesc(Iedge);
axis equal off tight;
colormap gray;
end

 

 

  

 

 

 

 

 

 

 

 

 

 

 

转载地址:http://wohoa.baihongyu.com/

你可能感兴趣的文章
[转]POI大数据量Excel解决方案
查看>>
python 启航
查看>>
5. RAMN备份与恢复
查看>>
(转)android:gravity和android:layout_gravity区别
查看>>
数学定理可以这样证明
查看>>
【转】【支付 . 技术控】最全最强解析:支付宝系统架构内部剖析(架构图)...
查看>>
MVC2 Area实现网站多级目录
查看>>
nacos作为配置中心
查看>>
OSX.PackageManager-Homebrew
查看>>
LeetCode:Merge k Sorted Lists
查看>>
20171017数据处理sql
查看>>
fiddler抓包HTTPS配置及代理设置
查看>>
for循环枚举法,全排列+dfs,补充浮点数注意事项
查看>>
位与十进制表
查看>>
计算属性传参
查看>>
打造无DLL版穿透防火墙Downloader
查看>>
maven 多bundle项目
查看>>
单链表
查看>>
枚举类型成员方法
查看>>
我的集合学习笔记--ArrayList
查看>>