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

PPTX
rit seminars-privacy assured outsourcing of image reconstruction services in ...
PPTX
karnaugh maps
PDF
(slides 2) Visual Computing: Geometry, Graphics, and Vision
PDF
2-Rainbow Domination of Hexagonal Mesh Networks
PPT
Modeling quadratic fxns
PPT
2 simple regression
PPT
Chapter 2 Image Processing: Pixel Relation
PPTX
Basics of pixel neighbor.
rit seminars-privacy assured outsourcing of image reconstruction services in ...
karnaugh maps
(slides 2) Visual Computing: Geometry, Graphics, and Vision
2-Rainbow Domination of Hexagonal Mesh Networks
Modeling quadratic fxns
2 simple regression
Chapter 2 Image Processing: Pixel Relation
Basics of pixel neighbor.

What's hot (20)

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

Similar to Image Processing Homework 1 (20)

DOCX
PPTX
CLASS on the and some what sore free 5.pptx
PPTX
Basics of Digital Images
PDF
A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...
PDF
PDF
Image processing
PPT
image processing intensity transformation
DOCX
Digtial Image Processing Q@A
PDF
Image-Processing-ch3-part-3.pdf
PPTX
Intensity Transformation and Spatial filtering
PDF
Julia Set
PPTX
Signals and Systems Homework Help.pptx
PPTX
Image enhancement techniques
PPTX
Image enhancement techniques
PDF
PPTX
PDF
Matlab intro
PPTX
imageenhancementtechniques-140316011049-phpapp01 (1).pptx
PPTX
Digital Image Processing (Lab 07)
PDF
Digital image processing using matlab: basic transformations, filters and ope...
CLASS on the and some what sore free 5.pptx
Basics of Digital Images
A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...
Image processing
image processing intensity transformation
Digtial Image Processing Q@A
Image-Processing-ch3-part-3.pdf
Intensity Transformation and Spatial filtering
Julia Set
Signals and Systems Homework Help.pptx
Image enhancement techniques
Image enhancement techniques
Matlab intro
imageenhancementtechniques-140316011049-phpapp01 (1).pptx
Digital Image Processing (Lab 07)
Digital image processing using matlab: basic transformations, filters and ope...
Ad

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.