亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? graphcuts_demo.m

?? Graph cut segmentationis is segment an image into two classes based on color.
?? M
字號:
% GRAPHCUTS_DEMO --- GraphCut segmentation example
% CMP Vision Algorithms http://visionbook.felk.cvut.cz
%
% Example
% 
% We shall segment an image (Figure ??a) into two
% classes (the cat and the rest of the image) based on
% color. The first step is to create color prototypes for both classes.
% We use k-means clustering to do this automatically. Note that the
% image data first need to be reshaped to one row per pixel.
% Note also that since the k-means initialization is random, the final class
% labels are also assigned randomly. However, it is usually not
% difficult to identify the foreground class label, if necessary.
% We obtain the prototypes (clusters) in c and the induced
% segmentation in l0 (Figure ??b).


ImageDir='images/';%directory containing the images
addpath('..') ;
cmpviapath('..') ;

if exist('GraphCut')~=2 || exist('GraphCutMex')~=3 || ...
      exist('GraphCutConstr')~=3 ,
  disp('ERROR: It appears that the GraphCut Matlab wrapper is not installed.');
  disp('Please install it from ') ;
  disp('         http://www.wisdom.weizmann.ac.il/~bagon/matlab.html') ;
  disp('to directory ../matlab_code/graphcut.') ;
  error([ 'GraphCut wrapper not installed.'])
end ;



img = im2double( imread([ImageDir 'cat.jpg']) );
[ny,nx,nc] = size(img);
d = reshape( img, ny*nx, nc ); 
k = 2; % number of clusters
[l0 c] = kmeans( d, k );
l0 = reshape( l0, ny, nx );

figure(1) ; imagesc(img) ; axis image ;  axis off ;
exportfig(gcf,'output_images/graphcut_input1.eps') ;

figure(2) ; imagesc(l0) ; axis image ;  axis off ;
exportfig(gcf,'output_images/graphcut_kmeans.eps') ;

% For each class, the data term Dc measures the distance of
% each pixel value to the class prototype. For simplicity, standard
% Euclidean distance is used. Mahalanobis distance (weighted by class
% covariances) might improve the results in some cases.  Note that the
% image intensity values are in the [0,1] interval, which provides
% normalization.  

Dc = zeros( ny, nx, k );
for i = 1:k
  dif = d - repmat( c(i,:), ny*nx,1 );
  Dc(:,:,i) = reshape( sum(dif.^2,2), ny, nx );
end

% The smoothness term Sc(i,j) is a matrix of costs associated
% with neighboring pixels having values i, j. We define the cost to
% be zero if i=j and a constant (2) otherwise. Increasing this
% constant strengthens the neighborhood constraints more and makes the
% segments larger (and vice versa).  

Sc = 2 * ( ones(k)-eye(k) );

% The graph cut problem is initialized by calling
% GraphCut('open',...) which returns a handle.
% GraphCut('expand',handle) performs the actual optimization and
% returns the labeling l (note that the class labels start with
% 0, unlike for kmeans). The optimization takes only a few
% seconds, depending on the parameter setting and image size. Finally,
% GraphCut('close') takes care of releasing the memory.  The
% segmentation results can be seen in
% Figure ??c,d. Note that while the segmentation
% result is not perfect, it is very good for a completely unsupervised
% algorithm. The algorithm successfully fills in the fence wires present
% in the k-means segmentation.  

handle  = GraphCut( 'open', Dc, Sc );
[gch l] = GraphCut( 'expand', handle );
handle  = GraphCut( 'close', handle );

lb=imdilate(l,strel('disk',4))-l ; 

figure(3) ; image(img) ; axis image ;  axis off ;hold on ;
contour(lb,[1 1],'r','LineWidth',2) ; hold off ;
exportfig(gcf,'output_images/graphcut_output1.eps') ;

figure(4) ; imagesc(l) ; axis image;  axis off ;
exportfig(gcf,'output_images/graphcut_segm1.eps') ;


% 
% Our second example (Figure ??a) turns out to be
% more difficult due to non-uniform illumination and background. We
% proceed as before (after reducing the image to a convenient size
% 432x 288 pixels), except that we first convert the  image into
% the L*a*b color space, using only the a,b
% components for clustering and evaluating the data cost. Note that the
% a,b components are normalized to simplify relative weighting
% of the cost terms.  We ask the k-means algorithm for four clusters
% to capture the variability of the background. 

img = im2double( imresize(imread([ImageDir 'rhino2.jpg']), 0.125) );
[ny,nx,nc] = size(img);
imgc = applycform( img, makecform('srgb2lab') );
d = reshape( imgc(:,:,2:3), ny*nx, 2 );
d(:,1) = d(:,1)/max(d(:,1));   d(:,2) = d(:,2)/max(d(:,2));
k = 4; % number of clusters
[l0 c] = kmeans( d, k );
l0 = reshape( l0, ny, nx );

