Untitled
unknown
plain_text
13 days ago
1.1 kB
8
Indexable
Never
rgbImage = imread('your_image.png'); R = double(rgbImage(:,:,1)); G = double(rgbImage(:,:,2)); B = double(rgbImage(:,:,3)); + grayImage = 0.299 * R + 0.587 * G + 0.114 * B; grayImage = uint8(grayImage); imshow(grayImage); imwrite(grayImage, 'grayscale_image.png'); ------------------------------------------------------ j=imread("original"); jg = j(:,:,2); figure, imshow(jg); jr = j(:,:,1); figure, imshow(jr); jb = j(:,:,3); figure, imshow(jb); figure, imshow(jr); figure, imshow(jg) figure, imshow(jb); figure,subplot(2,2,1), title("original"),imshow(j); subplot(2,2,2), title("red"),imshow(jr); subplot(2,2,3), title("red"),imshow(jg); figure,subplot(2,2,4), title("blue"),imshow(jb); --------------------------------------------------------- I=imread("peppers.png"); [m,n,c]=size(I); J=zeros(m,n); j1=zeros(m,n); for i=1:m for j=1:n j(i,j)=(i(i,j,1)+I(i,j,2)+i(i,j,3))/3; j1(i,j)=(0.29*1(i,j,1)+0.587*i(i,j,2)+0.1141*i(i,j,3))/3; end; end; figure, imshow(j,[]); -------------------------------------------------------------
Leave a Comment