This document discusses several basic operations of digital image processing using MATLAB, including reading, displaying, and modifying images. It loads an image, displays the image model and attributes, converts the image to black and white, gray, crops the image, and displays the histogram. The document demonstrates common image processing tasks.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
22 views1 page
1 Basicoperations
This document discusses several basic operations of digital image processing using MATLAB, including reading, displaying, and modifying images. It loads an image, displays the image model and attributes, converts the image to black and white, gray, crops the image, and displays the histogram. The document demonstrates common image processing tasks.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
%% TITLE :Basic operations of digital image processing
%% AIM : To study the basic operations of digital image processing
%% SOFTWARE REQUIRED:Fullyloaded personal computer with MATLAB 7.8.0 Version %% OPERATING SYSTEM :WINDOWS XP %% CLEARING STATEMENTS clc; clear all; close all; %% IMAGE 1 a=imread('C:\Users\Public\Pictures\Sample Pictures\Lighthouse.jpg');%reading an image a figure(1);%figure of image a imshow(a);%to show image a %% IMAGE 2 b=imshow('C:\Users\Public\Pictures\Sample Pictures\Lighthouse.jpg');%reading an image b im=imagemodel(b);%to show the image model of image b disp(im)%to display im %% IMAGE 3 c=imshow('C:\Users\Public\Pictures\Sample Pictures\Lighthouse.jpg');%reading an image c attrs=imattributes(c);% to show the attributes of image c disp(attrs)%to display the attributes %% SIZE OF AN IMAGE d=size(rand(2,3,4));% to show d disp d;%displaying d %% CONVERTING AN IMAGE INTO A BLACK AND WHITE IMAGE bw=im2bw(a);%converting to black and white figure(2);%figure of bw imshow(bw);% to show bw %% CONVERTING AN IMAGE INTO A gray IMAGE d=rgb2gray(a);%converting to gray figure(3);%figure of d imshow(d);%to show d %% MEAN OF AN IMAGE e=mean2(a)%mean disp(e)%to display mean %% CROPING AN IMAGE g=imcrop(a,[72 82 92 62]);%croping figure(4);%figure of g imshow(g);%to show d %% TO DISPLAY ONLY RED ELEMENTS h=a(:,:,1);%red elements figure(5);%figure of h imshow(h);%to show h %% TO DISPLAY ONLY GREEN ELEMENTS i=a(:,:,2);%green elements figure(6);%figure of i imshow(i);%to show i %% TO DISPLAY ONLY BLUE ELEMENTS j=a(:,:,3);%blue elements figure(7);%figure of j imshow(j);%to show j %% HISTOGRAM figure(8);%figure of histogram imhist(d);%histogram %% INFERENCE :We get to know how the basic operations are done in digital image processing