Matlab影像處理(三)膚色偵測
%%膚色偵測
close all; clear; clc;
img = double(imread('img.jpg'));
[row, col] = size(img(:, :, 1));
outputimg = zeros(row, col);
for i=1:row
for j=1:col
if img(i, j, 1)>img(i, j, 2) & img(i, j, 2)>img(i, j, 3) & img(i, j, 1)-img(i, j, 2)>=5
outputimg(i, j) = 255;
end
end
end
subplot(1, 2, 1), imshow(uint8(img)), title('原圖')
subplot(1, 2, 2), imshow(uint8(outputimg)), title('處理後圖')
留言
張貼留言