Image Formation Fundamentals

Slides:



Advertisements
Similar presentations
Digital Image Fundamentals Selim Aksoy Department of Computer Engineering Bilkent University
Advertisements

Digital Image Fundamentals Selim Aksoy Department of Computer Engineering Bilkent University
Digital Image Fundamentals Selim Aksoy Department of Computer Engineering Bilkent University
Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.
Image Representation and Manipulation CS302 Data Structures Prof. George Bebis
1 Imaging and Image Representation  Sensing Process  Typical Sensing Devices  Problems with Digital Images  Image Formats  Relationship of 3D Scenes.
Introduction to Image Processing CS474/674 – Prof. Bebis.
Image Formation Fundamentals CS491E/791E. How are images represented in the computer?
Image representation methods. Bitmap graphic method of a black-and-white image.
Image and Sound Editing Raed S. Rasheed Image Image. Digital image. – Raster images. – Vector Images. – Stereo Images. – Image File Formats Lossless.
Introduction to Machine Vision Systems
Photographics 10 Introduction to Digital Photography
Filtering (I) Dr. Chang Shu COMP 4900C Winter 2008.
COMP Bitmapped and Vector Graphics Pages Using Qwizdom.
Image Formation. Input - Digital Images Intensity Images – encoding of light intensity Range Images – encoding of shape and distance They are both a 2-D.
Lab #5-6 Follow-Up: More Python; Images Images ● A signal (e.g. sound, temperature infrared sensor reading) is a single (one- dimensional) quantity that.
1 Image Basics Hao Jiang Computer Science Department Sept. 4, 2014.
Image Formation Fundamentals Basic Concepts (Continued…)
Digital Image Fundamentals Selim Aksoy Department of Computer Engineering Bilkent University
© 1999 Rochester Institute of Technology Introduction to Digital Imaging.
Image Formation Dr. Chang Shu COMP 4900C Winter 2008.
September 21, COMPUTER VISION WEB PAGE IS UP !! OR Simply go to computer science homepage.
Digital Cameras And Digital Information. How a Camera works Light passes through the lens Shutter opens for an instant Film is exposed to light Film is.
CS 376b Introduction to Computer Vision 02 / 08 / 2008 Instructor: Michael Eckmann.
Chapter 2 : Imaging and Image Representation Computer Vision Lab. Chonbuk National University.
Intelligent Vision Systems Image Geometry and Acquisition ENT 496 Ms. HEMA C.R. Lecture 2.
CS- 375 Graphics and Human Computer Interaction Lecture 1: 12/4/1435 Fundamental Techniques in Graphics Lecturer: Kawther Abas.
Image Representation. Digital Cameras Scanned Film & Photographs Digitized TV Signals Computer Graphics Radar & Sonar Medical Imaging Devices (X-Ray,
Exploring Space – Course 3
Graphics and Images Graphics and images are both non-textual information, that can be displayed and printed. These images may appear on screen as well.
CSCI-100 Introduction to Computing Hardware Part II.
Image File Formats. What is an Image File Format? Image file formats are standard way of organizing and storing of image files. Image files are composed.
1 Introduction What IS computer vision? Where do images come from? the analysis of digital images by a computer.
Digital Image Editing Presented by John Hohn. File Formats JPEG – Joint Photographic Experts Group PNP – Portable Network Graphics GIF – Graphic Interchange.
Computer Science 121 Scientific Computing Winter 2014 Chapter 14 Images.
1 Perception and VR MONT 104S, Fall 2008 Lecture 20 Computer Graphics and VR.
Introduction to Image Processing. What is Image Processing? Manipulation of digital images by computer. Image processing focuses on two major tasks: –Improvement.
Intelligent Vision Systems Image Geometry and Acquisition ENT 496 Ms. HEMA C.R. Lecture 2.
Intelligent Robotics Today: Vision & Time & Space Complexity.
Introduction to Image Processing Course Notes Anup Basu, Ph.D. Professor, Dept of Computing Sc. University of Alberta.
Graphics and Image Data Representations 1. Q1 How images are represented in a computer system? 2.
Image Representation and Read/Write CS479/679 – Prof. Bebis.
Lecture 01 Introduction to Computer Vision Course: T Computer Vision Year: 2013.
Image Processing F34IMP lecture 1
2.01 Understand Digital Raster Graphics
COMP 9517 Computer Vision Digital Images 1/28/2018 COMP 9517 S2, 2009.
2.01 Understand Digital Raster Graphics
Representation of image data
DIGITAL MEDIA FOUNDATIONS
Graphics and image data representation
Sampling, Quantization, Color Models & Indexed Color
2.01 Understand Digital Raster Graphics
Chapter 3 Graphics and Image Data Representations
Image Formation and Representation
Images, Display, Perception
Image Segmentation Classify pixels into groups having similar characteristics.
2.01 Investigate graphic image design.
Digital Images.
Engineering Math Physics (EMP)
Outline Image formats and basic operations Image representation
Digital Image Fundamentals
2.01 Understand Digital Raster Graphics
Ch2: Data Representation
2.01 Investigate graphic image design.
2.01 Understand Digital Raster Graphics
Multimedia System Image
Visuals are analog signals...
2.01 Investigate graphic image design.
2.01 Investigate graphic image design.
PGM Format CS474/674 – Prof. Bebis.
Presentation transcript:

Image Formation Fundamentals CS491E/791E

How are images represented in the computer?

Color images

Image formation There are two parts to the image formation process: The geometry of image formation, which determines where in the image plane the projection of a point in the scene will be located. The physics of light, which determines the brightness of a point in the image plane as a function of illumination and surface properties.

A Simple model of image formation The scene is illuminated by a single source. The scene reflects radiation towards the camera. The camera senses it via chemicals on film.

Pinhole camera This is the simplest device to form an image of a 3D scene on a 2D surface. Straight rays of light pass through a “pinhole” and form an inverted image of the object on the image plane.

Camera optics In practice, the aperture must be larger to admit more light. Lenses are placed to in the aperture to focus the bundle of rays from each scene point onto the corresponding point in the image plane

Image formation (cont’d) Optical parameters of the lens lens type focal length field of view Photometric parameters type, intensity, and direction of illumination reflectance properties of the viewed surfaces Geometric parameters type of projections position and orientation of camera in space perspective distortions introduced by the imaging process

Image distortion

What is light? The visible portion of the electromagnetic (EM) spectrum. It occurs between wavelengths of approximately 400 and 700 nanometers.

Short wavelengths Different wavelengths of radiation have different properties. The x-ray region of the spectrum, it carries sufficient energy to penetrate a significant volume or material.

Long wavelengths Copious quantities of infrared (IR) radiation are emitted from warm objects (e.g., locate people in total darkness).

Long wavelengths (cont’d) “Synthetic aperture radar” (SAR) imaging techniques use an artificially generated source of microwaves to probe a scene. SAR is unaffected by weather conditions and clouds (e.g., has provided us images of the surface of Venus).

Range images An array of distances to the objects in the scene. They can be produced by sonar or by using laser rangefinders.

Sonic images Produced by the reflection of sound waves off an object. High sound frequencies are used to improve resolution.

CCD (Charged-Coupled Device) cameras Tiny solid state cells convert light energy into electrical charge. The image plane acts as a digital memory that can be read row by row by a computer.

Frame grabber Usually, a CCD camera plugs into a computer board (frame grabber). The frame grabber digitizes the signal and stores it in its memory (frame buffer).

Image digitization Sampling means measuring the value of an image at a finite number of points. Quantization is the representation of the measured value at the sampled point by an integer.

Image digitization (cont’d)

Image quantization(example) 256 gray levels (8bits/pixel) 32 gray levels (5 bits/pixel) 16 gray levels (4 bits/pixel) 8 gray levels (3 bits/pixel) 4 gray levels (2 bits/pixel) 2 gray levels (1 bit/pixel)

Image sampling (example) original image sampled by a factor of 2 sampled by a factor of 4 sampled by a factor of 8

Digital image An image is represented by a rectangular array of integers. An integer represents the brightness or darkness of the image at that point. N: # of rows, M: # of columns, Q: # of gray levels N = , M = , Q = (q is the # of bits/pixel) Storage requirements: NxMxQ (e.g., N=M=1024, q=8, 1MB)

Image file formats Many image formats adhere to the simple model shown below (line by line, no breaks between lines). The header contains at least the width and height of the image. Most headers begin with a signature or “magic number” - a short sequence of bytes for identifying the file format.

Common image file formats GIF (Graphic Interchange Format) - PNG (Portable Network Graphics) JPEG (Joint Photographic Experts Group) TIFF (Tagged Image File Format) PGM (Portable Gray Map) FITS (Flexible Image Transport System)

Comparison of image formats

PGM format A popular format for grayscale images (8 bits/pixel) Closely-related formats are: PBM (Portable Bitmap), for binary images (1 bit/pixel) PPM (Portable Pixelmap), for color images (24 bits/pixel) ASCII or binary (raw) storage

ASCII vs Raw format ASCII format has the following advantages: Pixel values can be examined or modified very easily using a standard text editor. Files in raw format cannot be modified in this way since they contain many unprintable characters. Raw format has the following advantages: It is much more compact compared to the ASCII format. Pixel values are coded using only a single character !

Image Class class ImageType { public: ImageType(); ~ImageType(); // more functions ... private: int N, M, Q; //N: # rows, M: # columns int **pixelValue; };

An example - Threshold.cpp void readImageHeader(char[], int&, int&, int&, bool&); void readImage(char[], ImageType&); void writeImage(char[], ImageType&); void main(int argc, char *argv[]) { int i, j; int M, N, Q; bool type; int val; int thresh; // read image header readImageHeader(argv[1], N, M, Q, type); // allocate memory for the image array ImageType image(N, M, Q); // read image readImage(argv[1], image);

Threshold.cpp (cont’d) cout << "Enter threshold: "; cin >> thresh; // threshold image for(i=0; i<N; i++) for(j=0; j<M; j++) { image.getVal(i, j, val); if(val < thresh) image.setVal(i, j, 255); else image.setVal(i, j, 0); } // write image writeImage(argv[2], image);

Reading/Writing PGM images

Writing a PGM image to a file void writeImage(char fname[], ImageType& image) int N, M, Q; unsigned char *charImage; ofstream ofp; image.getImageInfo(N, M, Q); charImage = (unsigned char *) new unsigned char [M*N]; // convert the integer values to unsigned char int val; for(i=0; i<N; i++) for(j=0; j<M; j++) image.getVal(i, j, val); charImage[i*M+j]=(unsigned char)val; }

Writing a PGM image... (cont’d) ofp.open(fname, ios::out); if (!ofp) { cout << "Can't open file: " << fname << endl; exit(1); } ofp << "P5" << endl; ofp << M << " " << N << endl; ofp << Q << endl; ofp.write( reinterpret_cast<char *>(charImage), (M*N)*sizeof(unsigned char)); if (ofp.fail()) { cout << "Can't write image " << fname << endl; exit(0); ofp.close();

Reading a PGM image from a file void readImage(char fname[], ImageType& image) { int i, j; int N, M, Q; unsigned char *charImage; char header [100], *ptr; ifstream ifp; ifp.open(fname, ios::in); if (!ifp) { cout << "Can't read image: " << fname << endl; exit(1); } // read header ifp.getline(header,100,'\n'); if ( (header[0]!=80) || /* 'P' */ (header[1]!=53) ) { /* '5' */ cout << "Image " << fname << " is not PGM" << endl;

Reading a PGM image …. (cont’d) ifp.getline(header,100,'\n'); while(header[0]=='#') M=strtol(header,&ptr,0); N=atoi(ptr); Q=strtol(header,&ptr,0); charImage = (unsigned char *) new unsigned char [M*N]; ifp.read( reinterpret_cast<char *>(charImage), (M*N)*sizeof(unsigned char)); if (ifp.fail()) { cout << "Image " << fname << " has wrong size" << endl; exit(1); } ifp.close();

Reading a PGM image…(cont’d) // // Convert the unsigned characters to integers int val; for(i=0; i<N; i++) for(j=0; j<M; j++) { val = (int)charImage[i*M+j]; image.setVal(i, j, val); }

How do I “see” images on the computer? Unix: xv, gimp Windows: Photoshop

How do I display an image from within my C++ program? Save the image into a file with a default name (e.g., tmp.pgm) using the WriteImage function. Put the following command in your C++ program: system(“xv tmp.pgm”); This is a system call !! It passes the command within the quotes to the Unix operating system. You can execute any Unix command this way ….

How do I convert an image from one format to another? Use xv’s “save” option It can also convert images

How do I print an image? Load the image using “xv” Save the image in “postscript” format Print the postscript file (e.g., lpr -Pname image.ps)

Image processing software CVIPtools (Computer Vision and Image Processing tools) Intel Open Computer Vision Library Microsoft Vision SDL Library Matlab Khoros For more information, see http://www.cs.unr.edu/~bebis/CS791E http://www.cs.unr.edu/CRCD/ComputerVision/cv_resources.html