Computer Vision Set: OpenCV programming Slides by D.A. Forsyth, C.F. Olson, J. Ponce, L.G. Shapiro More programming in OpenCV.

Slides:



Advertisements
Similar presentations
For(int i = 1; i
Advertisements

Structs CSE 2451 Rong Shi. Structures Structure – one or more values, called members, with possibly dissimilar types that are stored together – Group.
Introduction to compositing. What is compositing?  The combination of two images to produce a single image  Many ways we can do this, especially in.
Most-to-Least Legible Color Combinations for Viewing on Slide Shows Color and contrast are very important tools in communication. They can be used to enhance.
Histograms 1D Histograms 3D Histograms Equalisation
Lecture 2 Imaging Geometry and OpenCV
Digital Images in Java The structure of code and concept
Lecture 3 More programming in OpenCV Slides by: Clark F. Olson.
Computer Vision Set: Applications Slides by D.A. Forsyth, C.F. Olson, J. Ponce, L.G. Shapiro Computer Vision and Applications.
CSE 803 Using images in C++ Computing with images Applications & Methods 2D arrays in C++ Programming project 4.
1 Introduction to MatLab: Image Processing - MatLab stands for Matrix Laboratory. - Most of the programming operations have as input or output a matrix.
Eleven colors and rasters. Color objects Meta represents colors with color objects You can create a color by saying: [color r g b] r: amount of red (0-255)
Exercise 1 - Poisson Image completion using Discrete Poisson Linear Systems.
Finding Red Pixels – Part 1 Prof. Noah Snavely CS1114
R-1 University of Washington Computer Programming I Lecture 17: Multidimensional Arrays © 2000 UW CSE.
First Bytes - LabVIEW. Today’s Session Introduction to LabVIEW Colors and computers Lab to create a color picker Lab to manipulate an image Visual ProgrammingImage.
Images  Camera models  Digital images  Colour images  Noise  Smoothing Images Based on A Practical Introduction to Computer Vision with OpenCV by.
Eleven colors and rasters. Color objects Meta represents colors with color objects You can create a color by saying: [color r g b] r: amount of red (0-255)
Chapter 6 Color Image Processing Chapter 6 Color Image Processing.
Traffic Sign Identification Team G Project 15. Team members Lajos Rodek-Szeged, Hungary Marcin Rogucki-Lodz, Poland Mircea Nanu -Timisoara, Romania Selman.
ICS 61 - Graphics. Light Color Wheel Color Perception.
L.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Images and 2D Graphics COMP # 16.
OPENCV TUTORIAL OpenCV Windows 7 Microsoft Visual C++ Express 2010.
CS 102 Computers In Context (Multimedia)‏ 01 / 28 / 2009 Instructor: Michael Eckmann.
How to Make Your Own Computer Drawing in Power Point Lewisville ISD Technology.
Creating With Code.
L. Akshay Masare Piyush Awasthi IMAGE PROCESSING AND OPENCV.
Lecture 7: Basics of Machine Vision. WebCam Capture Demo.
Today’s lecture 2-Dimensional indexing Color Format Thread Synchronization within for- loops Shared Memory Tiling Review example programs Using Printf.
infinity-project.org Engineering education for today’s classroom 2 Outline How Can We Use Digital Images? A Digital Image is a Matrix Manipulating Images.
ManipulatingPictures-Mod6-part61 Manipulating Pictures, Arrays, and Loops: Eliminating color, Inversion, grey scale and adjusting for luminance Barb Ericson.
Digital Image Processing NET 404) ) Introduction and Overview
Mixture of Gaussians This is a probability distribution for random variables or N-D vectors such as… –intensity of an object in a gray scale image –color.
Yingcai Xiao Chapter 10 Image Processing. Outline Motivation DWA: a real world example Algorithms Code examples.
Computer Vision Introduction to Digital Images.
If you say 8 color the ones in your picture purple. If you say 9 color the ones in your picture blue.
Finding Red Pixels – Part 1 Prof. Noah Snavely CS1114
1 Chapter 1 C++ Templates Sections 1.6 and Templates Type-independent patterns that can work with multiple data types –Generic programming –Code.
Why a bitmap (.bmp), not a.jpg? If you cannot save a.bmp, make it an uncompressed.tif. Compression (of this 8-bit 397,000 pixel image): none (397kb memory)medium.
CS 376b Introduction to Computer Vision 02 / 11 / 2008 Instructor: Michael Eckmann.
1 Computer Vision & Image Processing G. Andy Chang Department of Mathematics & Statistics Youngstown State University Youngstown, Ohio.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Final Year Project. Project Title Kalman Tracking For Image Processing Applications.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
Digital Image Processing CCS331 Relationships of Pixel 1.
Return to Home! Go To Next Slide! Return to Home! Go To Next Slide!
CompSci 4 Java 4 Apr 14, 2009 Prof. Susan Rodger.
Processing the image with Python
The Colour of Light: Additive colour theory.
DIP 9 65 Original 210 Eye Zoomed.
Color-Based Object Identifier Using LVQ
CS320n –Visual Programming
Introduction to MATLAB
Color Values All colors in computer images are a combination of red, green and blue Each component is encoded as a number means the color is.
Name: _______________________________
Directions: Color your name with any tiles you want.
Can I color yellow?. Can I color yellow?
Drawing the Mandelbrot Set
Colors Computers build colors from Red, Green, and Blue; not Red, Blue, and Yellow. RGB = Red Green Blue Creating Colors Red + Blue = Purple No Red, No.
Controls, Properties, and Procedures
What Color is it?.
Color Image Processing
Final Exam Review CSE113.
Introduction to Programming in MATLAB
Visuals are analog signals...
Non-numeric Data Representation
The Image The pixels in the image The mask The resulting image 255 X
Lecture: Pixels and Filters
Presentation transcript:

