0% found this document useful (0 votes)
12 views

Experiment 1 of Digital Image Processing

The document outlines an experiment in Digital Image Processing using MATLAB, focusing on basic operations such as reading, displaying, and manipulating images. Key steps include converting an image to grayscale, cutting it into four equal parts, and saving these parts as separate files. The experiment concludes with a review of the learned commands and their applications, establishing a foundation for future studies in digital image processing.

Uploaded by

liyajie601
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Experiment 1 of Digital Image Processing

The document outlines an experiment in Digital Image Processing using MATLAB, focusing on basic operations such as reading, displaying, and manipulating images. Key steps include converting an image to grayscale, cutting it into four equal parts, and saving these parts as separate files. The experiment concludes with a review of the learned commands and their applications, establishing a foundation for future studies in digital image processing.

Uploaded by

liyajie601
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment 1 of Digital Image Processing

Basic operations of MATLAB image toolbox


1. Experimental Purpose:
(1) Learn how to read an image from disk into memory
(2) Mastering Check How the Image Appears in the Workspace
(3) Learn how to cut an image into four small same size images
(4) Master writing the four small images to disk files.
(5) Learn how to check the contents of the newly written Files.
2. Apparatus
A computer with MATLAB image processing toolbox, the MATLAB
version is above 6.5.
3. Experimental steps
Step 1: Read and Display an Image
First, clear the MATLAB workspace of any variables and close open
figure windows.
>>close all
To read an image, use the imread command.
>>abc = imread('/MATLAB Drive/IMG_5406.JPG');
Display the image
>imshow(abc);
Step 2: Check How the Image Appears in the Workspace
>>whos
Name Size Bytes Class Attributes

abc 4032x3024x3 36578304 uint8

>>I1=rgb2gray(abc) %change the format of I to gray level

>>whos
Name Size Bytes Class Attributes

abc 4032x3024x3 36578304 uint8


l1 4032x3024 12192768 uint8
>>openvar I1
Step 3: Cut an image into four small same size images
>> I1_part1=I1(1:round(end/2),1:round(end/2));
>> I1_part2=I1(1:round(end/2),round(end/2)+1:end);
>> I1_part3=I1(round(end/2)+1:end,1:round(end/2));
>> I1_part4=I1(round(end/2)+1:end,round(end/2)+1:end);
>>whos
Name Size Bytes Class Attributes

abc 4032x3024x3 36578304 uint8


l1 4032x3024 12192768 uint8
l1_part1 2016x1512 3048192 uint8
l1_part2 2016x1512 3048192 uint8
l1_part3 2016x1512 3048192 uint8
l1_part4 2016x1512 3048192 uint8
Step 4: Writing the four small images to disk files
>>imwrite(I1_part1,'mylh_part1.png');
>>imwrite(I1_part2,'mylh_part2.png');
>>imwrite(I1_part3,'mylh_part3.png');
>> imwrite(I1_part3,'mylh_part3.png');
Step 5: check the contents of the newly written Files.
>>dir my*
mylh_part1.png mylh_part2.png mylh_part3.png
>> imfinfo('mylh_part1.png')
ans =

Filename: 'mylh_part1.png'
FileModDate: '12-4 月-2025 10:22:46'
FileSize: 1440954
Format: 'png'
FormatVersion: []
Width: 1736
Height: 1736
BitDepth: 8
ColorType: 'grayscale'
FormatSignature: [137 80 78 71 13 10 26 10]
Colormap: []
Histogram: []
InterlaceType: 'none'
Transparency: 'none'
SimpleTransparencyData: []
BackgroundColor: []
RenderingIntent: []
Chromaticities: []
Gamma: []
XResolution: []
YResolution: []
ResolutionUnit: []
XOffset: []
YOffset: []
OffsetUnit: []
SignificantBits: []
ImageModTime: '12 Apr 2025 02:22:46 +0000'
Title: []
Author: []
Description: []
Copyright: []
CreationTime: []
Software: []
Disclaimer: []
Warning: []
Source: []
Comment: []
OtherText: []
Conclusion:
In this "Digital Image Processing" experiment with MATLAB image
toolbox:
I've learned imread for loading images, imshow for display, and
used whos to check variable properties.
Mastered rgb2gray for converting color to grayscale.
Succeeded in dividing an image into four equal - sized parts and
saving them with imwrite .
Learned to use dir and imfinfo to check saved file details.
This experiment builds a solid base for future digital image
processing studies.

You might also like