IIIIIII Open CV

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Basics of Imageprocessing

June 22, 2016

Basics of Imageprocessing
Overview

What is image processing?


What is pattern recognition?
What are computer vision and graphics?
What is an Image ?
Image types
Introduction to OpenCV

Basics of Imageprocessing
Introduction

GrayScale Color

Basics of Imageprocessing
Introduction......

WHAT IS IN A PICTURE? WHAT DO WE SEE?


Regions of different Objects, faces, people, and
brightnesses and colours symbols
2D flat surface 3D world
Fantastic amount of We interpret and describe the
information about subtle shades picture in very few words (a
and colours (mostly unused?) thousand?!)
Image processing helps in going from left to right
How do we do it? Extremely difficult to analyze!

Basics of Imageprocessing
History

1960s and early 1970s


computational approaches
mainly low-level vision, image models and representations
Late 1970s and early 1980s
model-based image understanding systems
1980s
Applications
1990s
learning in vision
image databases

Basics of Imageprocessing
Definitions

Image processing manipulating basic characteristics of a picture


such as colour, brightness, contrast, edges, etc. , reduction of
information by recognizing essential and non-essential features
Pattern recognition classification, listing, identification and
symbolic description of features or aspects of an image
Computer Vision techniques, algorithms, methods, features and
research that aim at mimicking human vision system, generating 3D
from 2D
Computer Graphics techniques, algorithms, methods, features and
research that aim at generating pictures, generating 2D from 3D

Basics of Imageprocessing
D.E.Marr Theory...

three levels of analysis 2D To 3D


low, intermediate and high
image processing fits in low-level or
early processing
pattern recognition in middle level
computer vision fits in higher level
which deals with construction of 3D
image from 2D
complexity increases significantly from
low to high

Basics of Imageprocessing
What is an Image ??
Array of numbers whose values are proportional to brightness

Basics of Imageprocessing
Sample Pixel Values

Basics of Imageprocessing
Image Teriminology

Pixel The word pixel is based on a contraction of pix (from word


pictures, where it is shortened to pics, and cs in pics
sounds like x) and el (for element)
In digital imaging, a pixel, is a physical point in a raster image, or
the smallest addressable element in an all points addressable display
device; so it is the smallest controllable element of a picture
represented on the screen.
The address of a pixel corresponds to its physical coordinates(x,y)
Resolution refers to the number of pixels on display or dimensions of
image ( M x N)
A pixel is actually a unit of the digital Resolution depends upon the
size of the pixel

Basics of Imageprocessing
Classification of Images

Classified into three types Example


Binary
pure black and white - need only 0s
and 1s
1-bit images
usually 8 pixels / byte
Gray-Scale
shades of black and white
4- or 8-bit images
usually 1 pixel / byte
Colour Images
Red, Green, and Blue layers (RGB)
true-colour - 256x256x256 colours:
24-bit images
3 bytes / pixel

Basics of Imageprocessing
Introduction to OpenCV

OpenCV stands for Open Computer Vision Algorithms


Created and Maintained by Intel
Its Open source
Can write programs in C, C++ and python
Really four libraries in one
CV Computer Vision Algorithms
CVAUX Experimental/Beta
CXCORE Linear Algebra
HIGHGUI Media/ Window Handling read/write AVI, window
displays, etc

Basics of Imageprocessing
Sample Program in Opencv
Write a program in gedit and save as first.cpp
Compile the program with g++ -o <objname> <filename.cpp>
pkg-config libs cflags opencv
Run the program ./<objname> <CMDLINEARGS>
Sample Program

#include highgui.h
#include "cv.h"

int main( int argc, char** argv ) {


IplImage* img = cvLoadImage( argv[1] );
cvNamedWindow( Example1, CV_WINDOW_AUTOSIZE );
cvShowImage( Example1, img );
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( Example1 );
}

Basics of Imageprocessing
Sample Program Camera with OpenCV
#include <iostream>
#include <cv.h>
#include <highgui.h>
using namespace std;
char key;
int main()
{
cvNamedWindow("Camera_Output", 1); //Create window
CvCapture* capture = cvCaptureFromCAM(CV_CAP_ANY);
//Capture using any camera connected to your system
while(1){
//Create infinte loop for live streaming

IplImage* frame = cvQueryFrame(capture);


//Create image frames from capture
cvShowImage("Camera_Output", frame);
//Show image frames on created window
key = cvWaitKey(10); //Capture Keyboard stroke
if (char(key) == 27){
break; //If you hit
Basics ESC key loop will break.
of Imageprocessing

You might also like