Untitled
unknown
plain_text
6 months ago
2.1 kB
4
Indexable
Gamma using log I= imread ("cameraman.tif"); Id= double (I); [m, c] =size(Id); J= zeros (size (Id)); for i 1:m for j= 1:c J (i,j) = log (Id (i,j) + 1); end; end; figure; subplot (1,2,1); imshow (I,[]); subplot (1, 2,2); imshow (J, []); Gamma using power I=imread ("cameraman.tif"); Id-double (I); [m, c] = size (Id); J= zeros (size (Id)); for i 1:m for j 1: c I(i, j) power (Id (i,j)+1,2); end; end; figure; subplot (1,2,1); imshow(I,[]); subplot (1,2,2), imshow(I,[]); intensity level slicing I=imread("cameraman.tif"); Id = 1 double(I); [m, c]= size(Id); J= zeros(size(Id)); for i = 1:m for j = 1:c if ( I(i, j) > 100 && J(i, j) < 150 ) J(i, j) = 255; else J(i,j)= I(i,j); end end end figure; subplot(1,2,1); imshow(I); subplot(1,2,2); imshow(uint8(J)); Thresholding I = imread('cameraman.tif'); I = double(I); threshold = 100; J = zeros(size(I)); J(I > threshold) = 255; figure; subplot(1, 2, 1); imshow(uint8(I)); title('Original Image'); subplot(1, 2, 2); imshow(uint8(J)); title('Thresholded Image'); Smoothing I= imread('peppers.png'); if size(I , 3) == 3 I = rgb2gray(I); end [m, n] = size(I); %blank image J = zeros(m, n); %defining simple average mask kernel_size = 7; pad_size = floor(kernel_size / 2); kernel=(1/(kernel_size*kernel_size))*ones(kernel_size,kernel_size); padded_img = padarray(I, [pad_size pad_size], 0, 'both'); %correlation for i = 1:m for j = 1:n neighborhood = padded_img(i:i+kernel_size-1, j:j+kernel_size-1); % smoothed_value = sum(neighborhood(:)) / 9; sum=0; for k=1:kernel_size for l=1:kernel_size corrI=kernel(k,l)*neighborhood(k,l); sum=sum+corrI; end; end; %output_image=new value J(i, j) = sum; end; end; J = uint8(J); figure,subplot(1, 2, 1), imshow(I), title('Original Image'); subplot(1, 2, 2), imshow(J), title('Smoothed Image',[]); Histogram equilization
Editor is loading...
Leave a Comment