theta = 0 : 0.01 : 2*pi;radius = 45;I = imread('Image3.jpg');NoseDetect = vision.CascadeObjectDetector('Nose','MergeThreshold',30);HSV=rgb2hsv(I);imshow(HSV); hold onnbox = step(NoseDetect, I); nx = nbox(1) + nbox(3)/2; ny = nbox(2) + nbox(4)/2; final_x = nx - 145;final_y = ny - 25;X = radius * cos(theta) + final_x;Y = radius * sin(theta) + final_y;plot(X, Y, 'b-', 'LineWidth', 1);hueImage = HSV(:,:,1);satImage = HSV(:,:,2);valueImage = HSV(:,:,3);[rows, columns] = size(hueImage);mask = poly2mask(X, Y, rows, columns);hueImage(mask) = hueImage(mask) + 1 / 360 * 355;satImage(mask) = satImage(mask) + 0.01 * 1;valueImage(mask) = valueImage(mask) + 0.01 * 5;hueImage(hueImage>1)=1; hueImage(hueImage<0)=0;satImage(satImage>1)=1; satImage(satImage<0)=0;valueImage(valueImage>1)=1; valueImage(valueImage<0)=0;HSV(:,:,1) = hueImage;HSV(:,:,2) = satImage;HSV(:,:,3) = valueImage;final_x = nx + 145;final_y = ny - 25;X2 = radius * cos(theta) + final_x;Y2 = radius * sin(theta) + final_y;plot(X2, Y2, 'b-', 'LineWidth', 1);hueImage = HSV(:,:,1);satImage = HSV(:,:,2);valueImage = HSV(:,:,3);[rows, columns] = size(hueImage);mask = poly2mask(X2, Y2, rows, columns);hueImage(mask) = hueImage(mask) + 1 / 360 * 355 ;satImage(mask) = satImage(mask) + 0.01 * 1;valueImage(mask) = valueImage(mask) + 0.01 * 5;hueImage(hueImage>1)=1; hueImage(hueImage<0)=0;satImage(satImage>1)=1; satImage(satImage<0)=0;valueImage(valueImage>1)=1; valueImage(valueImage<0)=0;HSV(:,:,1) = hueImage;HSV(:,:,2) = satImage;HSV(:,:,3) = valueImage;newRGBImage = hsv2rgb(HSV);imshow(newRGBImage);
MATLAB: How to make the applied color look more natural/blend into the skin
faceImage Processing Toolboximage/color processingrosy cheeks
Best Answer