School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae & david streader, VUW Images and 2D Graphics COMP.

Slides:



Advertisements
Similar presentations
Lecture 7 2D Transformation. What is a transformation? Exactly what it says - an operation that transforms or changes a shape (line, shape, drawing etc.)
Advertisements

COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Transformations We want to be able to make changes to the image larger/smaller rotate move This can be efficiently achieved through mathematical operations.
Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, All rights reserved.
Topic 6 - Image Filtering - I DIGITAL IMAGE PROCESSING Course 3624 Department of Physics and Astronomy Professor Bob Warwick.
Transforming images to images
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 4 Ravi Ramamoorthi
Ted Adelson’s checkerboard illusion. Motion illusion, rotating snakes.
Picture Manipulation The manipulation of (already created) pictures. May be applied to vector graphics or bitmaps. We will consider bitmaps and introduce.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae & david streader, VUW Images and 2D Graphics COMP.
Image Filtering CS485/685 Computer Vision Prof. George Bebis.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
7. Neighbourhood operations A single pixel considered in isolation conveys information on the intensity and colour at a single location in an image, but.
Computer Vision Introduction to Image formats, reading and writing images, and image environments Image filtering.
Programming Assignment 1 CS302 Data Structures. Goals Improve your skills with manipulating dynamic arrays. Improve your understanding of constructors,
Now Playing: Gong Sigur Rós From Takk... Released September 13, 2005.
April Geometric Transformations for Computer Graphics Shmuel Wimer Bar Ilan Univ., School of Engineering.
2D Transformations Unit - 3. Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it.
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
Using Matrices to Perform Geometric Transformations
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Images and 2D Graphics COMP # 16.
CS448f: Image Processing For Photography and Vision Wavelets Continued.
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.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.
Image Preprocessing: Geometric Correction Image Preprocessing: Geometric Correction Jensen, 2003 John R. Jensen Department of Geography University of South.
Basic Image Manipulation Raed S. Rasheed Agenda Region of Interest (ROI) Basic geometric manipulation. – Enlarge – shrink – Reflection Arithmetic.
Computational Biology, Part 23 Biological Imaging III G. Steven Vanni Robert F. Murphy Copyright  1998, All rights reserved.
EE663 Image Processing Dr. Samir H. Abdul-Jauwad Electrical Engineering Department King Fahd University of Petroleum & Minerals.
Lecture 03 Area Based Image Processing Lecture 03 Area Based Image Processing Mata kuliah: T Computer Vision Tahun: 2010.
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.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Image Recognition COMP # 18.
GEOMETRIC OPERATIONS. Transformations and directions Affine (linear) transformations Translation, rotation and scaling Non linear (Warping transformations)
CSC508 Convolution Operators. CSC508 Convolution Arguably the most fundamental operation of computer vision It’s a neighborhood operator –Similar to the.
Image Transforms Transforming images to images. Classification of Image Transforms Point transforms –modify individual pixels –modify pixels’ locations.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Images and 2D Graphics COMP # 17.
Image Processing 고려대학교 컴퓨터 그래픽스 연구실 cgvr.korea.ac.kr.
Visual Computing Computer Vision 2 INFO410 & INFO350 S2 2015
CS COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington More Recursion COMP 102 #30.
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
Image Processing Intro2CS – week 6 1. Image Processing Many devices now have cameras on them Lots of image data recorded for computers to process. But.
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.
Geometric Transformations for Computer Graphics
Geometric Transformations for Computer Graphics
CMSC5711 Image processing and computer vision
Images and 2D Graphics COMP
Modeling Transformations
图像处理技术讲座(3) Digital Image Processing (3) Basic Image Operations
Computer Graphics 3: 2D Transformations
Computer Graphics Transformations.
Computer Graphics 3: 2D Transformations
Computer Graphics Transformations.
Image Warping (Geometric Transforms)
Histogram Histogram is a graph that shows frequency of anything. Histograms usually have bars that represent frequency of occuring of data. Histogram has.
CMSC5711 Revision 3 CMSC5711 revision 3 ver.x67.8c.
CMSC5711 Image processing and computer vision
EE/CSE 576 HW 1 Notes.
More Image Manipulation
9th Lecture - Image Filters
Image Processing, Lecture #8
Geometric Transformations for Computer Graphics
(c) 2002 University of Wisconsin, CS 559
Image Processing, Lecture #8
Resolution Resolution: 6 x 4.
EE/CSE 576 HW 1 Notes.
Lecture 8: 3D Transforms Li Zhang Spring 2008
ECE/CSE 576 HW 1 Notes.
Graphics Laboratory Korea University
Translation in Homogeneous Coordinates
Presentation transcript:

School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae & david streader, VUW Images and 2D Graphics COMP

COMP112 17: 2 Menu Graphics Images and image manipulation see GIMP (free open source) Matrices for translation, rotation, scaling,.. Transformations can be easily combined and inverted Affine transformations are widly used in robitics, computer graphics and vision (here we only use very simple transformations) bluring, sharpening, edgdetection, … One convolution algorithm many effects

