CSE 803 Using images in C++ Computing with images Applications & Methods 2D arrays in C++ Programming project 4.

Slides:



Advertisements
Similar presentations
A Short Review Arrays, Pointers and Structures. What is an Array? An array is a collection of variables of the same type and placed in memory contiguously.
Advertisements

Hashing.
Software project Gnome Graphics Olga Sorkine Andrei Scharf Office: Schreiber 002, Web:
Dynamic Memory Allocation (also see pointers lectures) -L. Grewe.
C Structures Basics of structures Typedef. Data Hierarchy Byte –8 bits (ASCII character ‘A’ = ) Field –Group of characters (character string “Fred”)
Unions The storage referenced by a union variable can hold data of different types subject to the restriction that at any one time, the storage holds data.
Single Variable and a Lot of Variables The declaration int k; float f; reserve one single integer variable called k and one single floating point variable.
Dynamic Memory Allocation
Growing Arrays in C By: Victoria Tielebein CS 265- Spring 2011.
Digital Images in Java The structure of code and concept
Arrays. Memory organization Table at right shows 16 bytes, each consisting of 8 bits Each byte has an address, shown in the column to the left
Connecting with Computer Science, 2e
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Introduction.
Image Representation and Manipulation CS302 Data Structures Prof. George Bebis
Image File Format Only focused in TIFF-Tag Image File Format Grayscale 8 bit Purpose-interchange of digital image data Goals: Extensibility-capable to.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Introduction.
Pointers: Part I. Why pointers? - low-level, but efficient manipulation of memory - dynamic objects  Objects whose memory is allocated during program.
Review on pointers and dynamic objects. Memory Management  Static Memory Allocation  Memory is allocated at compiling time  Dynamic Memory  Memory.
CSE 113 Week 5 February , Announcements  Module 2 due 2/15  Exam 3 is on 2/15  Module 3 due 2/22  Exam 4 is on 2/25  Module 4 due 2/29.
Arrays Data Structures - structured data are data organized to show the relationship among the individual elements. It usually requires a collecting mechanism.
Microsoft Excel 2013: Excel Power User Course with Jim Mollé Learn iT! Computer Software Training.
CSC – Java Programming II Lecture 9 January 30, 2002.
Prof. amr Goneid, AUC1 CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 10. Pointers & Dynamic Data Structures.
Data Structures Winter What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important.
Copyright © 2012 Pearson Education, Inc. Chapter 8 Two Dimensional Arrays.
CSE 2341 Honors Professor Mark Fontenot Southern Methodist University Note Set 04.
Connecting with Computer Science, 2e Chapter 8 Data Structures.
Matlab Workshop 1/10/07 Lesson 1: Matlab as a graphing calculator.
September 21, COMPUTER VISION WEB PAGE IS UP !! OR Simply go to computer science homepage.
1 C - Memory Simple Types Arrays Pointers Pointer to Pointer Multi-dimensional Arrays Dynamic Memory Allocation.
This set of notes is adapted from that provided by “Computer Science – A Structured Programming Approach Using C++”, B.A. Forouzan & R.F. Gilberg, Thomson.
Using the JImageViewer classes. JImageViewer classes JImageViewer class JImageViewer class ImagePanel class ImagePanel class Image class Image class.
1 CHAPTER 7. Objectives: You’ll learn about;  Introduction  Fundamentals of binary data files  Processing binary files  Files with mixed type data.
Creating your own image data files. Simple ASCII file output in Java import java.io.FileOutputStream; import java.io.PrintWriter; … PrintWriter out =
Week 9 Part 1 Kyle Dewey. Overview Dynamic allocation continued Heap versus stack Memory-related bugs Exam #2.
Creating your own image data files. Simple file output in C# using System.IO; … StreamWriter file = new StreamWriter( "c:\\out.txt" ); file.WriteLine(
21-Feb-02 Sudeshna Sarkar, CSE, IIT Kharagpur1 Multidimensional Arrays Lecture 20 4/3/2002.
ECE 103 Engineering Programming Chapter 47 Dynamic Memory Alocation Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103.
1 Dynamic Memory Allocation –The need –malloc/free –Memory Leaks –Dangling Pointers and Garbage Collection Today’s Material.
Pointers in C++. 7a-2 Pointers "pointer" is a basic type like int or double value of a pointer variable contains the location, or address in memory, of.
 A spreadsheet is a type of software which you can put and sort out data. It is also known as ‘Microsoft Excel’ What is a spreadsheet?