figure(1) ; imagesc(img) ; axis image ;  axis off ;
exportfig(gcf,'output_images/graphcut_input2.eps') ;

figure(2) ; imagesc(l0) ; axis image ;  axis off ;
exportfig(gcf,'output_images/graphcut_kmeans2.eps') ;


% The data and smoothness terms Dc and Sc are calculated 
% as before.

Dc = zeros( ny, nx, k );
for i = 1:k
  dif = d - repmat( c(i,:), ny*nx, 1 );
  Dc(:,:,i) = reshape( sum(dif.^2,2), ny, nx );
end
Sc = ones(k) - eye(k);

%
% The data and smoothness terms by themselves provide a good
% segmentation (Figure ??b,e). However, the
% results can be further improved if edge information is also taken
% into account, to encourage pixel label changes across edges and
% discourage them otherwise. We obtain the edge information (separately
% for horizontal and vertical directions) by applying a smoothed Sobel
% filter. We take a maximum over all three color channels and apply an
% exponential transformation on the result. The horizontal and vertical
% costs are then passed to GraphCut('open') as additional
% parameters.

g  = fspecial( 'gauss', [13 13], 2 );
dy = fspecial( 'sobel' );
vf = conv2( g, dy, 'valid' );

Vc = zeros( ny, nx );
Hc = Vc;

