Which variable stores contour image ?
古いコメントを表示

close all;
clear all;
clc;
%Read the image, and capture the dimensions
img_orig = imread('C:\Users\Explorer\Documents\MATLAB\ASL_signs\A.jpg');
% % Create axes control.
% handleToAxes = axes();
% % Get the handle to the image in the axes.
% hImage = image(zeros(480,640,'uint8'));
% % Reset image magnification. Required if you ever displayed an image
% % in the axes that was not the same size as your webcam image.
% hold off;
% axis auto;
% axis on;
% % Enlarge figure to full screen.
% set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% annotation('textbox', [.2 .7 .3 .1],...
% 'String', 'Press Space Bar after placing your Hand in Bounding Box');
% % Turn on the live video.
% videoObject = videoinput('winvideo');
% preview(videoObject, hImage);
% hold on
% thisBB = [150 150 350 400]
% rect= rectangle('Position', [thisBB(1),thisBB(2),thisBB(3),thisBB(4)],
'EdgeColor','g','LineWidth',2 )
% pause
% snap=getsnapshot(videoObject);
%
% stoppreview(videoObject)
% close all;
%
% cropped=imcrop(snap, thisBB)
% imshow(cropped)
%
%
% img_orig=cropped;
height = size(img_orig,1);
width = size(img_orig,2);
%Initialize the output images
out = img_orig;
bin = zeros(height,width);
%Convert the image from RGB to YCbCr
img_ycbcr = rgb2ycbcr(img_orig);
Cb = img_ycbcr(:,:,2);
Cr = img_ycbcr(:,:,3);
%Detect Skin
[r,c,v] = find(Cb>=77 & Cb<=127 & Cr>=133 & Cr<=173);
numind = size(r,1);
%Mark Skin Pixels
for i=1:numind
out(r(i),c(i),:) = [0 0 255];
bin(r(i),c(i)) = 1;
end
imshow(img_orig);
figure; imshow(out);
figure; imshow(bin);
%%Erode noise%%
imerode = imerode(bin, strel('square', 3));
figure,imshow(imerode);
%%Fill in holes to get fully connected skin regions%%
I = imfill(imerode, 'holes');
figure,imshow(I);
% imfill=~imfill;
% figure,imshow(imfill);
%
% Active Contour by chan-vase
m = zeros(size(I,1),size(I,2));
m(50:200,50:200) = 1;
seg = chenvese(I,m,1000,0.2,'chan'); % ability on gray image
% Built-in Mask
seg = chenvese(I,'medium',3000,0.02,'chan'); % ability on gray image
%-- End
採用された回答
その他の回答 (1 件)
Walter Roberson
2014 年 2 月 7 日
0 投票
None of the code you show produces that plot. The plot is likely put up within the showphi() routine that you did not provide source for. The key inputs to that routine appear to be I and phi0 within the chenverse routine, provided that the 'chan' or 'vector' options are given to it (you provide 'chan'). The phi0 variable is then returned from chenvese, where it becomes your variable "seg"
3 件のコメント
Explorer
2014 年 2 月 9 日
Walter Roberson
2014 年 2 月 10 日
There is no variable in the code that stores the image you have circled. The image you have circled is made by displaying the image, then "hold on", then using contour() of the value returned as "seg" from chenverse, using [0 0] as the contour level set. The same contour is drawn twice with two different colors and two different line widths - red in linewidth 4, green in linewidth 1.3.
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!