Memory organization and usage A computer’s memory is, at its lowest level, composed of binary digits (bits). The memory is organized into bytes, which.
Pointers: Basics. 2 What is a pointer? First of all, it is a variable, just like other variables you studied  So it has type, storage etc. Difference:
Introduction to Image Processing. Image Processing is the steps of using image processing tools to covert different kinds of image sources into different.
 Structures are like arrays except that they allow many variables of different types grouped together under the same name. For example you can create.
Pointers in C Computer Organization I 1 August 2009 © McQuain, Feng & Ribbens Memory and Addresses Memory is just a sequence of byte-sized.
CE Operating Systems Lecture 17 File systems – interface and implementation.
Chapter 11 – Pointer Variables. Declaring a Pointer Variable u Declared with data type, * and identifier type* pointer_variable; u * follows data type.
Computer Organization and Design Pointers, Arrays and Strings in C Montek Singh Sep 18, 2015 Lab 5 supplement.
Lecture 25 May 16, Agenda Using JComboBox Class ID3V1_Tag –Using it. –Implementation. Class MP3_File –Dummy Version Quiz.
Data Structures - Part I CS 215 Lecture 7. Motivation  Real programs use abstractions like lists, trees, stacks, and queues.  The data associated with.
Assembly - Arrays תרגול 7 מערכים.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Digital Image Processing
Characters and Strings
ENEE150 – 0102 ANDREW GOFFIN More With Pointers. Importance of Pointers Dynamic Memory (relevant with malloc) Passing By Reference Pointer Arithmetic.
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
Two dimensional arrays A two dimensional m x n array A is a collection of m. n elements such that each element is specified by a pair of integers (such.
Container Classes. How do we do better? Tough to delete correctly: startLocation.
1 ENERGY 211 / CME 211 Lecture 4 September 29, 2008.
Image Representation and Read/Write CS479/679 – Prof. Bebis.
Prof. Amr Goneid, AUC1 CSCE 210 Data Structures and Algorithms Prof. Amr Goneid AUC Part R2. Elementary Data Structures.
Text and Images Key Revision Points.
Representation of image data
Reading Netpbm Images.
Basic notes on pointers in C
Outline Image formats and basic operations Image representation
Introduction to Abstract Data Types
Storing Information Each memory cell stores a set number of bits (usually 8 bits, or one byte) (byte addressable)
2-d Arrays.
Presentation transcript:

CSE 803 Using images in C++ Computing with images Applications & Methods 2D arrays in C++ Programming project 4

Memory organizations Raster storage of 2D array 2D array using pointers to rows PGM image file format

1D array via a pointer P is base address of array in memory Array has N cells Cells 0, 1, …, N-1 double* P; P = new double[N]; P[k] located at P + k * size of cell

2D array via pointers int** P; Need to acquire dynamic memory for row pointers and for rows of integers

Point to array of row pointers typedef int* integerPointer; integerPointer P; P = new integerPointer [5]; // allocate 3 columns in each row for ( int k=0; k<5; k++ ) P[k] = new int [3]; // now have 5 rows of 3 integers each

Referencing 5 rows of 3 ints // put i + j in P[i][j] for ( int i=0; i<5; i++) for ( int j=0; j<3; j++) (P[i])[j] = i+j; // don’t need () // P points to a 1D array of pointers to int // P[i] is the pointer offset +i from P // (P[i])[j] is the int offset +j from P[I ]

“raster” storage of 2D array One continguous block of memory for double A[3][4]; 3 rows of 4 columns 8 bytes for each cell Row 0 first, then row 1, then row 2 Easy formula locates any cell in same time

Issues with 2D arrays Images can be different sizes; R x C Size unknown until image file opened Image history usually needed Program must keep collection of data items – R, C, comments, I[r][c] Object class is a good solution

PGM is simple image file form See Fig of Shapiro and Stockman P2 is “magic number” for gray image # indicates comment line Width, height, max gray value next ASCII values for width x height pixels in row major order

PGM image with ASCII info. P2 means ASCII gray Comments W=16; H=8 192 is max intensity Can be made with editor