SlideShare a Scribd company logo
Image Processing
Homework #1
Joshua Smith
Smith
2
Objectives
Using the histogram techniques discussed in class, search the image provided to recover the
hidden message. Utilize histogram equalization to adjust the intensity values for the given image
to create a new image that shows the hidden message.
Equipment and Materials
Time
Matlab
Files from Dr. Gleb
Smith
3
Methods
A message is hidden in this image.
The histogram for this image is shown below.
This graph shows the color intensities verses the bit counts for the original image.
Using this image and histogram I created multiple m-files in Matlab which implemented the
formula
𝑠 𝑘 = 𝑇( 𝑟 𝑘) =
(𝐿 − 1)
𝑀𝑁
∑ 𝑛𝑗 𝑤ℎ𝑒𝑟𝑒 𝑘 = 0,1,2, … , 𝐿 − 1
𝑘
𝑗=0
Smith
4
to create a map for transforming the image. The transformed image would allow us to read the
hidden message.
Results
For this project I wrote multiple m-files to transform the given image. My first attempt was a
global histogram transformation.
clear all
closeall
A = imread('image01.bmp')
% Load the image into the matrix A
[Counts,X]=imhist(A);
% Gathers data about the intensity values in the image
for k=1:1:256
% Loop that builds thehistogramvalues for the new image
if k == 1
s(k) = ((255)/(417*400))*Counts(k,1);
p = Counts(k,1);
elseif k>1
s(k) = ((255)/(417*400))*(Counts(k,1)+p);
p = p + Counts(k,1);
end
end
s=round(s)';
% Converts the new intensities to intager values
for L = 1:255
% Writes a new image based on the old image and the new histogram
% values
for x = 1:417
for y = 1:400
if A(x,y) == L-1
B(x,y) = s(L);
end
end
end
end
figure(1), imagesc(B)
colorbar
colormap('gray')
Smith
5
This code transforms the entire image and produced this linear transformation and converted
image.
The word “Congratulation!” is written across the top above the motor, but it is not very visible.
To improve the visibility I pulled the part of the image containing the word, and then
transformed just that section of the picture.
clear all
closeall
Smith
6
A = imread('image01.bmp');
% Load the image into the matrix A
C = A(50:100,100:350);
% Load the section of the image with the word into the matrix C
[Counts1,X1]=imhist(C);
% Gathers data about the intensity values in the image
for k=1:1:256
% Loop that builds thehistogramvalues for the new
if k == 1
s1(k) = ((255)/(417*400))*Counts1(k,1);
p1 = Counts1(k,1);
elseif k>1
s1(k) = ((255)/(417*400))*(Counts1(k,1)+p1);
p1 = p1 + Counts1(k,1);
end
end
s1=round(s1)';
% Converts the new intensities to intager values
for L = 1:255
% Writes a new image based on the old image and the new histogram
% values
for x = 1:51
for y = 1:251
if C(x,y) == L-1
B(x,y) = s1(L);
end
end
end
end
figure(1), imagesc(B)
colorbar
colormap('gray')
This code gave me the following image and transformation curve.
Smith
7
This section of the image had only a few different color intensities in comparison to the main
image. The first image is with very close borders which reduced the number of intensities
included, and the second image is with further expanded borders thus including more bit
intensities and producing a better averaging transformation. Performing the transformation and
converting the image made the message easier to read. This local transformation produced much
better results.
To try and further improve the readability of the message I cut the extracted image of the word in
half and applied histogram equalization to each image separately. I then put the image back
together to see the results.
clear all
closeall
A = imread('image01.bmp');
C = A(50:100,100:225);
D = A(50:100, 226:350);
[Counts1,X1]=imhist(C);
[Counts2,X2]=imhist(D);
Smith
8
for k=1:1:256
if k == 1
s1(k) = ((255)/(417*400))*Counts1(k,1);
p1 = Counts1(k,1);
elseif k>1
s1(k) = ((255)/(417*400))*(Counts1(k,1)+p1);
p1 = p1 + Counts1(k,1);
end
end
s1=round(s1)';
for w=1:1:256
if w == 1
s2(w) = ((255)/(417*400))*Counts2(w,1);
p2 = Counts2(w,1);
elseif w>1
s2(w) = ((255)/(417*400))*(Counts2(w,1)+p2);
p2 = p2 + Counts2(w,1);
end
end
s2=round(s2)';
for L = 1:255
for x = 1:51
for y = 1:126
if C(x,y) == L-1
B(x,y) = s1(L);
end
end
end
end
for H = 1:255
for m = 1:51
for n = 1:125
if D(m,n) == H-1
E(m,n) = s2(H);
end
end
end
end
figure(1), imagesc([B,E])
colorbar
colormap('gray')
Smith
9
The image produced is shown below.
This image was the best image I could produce using histogram equalization. It is fairly clear
and readable.
I did try to break the section of the image into four small pictures to use histogram equalization
on each one, but the results were terrible.
This image is almost as bad as the original image. The hidden word is almost indistinguishable
from the background. I learned from this that more is not always better. I think that there was
not enough of a range of differences in the histograms to produce a useful equalization function.
The histogram for the far right image is shown below.
Smith
10
This histogram shows that the concentration of color is very dark and the equalization process
would not change this enough to help us view the image. The transformation plot for the far
right image is shown below.
This transformation curve only sets a small range of bit intensities.
I also tried adjusting the image using both the power and logarithmic transformations. Each of
these methods caused a portion of the hidden word to become visible, but not the full word.
My image is not as clear as I would like and I think that further testing and familiarization with
the method of histogram equalization would improve the results. I also think that applying
different types of image transformations along with the histogram equalization would produce a
better image.

