Lecture 5 Computer Graphics PDF
Document Details
Uploaded by EntrancingOnomatopoeia5884
Dr Ahmed Al-Shammari
Tags
Summary
This document provides an introduction to computer graphics, including the concepts of plotting points and line drawing algorithms. It also discusses the use of simple digital differentiator analyzers and explains how they can be used in computer vision applications.
Full Transcript
Lecture -5 Computer Graphics Dr Ahmed Al-Shammari Plotting Points Plotting a point in computer graphics refers to marking a specific location in a coordinate system (usually in 2D or 3D space). To draw a pi...
Lecture -5 Computer Graphics Dr Ahmed Al-Shammari Plotting Points Plotting a point in computer graphics refers to marking a specific location in a coordinate system (usually in 2D or 3D space). To draw a picture on a raster display, it is important to determine the corresponding points in the frame buffer that make up the picture. - To perform this task , scan conversion point-plotting algorithm should be applied. - Both the frame buffer and the display screen are given a two-dimensional coordinate system with the origin at the lower-left corner. 2D Coordinates: In 2D graphics, a point is represented as a pair of coordinates (x, y). o The x-coordinate defines the horizontal position. o The y-coordinate defines the vertical position. Example: Plotting the point (3, 4) means moving 3 units along the x-axis and 4 units along the y- axis. Algorithm for plotting points: 1. Start at the origin (0, 0). 2. Move to the point (x, y) on the screen. 3. Place a marker at the specified coordinates. In many graphic systems, plotting a point simply involves setting a pixel on the screen. 3. Line Drawing Algorithms Drawing lines is a core operation in computer graphics. Many computer-generated pictures are composed of straight-line segments. - A line segment is displayed by turning on a string of adjacent pixels. - The accuracy and quality of the displayed line depend on the resolution of the display device. - Drawing lines with arbitrary slope creates several problems, because the display screen can eliminate only at pixel locations. 4. Simple Digital Differentiator Analyzer (Simple DDA) A Digital Differentiator is used to approximate the derivative of a digital signal or sequence. In the context of computer graphics, it can be used to analyze the changes in pixel values or color intensities. For instance, a simple digital differentiator could analyze how the pixel color changes across an image, which is useful for detecting edges or transitions in graphics. Lecture -5 Computer Graphics Dr Ahmed Al-Shammari Draw a line with endpoints (xstart, ystart) and (xend, yend) having slope: Any two consecutive points (x1, y1), (x2, y2) lying on this line satisfies the equation:- For abs(m) < 1 and xstart < xend increment x by one unit until xend is reached. - If xstart > xend swap the two endpoints x2 = x1 + 1 If abs(m) > 1 and ystart > yend , generate line by reversing this procedure. - Increment the y value by one unit until yend reached and solve for x. - If (ystart > yend) , swap the two endpoints. Y2=y1+1 or y2-y1=1 Use round function to convert the increment to integer. Summary Point Plotting: Essential in rendering individual pixels or basic shapes. Line Drawing: Used in vector graphics, wireframe models, and more advanced rendering techniques. Differentiator Analyzer: Crucial for detecting edges, contours, and transitions in images, used in applications like edge detection in computer vision or creating sharp images.