Image processing for robotics

Post on 15-Jul-2015

90 views 0 download

Tags:

Transcript of Image processing for robotics

“IMAGE PROCESSING”

Bachelor of Technology in Electronic&Comm. Engineering

DEPARTMENT OF Electronic&Comm. ENGINEERING

APEX GROUP OF INSTITUTE SITAPURA, JAIPUR 2014 - 2015

SUBMITTED BY:- Mr. RAVI KHANDELWAL ROLL NO. 11EAGEC020

www.techienest.hpage.com

Jaipur Training Center

CF/O - 3&4 Nehru PlaceTonk RoadJaipur, RJ

Mat LabMat LabImage Processing Image Processing

Using Using

Content…Content…

1. Introduction2. The Mat lab Environment3. Why Matlab 4. What is an image5. Types of images6. Images in MatLab7. Image operation8. Image Acquisition9. GUI

• MATLAB is a numerical computing environment and programming language.

• Created by The MathWorks, MATLAB allows easy

• matrix manipulation, • plotting of functions and data, • implementation of algorithms, • creation of user interfaces, and • interfacing with programs in other languages. • computation, visualization, and programming in an easy-to-

use environment

MATLAB

The MATLAB Environment

• MATLAB window components:Workspace

> Displays all the defined variables

Command Window > To execute commands

in the MATLAB environment

Command History> Displays record of the

commands used

File Editor Window> Define your functions

WHY MATLAB

A good choice for vision program development because:

• Everything in MATLAB is a matrix ! • Easy to do very rapid prototyping

• A good library of image processing functions

• Widely used for teaching and research in universities and industry

• MATLAB does not need any variable declarations, no dimension statements, has no packaging, no storage allocation, no pointers

What is an Image…

• An image is an array, or a matrix, of pixels arranged in columns and rows.

• In a (8-bit) grayscale image each picture element has an assigned intensity that ranges from 0 to 255.

Images and Matrices

Column 1 to 256

Row

1 to 256

o

[0, 0]

o

[256, 256]

How to build a matrix(or image)?Intensity Image:

row = 256;col = 256;img = zeros(row, col);img(100:105, :) = 0.5;img(:, 100:105) = 1;figure;imshow(img);

1. Binary Images

2. Grayscale Image

3. RGB Image

Types of Images

Binary Image

A binary image is a digital image that has only two possible values for each pixel. Typically the two colors used for a binary image are black and white though any two colors can be used

Grayscale Image

• An image with 8-bit color depth, with grayscale intensities varying from 0 to 255.

RGB Image

• RGB: 24 bit per pixel, 3 eight bit unsigned integers (0 to 255) represent the intensities of red, green and blue.

(0, 0, 0) is black(255, 255, 255) is white(255, 0, 0) is red(0, 255, 0) is green(0, 0, 255) is blue(255, 255, 0) is yellow(0, 255, 255) is cyan(255, 0, 255) is magenta

Images in MATLAB

• MATLAB can import/export several image formats:

• BMP (Microsoft Windows Bitmap)• GIF (Graphics Interchange Files)• HDF (Hierarchical Data Format)• JPEG (Joint Photographic Experts Group)• PCX (Paintbrush)• PNG (Portable Network Graphics)• TIFF (Tagged Image File Format)• raw-data and other types of image data

Image Operations

• RGB image to gray image• Image resize• Image crop• Image rotate• Image blur• Image histogram• Convolution

Image Import and Export

• Read and write images in Matlab

img = imread('apple.jpg');dim = size(img);figure;imshow(img);imwrite(img, 'output.bmp', 'bmp');

• Alternatives to imshow

imagesc(I)

imtool(I)

image(I)

∗ RGB Image to Intensity Image (rgb2gray)∗ RGB Image to Indexed Image (rgb2ind)∗ RGB Image to Binary Image (im2bw)∗ Indexed Image to RGB Image (ind2rgb)∗ Indexed Image to Intensity Image (ind2gray)∗ Indexed Image to Binary Image (im2bw)∗ Intensity Image to Indexed Image (gray2ind)∗ Intensity Image to Binary Image (im2bw)∗ Intensity Image to RGB Image (gray2ind, ind2rgb)

Image Type Conversion

Image Display

• image - create and display image object

• imagesc - scale and display as image

• imshow - display image

• colorbar - display colorbar

• getimage - get image data from axes

• truesize - adjust display size of image

• zoom - zoom in and zoom out of 2D plot

Example: RGB IMAGE

i=imread('C:\Users\SACHIN\Desktop\DSC05563_1.jpg');imshow(i);

To convert rgb into grayscale image

i=imread('C:\Users\SACHIN\Desktop\DSC05563_1.jpg');j=rgb2gray(i); imshow(j);

To convert rgb into Binary image

i=imread('C:\Users\SACHIN\Desktop\DSC05563_1.jpg');k=im2bw(i); imshow(k);

EXAMPLES

∗ Image compression∗ Noise reduction∗ Edge extraction∗ Contrast enhancement∗ Segmentation∗ Image restoration

∗ Image compression∗ Noise reduction∗ Edge extraction∗ Contrast enhancement∗ Segmentation∗ Image restoration

EXAMPLES

EXAMPLES

∗ Image compression∗ Noise reduction∗ Edge extraction∗ Contrast enhancement∗ Segmentation∗ Image restoration

EXAMPLES

∗ Image compression∗ Noise reduction∗ Edge extraction∗ Contrast enhancement∗ Segmentation∗ Image restoration

EXAMPLES

∗ Image compression∗ Noise reduction∗ Edge extraction∗ Contrast enhancement∗ Segmentation∗ Image restoration

EXAMPLES

∗ Image compression∗ Noise reduction∗ Edge extraction∗ Contrast enhancement∗ Segmentation∗ Image restoration

Image Acquisition

Acquiring image from camera

• First of all check whether Image Acquisition adapter is installed and working To check it, please type the following command in command window and press enter:

>>imaqhwinfo

This signifies ‘winvideo’ adapter installed

Real Time video streaming:

To capture the video stream, type the following command in command window:

>> Var = videoinput(‘winvideo’,1,YUY2_640X480);

Previewing the real time video

where

Var is the variable in which real time video will be streamed.

type the following command in command window:

Syntax: Preview(Var);

Capturing Image from real time video:

To capture an image from real time video stream, we can use the command getsnapshot(X).

Syntax:

I=Getsnapshot(Var);

Viewing the captured Image:

To see the image captured and stored in variable I, in STEP 5, we can use the following command:

Syntax:

imshow(i);

We will have one color marker in our hand, red in our case. Through that we will change the position of that finger at four different corners of the 2-D image. Once it is done, the microcontroller section will have the Relay attached to it. And the Relay will control the four different devices as shown in figure.

Virtual Switch Board

Graphical User Interface

• GUIDE (graphical user interface development environment)

• GUIDE is command

• It is provides a set of tools for creating graphical user interfaces (GUIs).

• You also can create menus and context menus for the GUI

Tool Box

Using the GUIDE Layout Editor, you can populate a GUI by clicking and dragging GUI components—such as axes, panels, buttons, text fields, sliders. .

Example

∗ Medicine∗ Defense∗ Meteorology∗ Environmental science∗ Manufacture∗ Surveillance∗ Crime investigation

Applications

THE ENDTHE END

FOR YOUR FOR YOUR ATTENTION! ATTENTION!

ANY QUESTIONANY QUESTION