Programming Assignment 1 CS308 Data Structures. Goals Familiarize yourself with reading images from a file. Familiarize yourself with writing images to.

Slides:



Advertisements
Similar presentations
Computer Graphics- SCC 342
Advertisements

Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, All rights reserved.
Geometric Operations Move over rover. Geometric Operations  Previous operations have taken a sample at some location and changed the sample value (the.
Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.
Filtering CSE P 576 Larry Zitnick
1 CS6825: Simple Geometric Operations 2Scaling This is what happens when you resize an image. If you transform the image from an MxN to a PxQ image where.
Image Filtering CS485/685 Computer Vision Prof. George Bebis.
CSE 803 Using images in C++ Computing with images Applications & Methods 2D arrays in C++ Programming project 4.
Programming Assignment 2 CS308 Fall Goals Improve your skills with using templates. Learn how to compile your code when using templates. Learn more.
CS 376b Introduction to Computer Vision 04 / 11 / 2008 Instructor: Michael Eckmann.
8. Geometric Operations Geometric operations change image geometry by moving pixels around in a carefully constrained way. We might do this to remove distortions.
CS485/685 Computer Vision Prof. George Bebis
Preprocessing ROI Image Geometry
Programming Assignment 1 CS302 Data Structures. Goals Improve your skills with manipulating dynamic arrays. Improve your understanding of constructors,
Computer Vision Lecture 3: Digital Images
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
By: Suhas Navada and Antony Jacob
Lecture 7: Matrix-Vector Product; Matrix of a Linear Transformation; Matrix-Matrix Product Sections 2.1, 2.2.1,
Image processing Lecture 4.
Unit 9: Vectors, Matrices and Transformations
October 8, 2013Computer Vision Lecture 11: The Hough Transform 1 Fitting Curve Models to Edges Most contours can be well described by combining several.
Image Processing.  a typical image is simply a 2D array of color or gray values  i.e., a texture  image processing takes as input an image and outputs.
CS 376b Introduction to Computer Vision 02 / 26 / 2008 Instructor: Michael Eckmann.
COMP 175: Computer Graphics March 24, 2015
Chapter 3: Image Restoration Geometric Transforms.
By Meidika Wardana Kristi, NRP  Digital cameras used to take picture of an object requires three sensors to store the red, blue and green color.
Lists in Python.
UNIT THREE REVIEW Geometry 217. True/False  A translation is an arrangement of shapes that covers a plane completely without gaps or overlaps.  False,
Lecture 18 Chapter 12 Matrices continued. Outline from Chapter Matrix Operations Matrix Multiplication Matrix Division
Basic Image Manipulation Raed S. Rasheed Agenda Region of Interest (ROI) Basic geometric manipulation. – Enlarge – shrink – Reflection Arithmetic.
Geometric Transformations
CS 376b Introduction to Computer Vision 02 / 22 / 2008 Instructor: Michael Eckmann.
Under Supervision of Dr. Kamel A. Arram Eng. Lamiaa Said Wed
Crypto Project Sample Encrypted Data: –Turing: CS Public\CryptoProjectData Crypto_Short_Keys_P_U.out Crypto_Long_Keys_O_R.out Bonus +10 points on.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Digital Image Processing CCS331 Relationships of Pixel 1.
Lecture 03 Area Based Image Processing Lecture 03 Area Based Image Processing Mata kuliah: T Computer Vision Tahun: 2010.
Image Processing Edge detection Filtering: Noise suppresion.
ITI 1120 Lab #9 Slides by: Diana Inkpen and Alan Williams.
CSC508 Convolution Operators. CSC508 Convolution Arguably the most fundamental operation of computer vision It’s a neighborhood operator –Similar to the.
Transformations To move a figure in the coordinate system to another location or image, by a rule.
CS 325 Introduction to Computer Graphics 04 / 12 / 2010 Instructor: Michael Eckmann.
Transformations LESSON 26POWER UP FPAGE 169. Transformations The new image is read as “A prime, B prime, C prime”
October 16, 2014Computer Vision Lecture 12: Image Segmentation II 1 Hough Transform The Hough transform is a very general technique for feature detection.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
 An image is the new figure, and the preimage is the original figure  Transformations-move or change a figure in some way to produce an image.
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
Images and Filters CSEP 576 Ali Farhadi Many slides from Steve Seitz and Larry Zitnick.
Go Back > Question 1 Describe this transformation. A reflection in the line y = x. ? Object Image.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae & david streader, VUW Images and 2D Graphics COMP.
Filters– Chapter 6. Filter Difference between a Filter and a Point Operation is that a Filter utilizes a neighborhood of pixels from the input image to.
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Write Bresenham’s algorithm for generation of line also indicate which raster locations would be chosen by Bresenham’s algorithm when scan converting.
IS502:M ULTIMEDIA D ESIGN FOR I NFORMATION S YSTEM D IGITAL S TILL I MAGES Presenter Name: Mahmood A.Moneim Supervised By: Prof. Hesham A.Hefny Winter.
Arithmetic and Geometric Transformations (Chapter 2) CS474/674 – Prof. Bebis.
Basic Image Manipulation CHAPTER 5. Topics 5.1Storage 5.2Reading and writing images in Java 5.3Display 5.4Printing 5.5Manipulation of pixel data.
Images and 2D Graphics COMP
IMAGE PROCESSING Questions and Answers.
Transformation of Functions
Fitting Curve Models to Edges
WINDOWING AND CLIPPING
WINDOWING AND CLIPPING
(c) 2002 University of Wisconsin, CS 559
More on Widgets, Misc. Topics
Fundamentals of Programming I Introduction to Digital Image Processing
POLAR COORDINATES Dr. Shildneck.
Properties or Rules of Transformations
Transformations Review
Introduction to Artificial Intelligence Lecture 22: Computer Vision II
Pages Draw a Point at the center of dilation (Point P).
Presentation transcript:

Programming Assignment 1 CS308 Data Structures

Goals Familiarize yourself with reading images from a file. Familiarize yourself with writing images to a file. Familiarize yourself with displaying/printing images. Improve your skills with manipulating arrays. Improve your understanding of constructors, destructors, and copy-constructors. Improve your skills with operator overloading. Learn to document and describe your programs.

Image Datatype Functions Read an image from a file Save an image to a file. Get the info of an image. Set the value of a pixel. Get the value of a pixel. Extract a region of interest (ROI) from an image. Compute the mean gray-level value of an image. sEnlarge an image by some factor s sShrink an image by sine factor s Reflect an image in the horizontal or vertical derections.

Image Type Functions (cont’d) tTranslate an image by some amount t theta.Rotate an image by some angle theta. Compute the sum of two images. Compute the difference of two images. Compute the negative of an image.

Image Type Specification class Image { public: constructor //default - no parameters constructor //with parameters copy_constructor operator= //overload assignment getImageInfo getPixelVal setPixelVal inBounds getSubImage meanGray enlargeImage

Image Type Specification (cont’d) shrinkImage reflectImage translateImage rotateImage operator+ operator- negateImage private: int N; //no of rows int M; //no of columns int Q; //no of gray-level values int **pixelVal; };

readImage(fileName, image) Reads in an image in PGM format from a file. A NOT-PGM exception should be raised if the image is not in PGM format. Not a member function

writeImage(fileName, image) Writes out an image to a file in PGM format. Not a member function

getImageInfo(noRows, noCols, maxVal) It returns the height (no of rows) and width (no of columns) of the image. Also, it returns the max gray-level value allowed (i.e.,255) These values should be returned using “call by reference”

int getPixelVal(r, c) Returns the pixel value at (r, c) location. An OUT-OF-BOUNDS exception should be raised if (r, c) falls outside the image.

setPixelVal(r, c, value) Sets the pixel value at location (r, c) to value. An OUT-OF-BOUNDS exception should be raised if (r, c) falls outside the image.

bool inBounds(r, c) Returns true if the pixel (r, c) is inside the image..

getSubImage(Ulr, Ulc, LRr, LRc, oldImage) It crops a rectangular subimage from the input image. It is useful for limiting the extent of image processing operations to some small part of the image. The subimage can be defined by the coordinates of its upper-left (UL) and lower-right (LR) corners newImage.getSubimage( xxx )

int meanGray() Computes the average gray-level value of an image. Returns the value as “int” (truncate the result)

enlargeImage(s, oldImage) Enlarges the input image by some integer factor s It is useful for magnifying small details in an image. 2 times the original size

enlargeImage (cont’d) Replicate pixels such that each pixel in the input image becomes an s x s block of identical pixels in the output image. Most easily implemented by iterating over pixels of the output image and computing the coordinates of the corresponding input image pixel.

shrinkImage(s, oldImage) Shrinks the input image by some integer factor s It is useful, for example, for reducing a large image in size so it fits on the screen. 1/2 times the original size

shrinkImage (cont’d) Sample every s-th pixel in the horizontal and vertical dimensions and ignore the others. Most easily implemented by iterating over pixels of the output image and computing the coordinates of the corresponding input image pixel.

reflectImage(flag, oldImage) Reflects the input image along the horizontal or vertical directions. vertical reflection

reflectImage (cont’d) Reflection along either direction can be performed by simply reversing the order of pixels in the rows or columns of the image

operator+ (image addition) Computes the sum of two given images. It is used to combine the information in two images. You can implement a simple image morphing algorithm ! formula: + =

operator- (image subtraction) Computes the difference of two given images. Useful for change detection. Consider absolute difference: - =

negateImage() Computes the negative of an image. This can be done using the following transformation

translateImage(t, oldImage) Translates the input image by some amount t. The translation process is performed with the following equations: 32 x 32 translation

rotateImage(theta, oldImage) Rotates the input image by some angle theta. The rotation process requires the use of the following equations: -45 degrees rotation (about the center of the image) theta>0: counter- clockwise about (0,0)

rotateImage(cont’d) Equations to rotate an image about its center : Practical problems: –consider rotating pixel (0,100) by 90 degrees: –consider rotating pixel (50,0) by 35 degrees:

rotateImage(cont’d) Possible solutions: –ignore pixels whose coordinates fall outside the range. –find nearest neighbors to and The rotated image can contain numerous “holes” where no value was computed for a pixel !! original rotated

Questions accompanying the assignments Each assignment contains a number of questions that you must answer. These questions are worth 10% of the assignment grade. Answering these questions does not require prior knowledge of image processing. Your are expected to spend some time thinking about these questions. Reasonable answers will receive full points … Interesting ideas which are implemented and demonstrated will get extra credit !!

Useful Tips Learn how to use the debugger: –Very important for debugging your programs efficiently ! –There is information in the course’s webpage Learn how to use makefiles: –Very useful when your application is split over many files. –There is information in the course’s webpage.