0
나는 선택한 색상을 제외한 모든 색상을 제거하는 someones 코드를 연구하고 있습니다. 코드 샘플에서 다음 줄을 교체 경우 검은 색 모든 페인트하려고합니다 빨간색 eccept이미지 처리를위한 필터가 적용되지 않았습니다
nonRedIndex = (hPlane> 20) & (hPlane < 340);
그러나 다른 diaposons는 작동하지 않는다는 것을 발견했습니다. 왠지 말해줘?
cdata = imread(path);
hsvImage1 = rgb2hsv(cdata); %# Convert the image to HSV space
hPlane = 360.*hsvImage1(:,:,1); %# Get the hue plane scaled from 0 to 360
sPlane = hsvImage1(:,:,2); %# Get the saturation plane
lPlane = hsvImage1(:,:,3);
nonRedIndex = (hPlane > 140) & ... %# Select "non-red" pixels
(hPlane < 120);
sPlane(nonRedIndex) = 0; %# Set the selected pixel saturations to 0
lPlane(nonRedIndex) = 0;
hsvImage1(:,:,2) = sPlane; %# Update the saturation plane
hsvImage1(:,:,3) = lPlane;
rgbImage1 = hsv2rgb(hsvImage1);
을 그가있는 경우 typo이지만 140보다 크고 동시에 120보다 작은 픽셀을 얻으려고합니다. 이것은 문제가 될 수 있습니다. –
오타되었습니다. 감사합니다.) 답변자로 게시 할 수 있습니다. – Yarh