Access over 35 million academic & study documents

Image Processing Using Matlab

Content type
User Generated
Subject
MathLab
School
Davenport University
Type
Homework
Rating
Showing Page:
1/3
Image Processing using MATLAB
MATLAB is a programming platform that is utilized for designing, computing, and image
processing. This software is specifically and commonly used by engineers and scientists. This
software uses the MATLAB language. It is a matrix-based language that allows various
expressions regarding computational mathematics. The following code is used to apply filters in
an image using the MATLAB Programming Software.
1 clc;
2 clearvars;
3 a=imread('jetskiair.jpg');
4
5 low_limit=0.008;
6 up_limit=0.992;
7 [m1 n1 r1]=size(a);
8 aa=double(a);
9 for k=1:r1
10 arr=sort(reshape(aa(:,:,k),m1*n1,1));
11 v_min(k)=arr(ceil(low_limit*m1*n1));
12 v_max(k)=arr(ceil(up_limit*m1*n1));
13 end
14 if r1==3
15 v_min=rgb2ntsc(v_min);
16 v_max=rgb2ntsc(v_max);
17 end
18 aaa=(aa-v_min(1))/(v_max(1)-v_min(1));
19
20 an=imnoise(a,'gaussian');
21 m=3;
22 n=m^2;
23 o=round(m/2);
24 p=o-1;
25 [row,col]=size(an);
26 b=zeros(row-o,col-o);
27 mask=zeros(m);
28 for x=1:n
29 mask(x)=1/n;
30 end
31 for x=o:row-o+1
32 for y=o:col-o+1
33 c=0;
34 for i=-p:p
35 for j=-p:p
36 c=c+an(x+i,y+i)*mask(1);
37 end
38 end
39 b(x-p,y-p)=c;
40 end
41 end
42
43 brightness=aaa+20;
44

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/3
45 figure;
46 subplot(3,2,1);
47 imshow(a);
48 title('Original');
49 subplot(3,2,2);
50 imshow(uint8(aaa.*255))
51 title('Image w/ Auto Contrast')
52 subplot(3,2,3);
53 imshow(an);
54 title('Image w/ Gaussian Noise');
55 subplot(3,2,4);
56 imshow(brightness);
57 title('Image w/ Brightness');
58 subplot(3,2,5:6);
59 imshow(uint8(b));
60 title('Low Pass Filtered (3x3 Matrix)');
The code is used to an add auto-contrast filter (lines 5-18), gaussian noise (line 20), low
pass and black and white filter applied using a 3x3 matrix (lines 28-41), and a brightness filter
(line 43).
The screenshot below is the output of the code.

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/3

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
Image Processing using MATLAB MATLAB is a programming platform that is utilized for designing, computing, and image processing. This software is specifically and commonly used by engineers and scientists. This software uses the MATLAB language. It is a matrix-based language that allows various expressions regarding computational mathematics. The following code is used to apply filters in an image using the MATLAB Programming Software. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 clc; clearvars; a=imread('jetskiair.jpg'); low_limit=0.008; up_limit=0.992; [m1 n1 r1]=size(a); aa=double(a); for k=1:r1 arr=sort(reshape(aa(:,:,k),m1*n1,1)); v_min(k)=arr(ceil(low_limit*m1*n1)); v_max(k)=arr(ceil(up_limit*m1*n1)); end if r1==3 v_min=rgb2ntsc(v_min); v_max=rgb2ntsc(v_max); end aaa=(aa-v_min(1))/(v_max(1)-v_min(1)); an= ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Really useful study material!

Studypool
4.7
Indeed
4.5
Sitejabber
4.4