Fundamentals in MATLAB
Fundamentals in MATLAB
FUNDAMENTALS IN MATLAB
Dosen Pengampu :
Dr. Yohanes Baptista Gunawan S,ST.,MT.
Dianthika Puteri Andini, SST., M.Sc.
Oleh :
Nama : Moch Bilal Zaenal Asyikin
NIM : 161354019
II. Tools:
- 1 set Personal Computer (PC) or Laptop
- MATLAB Software
Coordinate Conventions
imread() function only needs an image file. If the result of imread() function is equal
to a variable, a matrix variable (I) is created. File name, extension, and directory path
that contains image must be written between two single quotes. If script and image file
are in the same folder, path is not necessary.
The matrix variable of image is showed using imshow() function. If many images show
with sequence on the different figure windows, we use “figure” function for opening
new window. imwrite() function is used to create an image. This function only requires
a new image file name with extension. If the new image is saved to a specific directory,
the path of directory is necessary.
2. Displaying Images
Images are displayed on the MATLAB using function imshow.
Display the results and what are inside “displaying window” menu and explain
the those function.
Tabel 1.2
Figure 2.2 Image Tool. Overview Window. Main Window, and Pixel Region.
3. Writing Images
Basic syntax in MATLAB for writing images is imwrite.
4. Classes
Table 1.3 Data Classes
• Binary Images
6. Array Indexing
To illustrate basic indexing in one or two dimensions for example vector and matrix.
ans =
761 1153
M=
761
1153
>> whos f
Name Size Bytes Class Attributes
M=
761
N=
1153
>> whos f
Name Size Bytes Class Attributes
>> imshow(f)
ans =
2. Pada percobaan kedua digunakan binary image dengan tipe tif seperti pada Gambar 2.1
ans =
1 1
>> size(f)
ans =
269 221
>> imshow(f)
ans =
ans =
2250 4000 3
>> whos f
Name Size Bytes Class Attributes
>> imshow(f)
ans =
>> whos f
Name Size Bytes Class Attributes
4. Array Indexing
>> fp = f(end:-1:1, :);
>> imshow(f)
5. Menu M-Files
1 2
3 4
>> b
b=
1 2
3 4
>> plus(a,b)
ans =
2 4
6 8
>> minus(a,b)
0 0
0 0
>> times(a,b)
ans =
1 4
9 16
>> mtimes(a,b)
ans =
7 10
15 22
>> rdevide(a,b)
Undefined function 'rdevide' for input arguments of
type 'double'.
>> rdivide(a,b)
ans =
1 1
1 1
>> ldivide(a,b)
ans =
1 1
1 1
VII. Analysis
1. What are differences between reading and displaying images?
Reading adalah fungsi untuk membaca ukuran, byte dan class gambar sedangkan
displaying adalah fungsi menampilkan gambar.
2. What is the meaning of data classes from an image?
Data classes adalah tipe data pada setiap pixel gambar. Meskipun pada koordinat
Matlab digunakan integer, namun bukan berarti setiap pixel gambar bernilai integer.
3. What are differences from image types, intensity, binary, dan RGB?
Intensity menggunakan data classes uint8 atau uint16, sedangkan binary
menggunakan data classes logical yaitu bernilai antara 0 dan 1. Sedangkan RGB
sama dengan intensity namun setiap pixel terdiri atas R, G dan B.
4. How does the conceptualize of process in image processing works?
VIII. Conclusion
Berdasarkan hasil percobaan, dengan bantuan Tools IPT pada Matlab, gambar dapat
dikonversikan kedalam bentuk matrik. Beberapa fungsi pada Matlab telah berhasil
dicoba seperti imread(), imwrite(), imshow(), imfinfo dan beberapa operasi
matematika. Sehingga dengan melakukan percobaan ini kita dapat menganalisa setiap
gambar yang dibaca.