Computer Vision Set: OpenCV programming Slides by D.A. Forsyth, C.F. Olson, J. Ponce, L.G. Shapiro More programming in OpenCV

Accessing pixels The most general way to access pixels is a template method: image.at (row, col) This returns a reference, so it can be an lvalue or an rvalue. For color images, we need to say which channel: image.at (row, col)[channel]// channel is 0,1,2 Note that channel 0 is blue, channel 1 is green, channel 2 is red. Computer Vision Set: OpenCV programming Slides by D.A. Forsyth, C.F. Olson, J. Ponce, L.G. Shapiro

Accessing pixels Creating the image with a specific type allows shorter code. Mat_ greyImage = imread(“grey.jpg”); uchar greylevel = greyImage(row, col); Mat_ colorImage = imread(“color.jpg”); colorImage(row, col)[0] = newBlueValue; Computer Vision Set: OpenCV programming Slides by D.A. Forsyth, C.F. Olson, J. Ponce, L.G. Shapiro

Accessing pixels Pixels can also be accessed using pointer manipulation. This is the fastest, but not necessarily the best. int perRow = image.cols * image.channels(); for (int r = 0; r < image.rows; r ++) { uchar *currentRow = image.ptr (r); // ok for grey or color for (int c = 0; c < perRow; c++) { currentRow[c] = 255 – currentRow[c]; // invert pixel color } Computer Vision Set: OpenCV programming Slides by D.A. Forsyth, C.F. Olson, J. Ponce, L.G. Shapiro

Accessing pixels A couple of notes: Acquiring a new pointer for each row is generally necessary, since the rows may be padded. uchar *currentRow = image.ptr (r); // ok for grey or color Can also use pointer arithmetic: * currentRow++ = 255 – *currentRow; // invert pixel color Computer Vision Set: OpenCV programming Slides by D.A. Forsyth, C.F. Olson, J. Ponce, L.G. Shapiro

Accessing pixels One more to access the pixels is using iterators. This will give you all of the pixels in raster order. Mat_ ::iterator it = image.begin (); Mat_ ::iterator itend = image.end (); for ( ; it != itend; ++it) for (int c = 0; c < 3; c++) (*it)[c] = (*it)[c]; Computer Vision Set: OpenCV programming Slides by D.A. Forsyth, C.F. Olson, J. Ponce, L.G. Shapiro