My theory is that I can use edge detection in order to find objects within an image and then automatically paint those areas with their dominant colour. The first scale of my question is, how do I make the system choose the selected areas as different objects and then how do I colour them? The following is my code so far:
%read the picture
I = imread('bath.jpeg');figure, imshow(I);%turn the image in grayscale
%for two dimensional covertion
%to apply edge detection
J = rgb2gray(I); threshold = graythresh(J);figure, imshow(J);%apply edge detection
ED = edge(J,'canny');figure, imshow(ED);OV=I;OV1=I(:,:,1);OV2=I(:,:,2);OV3=I(:,:,3);OV1(ED)=0;OV2(ED)=255;OV3(ED)=0;OV(:,:,1)=OV1;OV(:,:,2)=OV2;OV(:,:,3)=OV3;figure, imshow(OV);
So far the code is giving an image with a green edge detection overlay.
Best Answer