# MATLAB Commands Used to Create the Plots

## 1. Photographic Negative

These are the series of commands that were used to plot the photographic negative:

• a=[1 2 3 4 5 6 7 8 9 10]
• a2=[0 a./10]
• neg=imcomplement(a2)
• plot(a2,neg)
• xlabel('a=[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]')
• ylabel('imcomplement(a)')
• title('Plot of Photographic Negative','FontSize',12)

## 2. Gamma Transformations

These are the series of commands that were used to plot the gamma transformations:

• a=[1 2 3 4 5 6 7 8 9 10]
• a2=[0 a./10]
• a3=[0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 a2(2:10)]
• gamma1=imadjust(a3, [], [], 1)
• gamma2=imadjust(a3, [], [], 3)
• gamma3=imadjust(a3, [], [], 0.4)
• plot(a3,gamma1,a3,gamma2,a3,gamma3)
• xlabel('a=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]')
• legend('gamma1=imadjust(a, [], [], 1)','gamma2=imadjust(a, [], [], 3)','gamma3=imadjust(a, [], [], 0.4)','Location','Best')
• title('Plot of Gamma Transformations with Varying gamma','FontSize',12)

## 3. Logarithmic Transformations

These are the series of commands that were used to plot the logarithmic transformations:

• a=[1 2 3 4 5 6 7 8 9 10]
• a2=[0 a./10]
• log1=1*log(1+a2)
• log2=2*log(1+a2)
• for i=1:11   % to clip to 1
if log2(i)>1
log2(i)=1
end
end
• log3=5*log(1+a2)
• for i=1:11   % to clip to 1
if log3(i)>1
log3(i)=1
end
end
• plot(a2,log1,a2,log2,a2,log3)
• legend('log1=1*log(1+a)','log2=2*log(1+a)','log3=5*log(1+a)','Location','Best')
• title('Plot of Logarithm Transformations, Changing c','FontSize', 12)
• xlabel('a=[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]')
• ylabel('c*log(1+a)')

## 4. Contrast-Stretching Transformations

These are the series of commands that were used to plot the contrast-stretching transformations with varying E:

• a=[1 2 3 4 5 6 7 8 9 10]
• a2=[0 a./10]
• contrast1=1./(1+(0.5./(a2 + eps)).^4)
• contrast2=1./(1+(0.5./(a2 + eps)).^5)
• contrast3=1./(1+(0.5./(a2 + eps)).^10)
• plot(a2,contrast1,a2,contrast2,a2,contrast3)
• legend('contrast1=1./(1+(0.5./(a + eps)).^4)','contrast2=1./(1+(0.5./(a + eps)).^5)','contrast3=1./(1+(0.5./(a + eps)).^1^0)','Location','SouthEast')
• xlabel('a=[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]')
• ylabel('1./(1+(0.5./(a + eps)).^E)')
• title('Plot of Contrast-Stretching Transformations, Changing E','FontSize',12)
• set(gca,'XTick',0:0.1:1)
• set(gca,'YTick',0:0.1:1)
• Then, manually adjust size by clicking on the arrow in the toolbar when viewing the plot

These are the series of commands that were used to plot the contrast-stretching transformations with varying m:

• a=[1 2 3 4 5 6 7 8 9 10]
• a2=[0 a./10]
• contrast1=1./(1+(0.2./(a2 + eps)).^4)
• contrast2=1./(1+(0.5./(a2 + eps)).^4)
• contrast3=1./(1+(0.7./(a2+ eps)).^4)
• plot(a2,contrast1,a2,contrast2,a2,contrast3)
• xlabel('a=[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]')
• ylabel('1./(1+(m./(a + eps)).^4)')
• title('Plot of Contrast-Stretching Transformations, Changing m','FontSize',12)
• legend('contrast1=1./(1+(0.2./(a + eps)).^4)','contrast2=1./(1+(0.5./(a + eps)).^4)','contrast3=1./(1+(0.7./(a + eps)).^4)','Location','Best')
• set(gca,'XTick',0:0.1:1)
• set(gca,'YTick',0:0.1:1)