More Related Content

What's hot

2 5 Bzca5e
2 5 Bzca5e2 5 Bzca5e
2 5 Bzca5e
silvia
 
Transformations
TransformationsTransformations
Transformations
estelav
 
Fuzzy c means clustering protocol for wireless sensor networks
Fuzzy c means clustering protocol for wireless sensor networksFuzzy c means clustering protocol for wireless sensor networks
Fuzzy c means clustering protocol for wireless sensor networks
mourya chandra
 
Matrix mult class-17
Matrix mult class-17Matrix mult class-17
Matrix mult class-17
Kumar
 
Snakes in Images (Active contour tutorial)
Snakes in Images (Active contour tutorial)Snakes in Images (Active contour tutorial)
Snakes in Images (Active contour tutorial)
Yan Xu
 

What's hot (20)

Non Deterministic and Deterministic Problems
Non Deterministic and Deterministic Problems Non Deterministic and Deterministic Problems
Non Deterministic and Deterministic Problems
 
Popular image restoration technique
Popular image restoration techniquePopular image restoration technique
Popular image restoration technique
 
NWEA Math Items (3)
NWEA Math Items (3)NWEA Math Items (3)
NWEA Math Items (3)
 
Fuzzy c means manual work
Fuzzy c means manual workFuzzy c means manual work
Fuzzy c means manual work
 
Matrix multiplicationdesign
Matrix multiplicationdesignMatrix multiplicationdesign
Matrix multiplicationdesign
 
CVPR2014 reading "Reconstructing storyline graphs for image recommendation fr...
CVPR2014 reading "Reconstructing storyline graphs for image recommendation fr...CVPR2014 reading "Reconstructing storyline graphs for image recommendation fr...
CVPR2014 reading "Reconstructing storyline graphs for image recommendation fr...
 
Visualizing Data Using t-SNE
Visualizing Data Using t-SNEVisualizing Data Using t-SNE
Visualizing Data Using t-SNE
 
2 5 Bzca5e
2 5 Bzca5e2 5 Bzca5e
2 5 Bzca5e
 
High Dimensional Data Visualization using t-SNE
High Dimensional Data Visualization using t-SNEHigh Dimensional Data Visualization using t-SNE
High Dimensional Data Visualization using t-SNE
 
Report
ReportReport
Report
 
Transformations
TransformationsTransformations
Transformations
 
Prim algorithm
Prim algorithmPrim algorithm
Prim algorithm
 
Fuzzy c means clustering protocol for wireless sensor networks
Fuzzy c means clustering protocol for wireless sensor networksFuzzy c means clustering protocol for wireless sensor networks
Fuzzy c means clustering protocol for wireless sensor networks
 
Matrix mult class-17
Matrix mult class-17Matrix mult class-17
Matrix mult class-17
 
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
 
