Lecture 3 More programming in OpenCV Slides by: Clark F. Olson.

Slides:



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

Introduction to Programming Lecture 15. In Today’s Lecture Pointers and Arrays Manipulations Pointers and Arrays Manipulations Pointers Expression Pointers.
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
Computer Vision Set: Applications Slides by D.A. Forsyth, C.F. Olson, J. Ponce, L.G. Shapiro Computer Vision and Applications.
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.
MST: Red Rule, Blue Rule. 2 MST Instance
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.
Creating With Code.
1 After completing this lesson, you will be able to: Identify the key differences between analog and digital technologies. Define digital camera terms,
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.
W2D1. HSV colour model Source: Primary colours Red Green Blue Secondary Cyan Magenta.
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
COUNTING Directions: Write your word on the I pad and on the paper. Count the amount of letters in your word and then find the color that matches that.
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.
Day 8: Fruit Loops: Color. Loop Review What does the following loop print? for (int i= 0; i
1 Chapter 1 C++ Templates Sections 1.6 and Templates Type-independent patterns that can work with multiple data types –Generic programming –Code.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
An urn contains 1 green, 2 red, and 3 blue marbles. Draw two without replacement. 1/6 2/6 3/6 2/5 3/5 1/5 3/5 1/5 2/5 2/30 3/30 2/30 6/30 3/30 6/30.
Scientific Notation. = 5.4 =3.47 Write the following in standard form A 1.8 X 10⁴ B 3.47 X 10⁷ C 4.3 X 10⁰ D 5.4 X 10⁻⁴ E 5 X 10⁻⁶ F (6 X 10⁴) (7 X 10⁵)
Return to Home! Go To Next Slide! Return to Home! Go To Next Slide!
CompSci 4 Java 4 Apr 14, 2009 Prof. Susan Rodger.
Logo’s Please follow the directions on each slide...
Computer Vision Set: OpenCV programming Slides by D.A. Forsyth, C.F. Olson, J. Ponce, L.G. Shapiro More programming in OpenCV.
Hank Childs, University of Oregon April “29 th”, 2015 CIS 330: _ _ _ _ ______ _ _____ / / / /___ (_) __ ____ _____ ____/ / / ____/ _/_/ ____/__ __ / /
David Meredith Aalborg University
Processing the image with Python
DIP 9 65 Original 210 Eye Zoomed.
Images Presentation Name Course Name Unit # – Lesson #.# – Lesson Name
CS320n –Visual Programming
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.
Simulation And Modeling
EE/CSE 576 HW 1 Notes.
Instructions The first time you open this template, immediately save the file by another name as a PowerPoint Presentation (.pptx), not as a PowerPoint.
Name: _______________________________
CS 106A, Lecture 18 Practice with 1D and 2D Arrays
EE/CSE 576 HW 1 Notes.
Directions: Color your name with any tiles you want.
Can I color yellow?. Can I color yellow?
Drawing the Mandelbrot Set
Images Presentation Name Course Name Unit # – Lesson #.# – Lesson Name
Directions: On each slide you will find fish of different colors, sizes, and numbers. You will also find bubbles for grouping the fish. On some slides.
Template Functions Lecture 9 Fri, Feb 9, 2007.
What Color is it?.
Color Image Processing
Introduction to Programming in MATLAB
Non-numeric Data Representation
The Image The pixels in the image The mask The resulting image 255 X
COLOR WHEEL COLLAGE.
Color Box Button - Gray Type : object Type : object Type : object
Testing 123 This is my first slide presentation. Inverted Stamp.
ECE/CSE 576 HW 1 Notes.
Presentation transcript:

Lecture 3 More programming in OpenCV Slides by: Clark F. Olson

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.

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;

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 }

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

Accessing pixels One more way 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];