Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fourth Year – Software Engineering

Similar presentations


Presentation on theme: "Fourth Year – Software Engineering"— Presentation transcript:

1 Fourth Year – Software Engineering
Image Processing Fourth Year – Software Engineering Introduction

2 Reading, writing and displaying images
myImg = imread(’foo.ext’) reads file foo.ext into array myImg, image format is determined by the file extension (jpg, tiff, tif, gif, bmp, png, ...) imwrite(anImg, ’foo.ext’) writes the image anImg to the file foo.ext, where the image format is chosen according to the extension ext. Valid extensions are: tif, tiff, jpg, `` jpeg, gif, png imshow(myImg) displays the image myImg as gray- scale, binary or color image depending on the data type of myImg figure(n) opens a new window with number n, the next

3 Color planes The green and red color plane of image rgbimage.jpg are swapped: f = imread(’rgbimage.jpg’); red = f(:,:,1); g(:,:,1) = f(:,:,2); g(:,:,2) = red; g(:,:,3) = f(:,:,3); imshow(g);

4 Image Processing Read Image Display image Convert RGB to grayscale
imread(‘path’) ex: img=imread('D:\images\sherko.jpg'); Display image imshow(img); Convert RGB to grayscale rgb2gray(img); figure; grayscaleimage=rgb2gray(img); Divide figure into grid subplot(row,column,location);

5 Image Processing ex: subplot(2,2,1);imshow(img);title('OrignalImage');
subplot(1,2,2);imshow(grayscaleimage);title('GrayScaleImage'); color spaces RGB subplot(2,2,1);imshow(img);title('OrignalImage'); subplot(2,2,2);imshow(img(:,:,1));title('RChannelValues'); subplot(2,2,3);imshow(img(:,:,2));title('GChannelValues'); subplot(2,2,4);imshow(img(:,:,3));title('BChannelValues');

6 Image Processing Resize Image imresize(img, scale)
ex: resizeimage=imresize(img,0.5); imshow(img); figure; imshow(resizeimage); Imresize(img,[numrow numcolumn]); [m n ~]=size(img); %color image resizeimage=imresize(img,[m/2 n/2]);

7 Image Processing Crop Image Write Image
imcrop(img,[xmin ymin width height]); ex: croppedimage=imcrop(img,[ ]); Write Image imwrite(image,filename,fmt) imwrite(croppedimage,strcat('D:\images\Mypicture','.bmp'));


Download ppt "Fourth Year – Software Engineering"

Similar presentations


Ads by Google