clc;clear all;close all hidden;
[file,path]=uigetfile('*.bmp;*.jpg','Pick an Image File');
if isequal(file,0) isequal(path,0) warndlg('User Pressed Cancel'); else Host_im=imread(file);
[r c p] = size(Host_im); if p==3 Host_im = rgb2gray(Host_im); endfigure(1);imshow(Host_im);title('Input Image');end X = inputdlg('Enter Value from 0 to 5'); L = str2num(X{1}); P = 2^L; H = Host_im; figure(2); imhist(Host_im); title('Histogram of Input Image(Fused Image)'); xlabel('Pixel value'); ylabel('No of pixels'); %%%%%%%%Histogram Shifting
location1 = find(Host_im<P); location2 = find(Host_im>(255-P)); H(location1)=H(location1)+P; H(location2)=H(location2)-P; figure(3); imshow(H,[]); title('Image of Histogram Shifted Image'); figure(4); imhist(H); title('Histogram of Histogram Shifted Image'); xlabel('Pixel value'); ylabel('No of pixels'); %%%%%%To find pixel difference
Host_im = double(Host_im);
Row = r; Col = c; k =1; for i = 1:Row im_val = Host_im(i,:); if mod(i,2)==0 %%%%%%%%%%checkreminder
d(k:i*Col,:) = im_val(end:-1:1)'; else d(k:i*Col,:) = im_val(1:1:end)'; end k = i*Col + 1; end Diff(1) = d(1); Diff(2:length(d)) = abs(d(1:length(d)-1) - d(2:length(d)));
x = d; len = length(Diff); Row = r; Col =c; k =1; for i = 1:Row if mod(i,2)==0 star_p = Col; mid_p = -1; end_p = 1; else star_p = 1; mid_p = 1; end_p = Col; end for j = star_p:mid_p:end_p nw(i,j) = Diff(k); k = k+1; end end location14 = find(nw<P); location15 = find(nw>(255-P));
nw(location14)=nw(location14)+P; nw(location15)=nw(location15)-P;
figure(35); imshow(nw,[]); title('Image of difference Histogram Shifted Image'); figure(45); imhist(nw); [counts x]=imhist(nw) title('Histogram of difference Histogram Shifted Image'); xlabel('Pixel value'); ylabel('No of pixels');
Best Answer