for b = 1:nc
  Vc = max( Vc, abs(imfilter(img(:,:,b), vf , 'symmetric')) );
  Hc = max( Hc, abs(imfilter(img(:,:,b), vf', 'symmetric')) );
end


gch=GraphCut( 'open', 1*Dc, Sc ); % ,exp(-5*Vc),exp(-5*Hc));
[gch l]=GraphCut('expand',gch);
gch=GraphCut('close', gch);

label=l(100,200) ;
lb=(l==label) ;
lb=imdilate(lb,strel('disk',1))-lb ; 

figure(3) ; image(img) ; axis image ; axis off ; hold on ;
contour(lb,[1 1],'r','LineWidth',2) ; hold off ; 
exportfig(gcf,'output_images/graphcut_output2.eps') ;


figure(4) ; imagesc(l) ; axis image ; axis off
exportfig(gcf,'output_images/graphcut_segm2.eps') ;


gch = GraphCut( 'open', Dc, 5*Sc,exp(-10*Vc), exp(-10*Hc) );
[gch l] = GraphCut( 'expand', gch );
gch = GraphCut( 'close', gch );

lb=(l==label) ;
lb=imdilate(lb,strel('disk',1))-lb ; 

figure(5) ; image(img) ; axis image ; axis off ; hold on ;
contour(lb,[1 1],'r','LineWidth',2) ; hold off ; 
exportfig(gcf,'output_images/graphcut_outputedge2.eps') ;


figure(6) ; imagesc(l) ; axis image ; axis off
exportfig(gcf,'output_images/graphcut_segmedge2.eps') ;

% Results are shown in Figure ??. Note that the
% edge information  improves the segmentation of the horn and of the
% legs of the animal slightly.
% 
% Graph cut segmentation is a very versatile and powerful segmentation
% tool. Its main advantage is the global optimality of the results
% together with a reasonable speed. However, some experimentation with
% cost terms appropriate for a particular task is usually required.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩小说| 蜜桃视频在线观看一区二区| 亚洲一级电影视频| 日本亚洲三级在线| 成人黄色小视频| 欧美日韩成人在线一区| 欧美国产精品一区| 青娱乐精品视频| 99久久精品国产一区二区三区 | 91精品国产综合久久精品app| 精品国产污网站| 亚洲日本乱码在线观看| 国内不卡的二区三区中文字幕| 色老汉av一区二区三区| 久久亚洲精品国产精品紫薇| 日日摸夜夜添夜夜添亚洲女人| 大陆成人av片| 久久青草欧美一区二区三区| 亚洲123区在线观看| 色中色一区二区| 欧美国产成人精品| 高清国产一区二区| 精品免费国产二区三区| 三级欧美在线一区| 欧美三级蜜桃2在线观看| √…a在线天堂一区| 成人国产精品免费观看动漫| 精品久久久久久久久久久院品网| 亚洲成av人片www| 91国模大尺度私拍在线视频| 亚洲人成在线观看一区二区| 成人午夜碰碰视频| 亚洲国产一区二区三区| 91在线观看地址| 中文字幕在线观看一区| 不卡的av中国片| 国产精品久久久久一区二区三区共 | 欧美福利电影网| 亚洲综合成人在线| 欧美最猛性xxxxx直播| 亚洲精品写真福利| 色8久久精品久久久久久蜜| 亚洲欧美日韩在线播放| 在线亚洲精品福利网址导航| 亚洲免费三区一区二区| 91浏览器在线视频| 亚洲成av人片在www色猫咪| 欧美日产国产精品| 免费在线观看日韩欧美| 日韩欧美激情在线| 国产一区二区调教| 国产欧美一区二区三区网站| 成人一区二区三区视频| 亚洲天堂福利av| 欧美视频中文一区二区三区在线观看| 99re这里都是精品| 一区二区三区国产精品| 欧美无砖专区一中文字| 免费人成在线不卡| 久久亚洲春色中文字幕久久久| 成人午夜激情片| 亚洲色图19p| 欧美精品免费视频| 国产伦精品一区二区三区免费迷| 日本一二三不卡| 色播五月激情综合网| 久久99国产精品尤物| 中文字幕中文字幕在线一区 | av在线综合网| 亚洲线精品一区二区三区| 这里只有精品免费| 成人av综合在线| 亚洲国产视频a| 久久久久久久久免费| 日本高清无吗v一区| 狠狠色丁香久久婷婷综合_中| 亚洲视频中文字幕| 欧美变态tickling挠脚心| 成a人片国产精品| 奇米精品一区二区三区四区| 中文字幕的久久| 欧美一级免费大片| 99九九99九九九视频精品| 麻豆精品一区二区| 亚洲色图一区二区三区| 日韩精品一区二区三区视频在线观看| 成人黄色电影在线| 美国毛片一区二区三区| 亚洲精品国产视频| 中文字幕巨乱亚洲| 精品国产电影一区二区| 欧美视频一区二区在线观看| 国产91精品精华液一区二区三区| 天天色天天爱天天射综合| 中文字幕一区二区三区四区不卡 | 色综合久久久久久久| 激情五月激情综合网| 亚洲一区二区三区四区五区黄 | 国产精品系列在线播放| 香港成人在线视频| 自拍偷拍亚洲综合| 国产农村妇女精品| 2020国产精品| 6080yy午夜一二三区久久| 91久久精品日日躁夜夜躁欧美| 国产精品一区二区久久不卡| 日韩av在线免费观看不卡| 亚洲最新在线观看| 亚洲人成网站精品片在线观看| 国产三级一区二区三区| 日韩精品一区二区三区四区视频| 欧美专区亚洲专区| 在线欧美日韩精品| 97se狠狠狠综合亚洲狠狠| 成人手机电影网| 国产成人精品免费一区二区| 韩国午夜理伦三级不卡影院| 久久av中文字幕片| 九九视频精品免费| 蜜臀av性久久久久蜜臀aⅴ| 男女男精品视频| 精品一区二区三区蜜桃| 国产美女一区二区三区| 国产在线精品一区二区三区不卡 | 欧美高清www午色夜在线视频| 欧美日韩精品一区二区| 欧美性猛片aaaaaaa做受| 欧美日韩激情一区二区| 69堂国产成人免费视频| 日韩亚洲电影在线| 日韩女优毛片在线| 久久久久久久久久美女| 中文字幕欧美区| 亚洲人成小说网站色在线| 亚洲高清视频中文字幕| 日韩精品乱码av一区二区| 蜜臀av一级做a爰片久久| 国内精品国产成人| 99热精品一区二区| 欧美最猛黑人xxxxx猛交| 这里是久久伊人| 欧美成人伊人久久综合网| 久久精子c满五个校花| 日韩毛片在线免费观看| 亚洲国产精品久久一线不卡| 日韩国产精品91| 国产在线精品一区二区夜色 | 国产精品麻豆网站| 亚洲国产婷婷综合在线精品| 免费美女久久99| 国产91在线|亚洲| 91亚洲大成网污www| 在线播放中文字幕一区| 亚洲国产激情av| 亚洲最新视频在线播放| 美女网站在线免费欧美精品| 成人免费高清在线观看| 欧美日韩夫妻久久| 欧美激情在线看| 天天综合网天天综合色| 成人一二三区视频| 欧美日韩一区二区在线观看| 国产日韩精品久久久| 日韩精品一卡二卡三卡四卡无卡| 国产老妇另类xxxxx| 欧美主播一区二区三区美女| 精品国偷自产国产一区| 一区二区三区四区视频精品免费 | 2019国产精品| 亚洲精品亚洲人成人网| 国产麻豆精品theporn| 欧美视频一区二区三区在线观看| 久久久www成人免费无遮挡大片| 一区二区成人在线观看| 国产成人免费在线观看| 日韩欧美色综合| 午夜精品视频在线观看| 福利一区二区在线| 日韩美女主播在线视频一区二区三区| 最新国产の精品合集bt伙计| 国产一区二区三区精品视频| 欧美三级三级三级| 亚洲人成网站影音先锋播放| 国产精品一区二区久久不卡| 日韩午夜激情视频| 亚洲一区二区在线观看视频| voyeur盗摄精品| 欧美精品一区二区三区蜜桃| 午夜久久福利影院| 在线观看不卡视频| 自拍偷拍欧美激情| 成人晚上爱看视频| 国产欧美日韩在线观看| 久久成人免费网| 欧美电影免费观看高清完整版| 亚洲午夜一区二区三区| 色综合激情久久| 亚洲精品一二三| 91福利社在线观看| 一区二区三区欧美|