k-means Clustering and Custergram with R
k-means Clustering and Custergram with Rk-means Clustering and Custergram with R
k-means Clustering and Custergram with R
 
Snakes in Images (Active contour tutorial)
Snakes in Images (Active contour tutorial)Snakes in Images (Active contour tutorial)
Snakes in Images (Active contour tutorial)
 
Multidimension Scaling and Isomap
Multidimension Scaling and IsomapMultidimension Scaling and Isomap
Multidimension Scaling and Isomap
 
Transfer learningforclp
Transfer learningforclpTransfer learningforclp
Transfer learningforclp
 
Spectral graph theory
Spectral graph theorySpectral graph theory
Spectral graph theory
 

Similar to Image Processing Homework 1

Image processing
Image processingImage processing
Image processing
maheshpene
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
Saideep
 
Matlab intro
Matlab introMatlab intro
Matlab intro
fvijayami
 
CIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & CourseworkCIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & Coursework
TUOS-Sam
 

Similar to Image Processing Homework 1 (20)

matlab.docx
matlab.docxmatlab.docx
matlab.docx
 
Basics of Digital Images
Basics of  Digital ImagesBasics of  Digital Images
Basics of Digital Images
 
A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...
A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...
A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...
 
Eigenfaces
EigenfacesEigenfaces
Eigenfaces
 
Image processing
Image processingImage processing
Image processing
 
image processing intensity transformation
image processing intensity transformationimage processing intensity transformation
image processing intensity transformation
 
Digtial Image Processing Q@A
Digtial Image Processing Q@ADigtial Image Processing Q@A
Digtial Image Processing Q@A
 
Image-Processing-ch3-part-3.pdf
Image-Processing-ch3-part-3.pdfImage-Processing-ch3-part-3.pdf
Image-Processing-ch3-part-3.pdf
 
Intensity Transformation and Spatial filtering
Intensity Transformation and Spatial filteringIntensity Transformation and Spatial filtering
Intensity Transformation and Spatial filtering
 
Julia Set
Julia SetJulia Set
Julia Set
 
Signals and Systems Homework Help.pptx
Signals and Systems Homework Help.pptxSignals and Systems Homework Help.pptx
Signals and Systems Homework Help.pptx
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
 
Image enhancement techniques
Image enhancement techniques Image enhancement techniques
Image enhancement techniques
 
Otsu
OtsuOtsu
Otsu
 
image enhancement.pptx
image enhancement.pptximage enhancement.pptx
image enhancement.pptx
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 
imageenhancementtechniques-140316011049-phpapp01 (1).pptx
imageenhancementtechniques-140316011049-phpapp01 (1).pptximageenhancementtechniques-140316011049-phpapp01 (1).pptx
imageenhancementtechniques-140316011049-phpapp01 (1).pptx
 
Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)
 
Digital image processing using matlab: basic transformations, filters and ope...
Digital image processing using matlab: basic transformations, filters and ope...Digital image processing using matlab: basic transformations, filters and ope...
Digital image processing using matlab: basic transformations, filters and ope...
 
CIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & CourseworkCIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & Coursework
 

