Posts

Showing posts from January 13, 2013

Double The Size of an Image using Bi-linear Interpolation

Image
%================== Program to double the size of an Image ===================% A=imread('pic1.tif'); [M N]=size(A); B=uint8(zeros(2*M,2*N)); for i=1:M     for j=1:N         B(2*i-1,2*j-1)=A(i,j);         B(2*i,2*j-1)=A(i,j);         B(2*i-1,2*j)=A(i,j);         B(2*i,2*j)=A(i,j);     end end C=B; [M N]=size(B); mask=[0, 1, 0;1, 0, 1;0, 1, 0;]; const_mat=zeros(1,4); for i=1:M     for j=1:N         mat=zeros(1,4);         S=zeros(4,4);         m=1;         for x=1:3             for y=1:3                 if(((i+x-2)<M &&(j+y-2)<N)&&((i+x-2)>0 && (j+y-2)>0))                     if(mask(x,y))         ...

8 Bit Plane Slicing of an image in Image Processing

Image
%================ Bit Plane Slicing Program =================% A=imread('bit_plane_img.tif'); subplot(3,3,1),imshow(A),title('INPUT IMAGE'); for i=1:8     B=bitplaneslicing(A,i);     subplot(3,3,i+1),imshow(B),title(i); end %====================================================% %================ Bit Plane Slicing Function =================% function [ B ] = bitplaneslicing( A ,n) % function for n bit plane slicing where n<=8 [M,N]=size(A); B=zeros(M,N); for i = 1:M     for j = 1:N         str=dec2bin(A(i,j),8);         if strcmp(str(9-n),'0')             B(i,j)=0;         else             B(i,j)=2^(n-1);         end     end end end %====================================================% Input Image: bit_plane_img.tif Output Image: