I was wondering if there is any way to crop an Image into a circular image I am using the mask function but i need it to be circular not just masked. This is my code I know i need some more work done but i need to figure this part first.
canvas=255*ones(3000,3000,3,'uint8');A=imread('A.jpg');F=imread('F.jpg');C=imread('C.png');E=imread('E.jpg');A=A(:,200:1720,:);C=C(9:1500,93:3093,:);E=imresize(E,4);I = E;imageSize = size(I);ci = [455, 450, 350]; % center and radius of circle ([c_row, c_col, r])
[xx,yy] = ndgrid((1:imageSize(1))-ci(1),(1:imageSize(2))-ci(2));mask = uint8((xx.^2 + yy.^2)<ci(3)^2);croppedImage = uint8(zeros(size(I)));croppedImage(:,:,1) = I(:,:,1).*mask;croppedImage(:,:,2) = I(:,:,2).*mask;croppedImage(:,:,3) = I(:,:,3).*mask;canvas(1:1080,1:1521,:)=A;canvas(1510:3001,1:3001,:)=C;canvas(1:720,1720:2999,:)=F;canvas(900:1799,1050:1949,:)=croppedImage;imshow(canvas)
Best Answer