COMP112 17: 3 Image manipulation What kinds of manipulation are there? Independent pixels: changing colors: (brightness, contrast, redness,…..) Geometric transformations translate, rotate, reflect, skew, scale/resize parts of images may involve interpolation to find new pixel values Selecting and modifying regions spread fill representing non-rectangular regions Applying “filters” blur, sharpen, ….. Image recognition - image search.

COMP112 17: 4 Geometric Transforms If you translate, rotate, scale, etc the pixels may not line up: pixel (3,1)  pixel (2.7, 2.2) pixel (1,4)  pixel (1.3, 2.8) What value do you use for the new pixels? Options: use truncated pixel coordinates use rounded pixel coordinates take average of overlapping pixels interpolate overlapping pixels (average weighted by distance or degree of overlap)

COMP112 17: 5 Geometric Transforms If you translate, rotate, scale, etc the pixels may not line up: pixel (3,1)  pixel (2.7, 2.2) pixel (1,4)  pixel (1.3, 2.8) What about pixels over the edge? What about missing pixel values? Options: drop pixels outside change dimensions of image blank missing pixels (white/black/grey….) use original pixel values.

COMP112 17: 6 Computing new pixel value Truncate/Round coordinates: To compute new pixel value at (i, j) work out the pixel that it came from (eg if translate by dx and dy, came from (i-dx, j-dy)) round/truncate to integers. oi = (int) (i-dx); oj = (int) (j-dy); check coords are within image (oi>= 0 && oi<=width, …) use pixel value at those cords of original image. How do you make sure that the new values don’t mess up the old values during the calculation? Always have two image arrays: original image new image. Construct values in new image from values in old image Then copy over. Easier doing reverse direction than forward direction

COMP112 17: 7 Transforming int [ ][ ][ ] newImage = new int [image.length] [image[0].length] [3]; for (int i = 0; i< newImage.length; i++){ for (int j = 0; j< newImage.length; j++){ int oi = (int)(i - translateX)); // or whatever transformation int oj = (int)(i - translateY); if (oi>=0 && oi = 0 && ok <= image[0].length) { newImage[ i ][ j ] = image[oi][oj]; // not safe ? newImage[ i ][ j ] = Arrays.copyOf(image[oi][oj], 3); } else { newImage [ i ][ j ] = = new int[ ]{ 0, 0,0}; } image = newImage;

COMP112 17: 8 Rotation How can we rotate image by  degrees? Must specify the center of rotation: xCenter, yCenter Need trigonometry: forward xNew = xCenter + (x-xCenter) cos(  ) – (y-yCenter) sin(  ) yNew = yCenter + (x-xCenter) sin(  ) + (y-yCenter) cos(  ) reverse x = xCenter + (xNew-xCenter) cos(  ) + (yNew-yCenter) sin(  ) y = yCenter - (xNew-xCenter) sin(  ) + (yNew-yCenter) cos(  ) x,y xNew, yNew  xCenter,yCenter

COMP112 17: 9 Interpolating double ox = (….i ….. j…); double oy = (…. i …..j…); int oi = (int) ox; double oy = (int) oy; newImage[ i ][ j ] = image[oi][oj] * (1-Math.hypot(ox-oi, oy-oj) + image[oi+1][oj] * + image[oi][oj+1] * + image[oi+1][oj+1] * +

COMP112 17: 10 Transformation composition Rotation about the origin Clockwise rotation Anticlockwise The composition of a clockwise followed by an anticlockwise rotation is the composition of the two matrices. Which if you remember you trigonometry give you the identity matrix. Which is what you should expect. It is efficient to compose two transformation matrices and apply the result rather than sequential apply each matrix.

COMP112 17: 11 Blur, Filters, Convolution Many image transformations involve replacing each pixel with some function of the pixel values in its neighbourhood: Blur, changing resolution: pixel → average of neighbourhood Sharpening, edge detection pixel → "difference" between pixel and neighbours

COMP112 17: 12 Convolution Matrix Convolution image transformations replace each pixel with the weighted sum of its neighbouring pixel values: Convolution: Apply "neighbour weights" to each pixel in image then sum: 0.2( ) + 0.8( ) = If the matrix values sum to 1 the result is allways an color

COMP112 17: 13 Convolution Filtering input: image: rows x cols array of pixel filter:height x width array of weights, usually height & width are odd, and weights sum to 1.0 output: newImage: rows x cols array of pixel for row ← 0.. rows-1 for col ← 0.. cols-1 ht2 ← (height-1)/2, wd2 ← (width-1)/2 for r ← –ht2.. ht2 for c ← –wd2.. wd2 newImage[row, col] += image[row+r][col+c] * filter[r+ht2] [c+w2] Problems: Have to take care at the edges How do you multiply colours?

COMP112 17: 14 Filters Blur: Edge detection Sharpen

COMP112 17: 15 Edge Detection Simple: sum to 0 ⇒ constant areas → 0 only "edge" regions bright 8