Image Processing Homework 1

  • 2. Smith 2 Objectives Using the histogram techniques discussed in class, search the image provided to recover the hidden message. Utilize histogram equalization to adjust the intensity values for the given image to create a new image that shows the hidden message. Equipment and Materials Time Matlab Files from Dr. Gleb
  • 3. Smith 3 Methods A message is hidden in this image. The histogram for this image is shown below. This graph shows the color intensities verses the bit counts for the original image. Using this image and histogram I created multiple m-files in Matlab which implemented the formula 𝑠 𝑘 = 𝑇( 𝑟 𝑘) = (𝐿 − 1) 𝑀𝑁 ∑ 𝑛𝑗 𝑤ℎ𝑒𝑟𝑒 𝑘 = 0,1,2, … , 𝐿 − 1 𝑘 𝑗=0
  • 4. Smith 4 to create a map for transforming the image. The transformed image would allow us to read the hidden message. Results For this project I wrote multiple m-files to transform the given image. My first attempt was a global histogram transformation. clear all closeall A = imread('image01.bmp') % Load the image into the matrix A [Counts,X]=imhist(A); % Gathers data about the intensity values in the image for k=1:1:256 % Loop that builds thehistogramvalues for the new image if k == 1 s(k) = ((255)/(417*400))*Counts(k,1); p = Counts(k,1); elseif k>1 s(k) = ((255)/(417*400))*(Counts(k,1)+p); p = p + Counts(k,1); end end s=round(s)'; % Converts the new intensities to intager values for L = 1:255 % Writes a new image based on the old image and the new histogram % values for x = 1:417 for y = 1:400 if A(x,y) == L-1 B(x,y) = s(L); end end end end figure(1), imagesc(B) colorbar colormap('gray')
  • 5. Smith 5 This code transforms the entire image and produced this linear transformation and converted image. The word “Congratulation!” is written across the top above the motor, but it is not very visible. To improve the visibility I pulled the part of the image containing the word, and then transformed just that section of the picture. clear all closeall
  • 6. Smith 6 A = imread('image01.bmp'); % Load the image into the matrix A C = A(50:100,100:350); % Load the section of the image with the word into the matrix C [Counts1,X1]=imhist(C); % Gathers data about the intensity values in the image for k=1:1:256 % Loop that builds thehistogramvalues for the new if k == 1 s1(k) = ((255)/(417*400))*Counts1(k,1); p1 = Counts1(k,1); elseif k>1 s1(k) = ((255)/(417*400))*(Counts1(k,1)+p1); p1 = p1 + Counts1(k,1); end end s1=round(s1)'; % Converts the new intensities to intager values for L = 1:255 % Writes a new image based on the old image and the new histogram % values for x = 1:51 for y = 1:251 if C(x,y) == L-1 B(x,y) = s1(L); end end end end figure(1), imagesc(B) colorbar colormap('gray') This code gave me the following image and transformation curve.
  • 7. Smith 7 This section of the image had only a few different color intensities in comparison to the main image. The first image is with very close borders which reduced the number of intensities included, and the second image is with further expanded borders thus including more bit intensities and producing a better averaging transformation. Performing the transformation and converting the image made the message easier to read. This local transformation produced much better results. To try and further improve the readability of the message I cut the extracted image of the word in half and applied histogram equalization to each image separately. I then put the image back together to see the results. clear all closeall A = imread('image01.bmp'); C = A(50:100,100:225); D = A(50:100, 226:350); [Counts1,X1]=imhist(C); [Counts2,X2]=imhist(D);
  • 8. Smith 8 for k=1:1:256 if k == 1 s1(k) = ((255)/(417*400))*Counts1(k,1); p1 = Counts1(k,1); elseif k>1 s1(k) = ((255)/(417*400))*(Counts1(k,1)+p1); p1 = p1 + Counts1(k,1); end end s1=round(s1)'; for w=1:1:256 if w == 1 s2(w) = ((255)/(417*400))*Counts2(w,1); p2 = Counts2(w,1); elseif w>1 s2(w) = ((255)/(417*400))*(Counts2(w,1)+p2); p2 = p2 + Counts2(w,1); end end s2=round(s2)'; for L = 1:255 for x = 1:51 for y = 1:126 if C(x,y) == L-1 B(x,y) = s1(L); end end end end for H = 1:255 for m = 1:51 for n = 1:125 if D(m,n) == H-1 E(m,n) = s2(H); end end end end figure(1), imagesc([B,E]) colorbar colormap('gray')
  • 9. Smith 9 The image produced is shown below. This image was the best image I could produce using histogram equalization. It is fairly clear and readable. I did try to break the section of the image into four small pictures to use histogram equalization on each one, but the results were terrible. This image is almost as bad as the original image. The hidden word is almost indistinguishable from the background. I learned from this that more is not always better. I think that there was not enough of a range of differences in the histograms to produce a useful equalization function. The histogram for the far right image is shown below.
  • 10. Smith 10 This histogram shows that the concentration of color is very dark and the equalization process would not change this enough to help us view the image. The transformation plot for the far right image is shown below. This transformation curve only sets a small range of bit intensities. I also tried adjusting the image using both the power and logarithmic transformations. Each of these methods caused a portion of the hidden word to become visible, but not the full word. My image is not as clear as I would like and I think that further testing and familiarization with the method of histogram equalization would improve the results. I also think that applying different types of image transformations along with the histogram equalization would produce a better image.