Friday, September 4, 2015

Assignment

Level-1  (Mandatory)     

As Per RGPV Syllabus

Que. 1 Illustrate the reason behind refreshing the screen many times in a second?

Ans:-
The refresh rate (most commonly the "vertical refresh rate", "vertical scan rate" for cathode ray tubes) is the number of times in a second that a display hardware updates its buffer.
Reason On cathode ray tube (CRT) displays, increasing the refresh rate decreases flickering, thereby reducing eye strain. However, if a refresh rate is specified that is beyond what is recommended for the display, damage to the display can occur.

Que. 2 Define frame buffer and provide the memory requirement for a black and white and a colorful image as well.

Ans: 

FRAME BUFFER

A frame buffer, or picture memory, is a computer memory
organized into an m x n rectangular grid of dots, called picture
elements, or pixels for short.  Each pixel requires a certain
number of bits, varying from 1 in bit-map displays to 24 or more
in high-quality color displays.  We call the number of bits per
pixel the "depth" of the frame buffer.

A common size of frame buffers is m=n=512, at a depth of 8 bits:
512x512x8.  A picture this size takes up 256 Kilobytes.

BLACK AND WHITE
Some early grayscale monitors can only show up to sixteen (4-bit) different shades, but today grayscale images (as photographs) intended for visual display (both on screen and printed) are commonly stored with 8 bits per sampled pixel, which allows 256 different intensities

·        Black and White Display: 512 x 512 x 1bit memory is required
·        24 bit color display: 512 x 512 x 24bit (each pixel has 8 bits for red, 8 bits for green and 8 bits for blue.)
·        8 bit color display: Want benefits of 24 bit color with only 8 bit display? 512 x 512 x 8bit (each pixel is 8 bits deep, so values 0-255 are possible).


Image Type

Bytes per pixel
1 bit Line art

1/8 byte per pixel
(1 bit per pixel, 8 bits per byte)
8 bit Grayscale

1 byte per pixel
16 bit Grayscale

2 bytes per pixel
24 bit RGB

3 bytes per pixel
Most common for photos, for example JPG
32 bit CMYK

4 bytes per pixel, for Prepress
48 bit RGB

6 bytes per pixel


Que. 3 State the purpose of scan conversion, along with the side effects.

Ans :
Purpose : A fundamental operation that is used extensively in computer graphics and visualization is the process of scan conversion or rasterization. Given a polygon in image space, this process determines the pixels that intersect the polygon. This process is utilized in visible-surface algorithms, incremental-shading techniques, polygon-fill algorithms, ray-tracing-acceleration algorithms, and a number of other tasks that are critical to the understanding of the computer graphics field.
Aliasing Effects (Side effects of scan conversion)   Scan conversion is essentially a systematic approach to mapping objects that are defined in continuous space to their discrete approximation. The various forms of distortion that result from this operation are collectively referred to as the aliasing effects of scan conversion.
1. Staircase A common example of aliasing effects is the staircase of jagged appearance, we see when scan converting a primitive such as a line of a circle. We also see the stair steps of jaggiest along the border of a filled region. 
2. Unequal Brightness  Another side effect that is less noticeable is the unequal brightness of lines of different orientation. A slanted line appears dimmer than a horizontal of vertical line although all are presented at the same intensity level. The reason for this problem can be explained using Fig. below where the pixels on the horizontal line are placed one unit apart, whereas those on the diagonal line are approximately 1.414 units apart. This difference in density produces the perceived difference in brightness. 

Beyond Syllabus

Que. 1 Raster scan system are more economical than random scan system. Explain the statement.
Ans:
Raster Scan methods have increasingly become the dominant technology since about 1975. These methods use the TV type raster scan. The growth in the use of such methods has been dependent on rapidly decreasing memory prices and on the availability of cheap scan generating hardware from the TV industry.
 
The screen is coated with discrete dots of phosphor, usually called pixels, laid out in a rectangular array. The image is then determined by how each pixel is intensified. The representation of the image used in servicing the refresh system is thus an area of memory holding a value for each pixel. This memory area holding the image representation is called the frame buffer.
 
The values in the frame buffer are held as a sequence of horizontal lines of pixel values from the top of the screen down. The scan generator then moves the beam in a series of horizontal lines with fly-back (non-intensified) between each line and between the end of the frame and the beginning of the next frame.

Unlike random-scan which is a line drawing device, refresh CRT is a point-plotting device. Raster displays store the display primitives (lines, characters, shaded and patterned areas) in a refresh buffer. Refresh buffer (also called frame buffer) stores the drawing primitives in terms of points and pixels components This scan is synchronized with the access of the intensity values held in the frame buffer.
 
Random Scan Display
 
Random scan displays, often termed vector Vector, Stroke, and Line drawing displays, came first and are still used in some applications. Here the characters are also made of sequences of strokes (or short lines). The electron gun of a CRT illuminates straight lines in any order. The display processor repeatedly reads a variable 'display file' defining a sequence of X,Y coordinate pairs and brightness or color values, and converts these to voltages controlling the electron gun.

In random scan display an electron beam is deflected from endpoint to end-point.
  The order of deflection is dictated by the arbitrary order of the display commands. The display must be refreshed at regular intervals – minimum of 30 Hz (fps) for flicker-free display



Que. 2 Throw light on the following terms-
Ans:
(a) Interlacing
Interlacing (also known as interleaving) is a method of encoding a bitmap image such that a person who has partially received it sees a degraded copy of the entire image. When communicating over a slow communications link, this is often preferable to seeing a perfectly clear copy of one part of the image, as it helps the viewer decide more quickly whether to abort or continue the transmission.
Interlacing is a form of incremental decoding, because the image can be loaded incrementally. Another form of incremental decoding is progressive scan. In progressive scan the loaded image is decoded line for line, so instead of becoming incrementally clearer it becomes incrementally larger. The main difference between the interlace concept in bitmaps and in video is that even progressive bitmaps can be loaded over multiple frames.
For example: Interlaced GIF is a GIF image that seems to arrive on your display like an image coming through a slowly opening Venetian blind. A fuzzy outline of an image is gradually replaced by seven successive waves of bit streams that fill in the missing lines until the image arrives at its full resolution.


(b) Persistence of phosphorus
A phosphor, most generally, is a substance that exhibits the phenomenon of luminescence. Somewhat confusingly, this includes both phosphorescent materials, which show a slow decay in brightness (> 1 ms), and fluorescent materials, where the emission decay takes place over tens of nanoseconds.
The time it takes the emitted light from the screen to decay one tenth of its original intensity is called as persistence.
(c) Deflection system inside a CRT
ELECTROMAGNETIC DEFLECTION. Electromagnetic  deflection  uses  a  magnetic  field  generated by  four  coils  to  move  the  beam  across  the  CRT. Electromagnetic   deflection   is   commonly   found   on CRTs that use a raster-scan type display. Current  flows  through  the  electron  beam  as  it moves   from   the   electron   gun   (cathode)   to   the phosphor  face  (anode)  of  the  CRT.  This current develops a circular magnetic field.  By introducing an external   magnetic   field,   the   beam   can   be   deflected. Controlling  the  polarity  and  strength  of  this  external field  controls  the  amount  and  direction  of  the  beam deflection. The  magnetic  field  is  introduced  into  the  CRT  by the  yoke  assembly.  The yoke consists of four coils of wire   mounted   at   90-degree increments.   The yoke is mounted around the   neck   of   the   CRT.

Current flowing  through  the  coil  produces  a  magnetic  field  at a  right  angle  to  the  coil.  The magnetic field will cause the electron beam to deflect.


Que. 3 Compare the merits and demerits of CRT and Flat panel displays.

Ans:

 Pros of LCD vs Cons of CRT


LCD
CRT
Slim Factor
Slim
Bulky
Viewable screen
Full or very close
Usually 0.9 inches or less than actual size
Screen Flatness
True Flat
Fake Flat (unless aperture grille)
Radiation
Little or none
More Radiation
Weight
Light
Heavy
Power Requirements
Low Power requirement
250% or more power
Glare
No Glare
Reduced Glare
Image Sharpness
Sharp
Slightly less sharp images
Automatic Resize
Perfect
Imperfect
Burn-In
None
Suffers from burn-in problem
Refresh Rate
No refresh rate (60hz fixed)
Needs refresh rate (minimum 72hz)
Warmness
Little
Back gets warm after some time

Pros of CRT vs Cons of LCD


CRT
LCD
Dead / Stuck Pixel
No such problem
May have dead / stuck pixel
Response Rate
No issue with response rate
Slow
Price
Cheap
Expensive
Native Resolution
None
Has a native resolution
Max Colors
32 bit
8-Bit max, 16.7 million colors.
Viewing Angle
Wide viewing angle
Narrow viewing angle
Video
Ideal for any video viewing including HD
Not ideal for videos, unless HD
Blackness
True Black
Between Dark Gray to Gray


Que. 4 Identify the relation between aspect ratio of the raster and the image quality.

Ans: Aspect ratio is the ratio of the width of an image to the height of the image. This ratio is expressed as x:y, and differs in case of different images used in photography, television, computer applications and so on. Changing this ratio may distort the images. The Image Quality of an image is the total number of pixels displayed on your computer or television screen. Generally, the higher the resolution, the higher is the quality of the image.

Comparison chart


Aspect Ratio

Resolution

Definition
Aspect ratio is the ratio of the width of an image to the height of the image (x:y).
The resolution of an image is the total number of pixels displayed on your computer or television screen.
About
Original aspect ratio (OAR) and Modified aspect ratio (MAR) are the dimensions in which the film is originally produced, or altered to fit a particular screen, respectively.
The resolution of digital images can be described as pixel resolution, spatial resolution, spectral resolution, temporal and radiometric resolution.
Commonly used
The common aspect ratios used are 1.33:1, 1.37:1, 1.43:1, 1.50:1, 1.56:1, 1.66:1, 1.75:1, 1.78:1, 1.85:1, 2.00:1, 2.20:1, 2.35:1, 2.39:1, 2.55:1 and other ratios.
The common monitor resolutions are 640x480, 800x600 and 1024x768.



Level-2 (Mandatory)      

As Per RGPV Syllabus

Que. 1 Predict the time taken by an electron gun to refresh a monochrome image of size 4 by 5 inch; with a resolution of 400 pixels per inch square. Given one horizontal retrace takes 10 microseconds.
Ans:
             SquareRoot(400) = 20 = no. of horizontal/vertical pixels per inch
             No. of horizontal retraces = no. pixel/inch * no. of vertical inch
                                                      = 20*5
                                                      = 100 retraces
             Total Time = no. of retraces * time for one ratrace
                               = 100*10 milliseconds
                               = 1,000 milliseconds

Que. 2 Find out the intermediate pixels of a line segment with endpoints at (10, 10) and (20, 15). Use the DDA algorithm.
Ans:
S.No.
X
Y
1
10
10
2
11
10.5
3
12
11
4
13
11.5
5
14
12
6
15
12.5
7
16
13
8
17
13.5
9
18
14
10
19
14.5
11
20
15

Que. 3 Derive the decision perimeter of the bresenham’s algorithm for scan conversion of a line with a slope greater than one.
Ans:


Beyond Syllabus

Que. 1 Discover the time complexity of the DDA and bresenham’s algorithms for drawing a line.
Ans:
DDA Algorithm:
   Plot the first end point of the line by using putpixel(x0, y0,5) where 5 is the value of colour in integer.
       Find the values of dx,dy.
        If(dy>dx) then

Steps=dy
Else
Steps=dx;
                          xi=dx/Steps;         yi=dy/Steps.
        Repeat the steps for k=1 to steps.

                  x=x+ xi;
         y=y+ yi;
         putpixel(x,y,5);

Time Complexity of DDA algorithm O(max(|dx|,|dy|)).

Bresenham's Algorithms:

void Line( const float x1, const float y1, const float x2, const float y2, const Color& color )
{
        // Bresenham's line algorithm
  const bool steep = (fabs(y2 - y1) > fabs(x2 - x1));
  if(steep)
  {
    std::swap(x1, y1);
    std::swap(x2, y2);
  }

  if(x1 > x2)
  {
    std::swap(x1, x2);
    std::swap(y1, y2);
  }

  const float dx = x2 - x1;
  const float dy = fabs(y2 - y1);

  float error = dx / 2.0f;
  const int ystep = (y1 < y2) ? 1 : -1;
  int y = (int)y1;

  const int maxX = (int)x2;

  for(int x=(int)x1; x<maxX; x++)
  {
    if(steep)
    {
        SetPixel(y,x, color);
    }
    else
    {
        SetPixel(x,y, color);
    }

    error -= dy;
    if(error < 0)
    {
        y += ystep;
        error += dx;
    }
  }
}
Time complexity of Bresenham's algorithm O(max(|dx|,|dy|))



Que. 2 Interpret the reason behind sliding the circle to the origin before implementing the mid point algorithm.
Ans: Our objective is to simplify the function evaluation that takes place on each iteration of our circle-drawing algorithm. All those multiply and square-root evaluations are expensive. We can do better.
We translate our coordinate system so that the circle's center is at the origin One approach is to manipulate the circle equation slightly. 
1.     First, we translate our coordinate system so that the circle's center is at the origin (the book leaves out this step), giving: ( ( x + x0 ) - x0 )2 + ( ( y - y 0 ) - y 0 )2 = r2 We simplify and make the equation homogeneous 
2.     Next, we simplify and make the equation homogeneous (i.e. independent of a scaling of the independent variables; making the whole equation equal to zero will accomplish this) by subtracting r2 from both sides. x2 + y2 - r2 = 0 We can regard this expression as a function in x and y.


Discriminating function: partition the domain, into one of three categories f( x, y ) = x2 + y2 - r2. Functions of this sort are called discriminating functions in computer graphics. They have the property of partitioning the domain, pixel coordinates in our case, into one of three categories. When f(x,y) is equal to zero the point lies on the desired locus (a circle in this case), when f(x, y) evaluates to a positive result the point lies one side of the locus, and when f(x,y) evaluates to negative it lies on the other side.
What we'd like to do is to use this discriminating function to maintain our trajectory of drawn pixels as close as possible to the desired circle. Luckily, we can start with a point on the circle, (x 0 , y 0+r) (or ( 0, r) in our adjusted coordinate system). As we move along in steps of x we note that the slope is less than zero and greater than negative one at points in the direction we're heading that are near our known point on a circle. Thus we need only to figure out at each step whether to step down in y or maintain y at each step. We will compute points between x=0 and x=y and then draw the 8 matching points In that area, the slope of the curve is between 0 and -1 From each step/point (x, y), the next one is either (x+1, y) or (x+1, y-1) We decide about which one by looking at the midpoint M M inside (f<0) => next point is E M ouside (f>0) => next point is SE Dold = f( x + 1, y - 1/2) = ( x + 1 )2 + ( y -1/2 )2 - r2 = f(x,y) + 2x - y + 5/4 if Dold < 0, E is chosen (y) Dnew = f(x + 2, y -1/2) = ( x + 2 )2 + ( y -1/2 )2 - r2 = f(x,y) + 4x -y + 3 + 5/4 Dnew = Dold + 2x + 3 = Dold + 2(x+1) +1 if Dold >0, ES is chosen (y-1) Dnew = f(x + 2, y - 3/2) = ( x + 2 )2 + ( y - 3/2 )2 - r2 = f(x,y) + 4x -3y + 5 + 5/4 Dnew = Dold + 2x -2y + 5 = Dold + 2((x+1) -(y-1) + 1) D0 = f(1, r-1/2) = 5/4 - r ...not an inger Lets change every where D by P = D - 1/4 P0 = 1 - r , and because increment are always integer, P < -1/4 <=> P < 0 int x = 0; int y = radius; int p = 1 - radius; circlePoints(xCenter, yCenter, x, y, pix); while (x < y) { x++; if (p < 0) { p += 2*x+1; } else { y--; p += 2*(x-y+1); } circlePoints(xCenter, yCenter, x, y, pix); }



Level-3 (Attempt any 2)         


Que. 1 Describe the term contrast; how does it enhance the picture quality?
Ans: Contrast is the difference in luminance or colour that makes an object (or its representation in an image or display) distinguishable. In visual perception of the real world, contrast is determined by the difference in the color and brightness of the object and other objects within the same field of view.

Relation of contrast with image quality Contrast, also known as gamma, is the slope of the tone reproduction curve in a log-log space. High contrast usually involves loss of dynamic range — loss of detail, or clipping, in highlights or shadows.
                                                                                        

Que. 2 List the side effets of scan conversion.
Ans: Aliasing Effects (Side effects of scan conversion)   Scan conversion is essentially a systematic approach to mapping objects that are defined in continuous space to their discrete approximation. The various forms of distortion that result from this operation are collectively referred to as the aliasing effects of scan conversion.
1. Staircase A common example of aliasing effects is the staircase of jagged appearance, we see when scan converting a primitive such as a line of a circle. We also see the stair steps of jaggiest along the border of a filled region. 

2. Unequal Brightness  Another side effect that is less noticeable is the unequal brightness of lines of different orientation. A slanted line appears dimmer than a horizontal of vertical line although all are presented at the same intensity level. The reason for this problem can be explained using Fig. below where the pixels on the horizontal line are placed one unit apart, whereas those on the diagonal line are approximately 1.414 units apart. This difference in density produces the perceived difference in brightness. 

3. Picket Fence Problem The picket fence problem occurs when an object is not aligned with of does not fit into the pixel grid properly. Fig. (a) below shows a picket fence where the distance between two adjacent pickets is not a multiple of the unit distance between pixels. Scan converting it normally into the image space will result in uneven distances between pickets since the endpoints will have to be snapped to pixel coordinates. This is sometimes called global aliasing, as the overall length of the picket fence is approximately correct. On the other hand an attempt to maintain equal spacing will greatly distort the overall length of the fence. This is sometimes called local aliasing, as the distances between pickets are kept close to their true distances. Another example of such a problem arises with the outline font. Suppose we want to scan convert the uppercase character E in Fig. below from its outline description to a bitmap consisting of pixels inside the region defined by the outline. The result in Fig. exhibits both asymmetry and dropout . A slight adjustment and / of realignment of the outline can lead to a reasonable outcome. 
Anti aliasing Techniques  Most aliasing artifacts, when appear in a static image at a moderate resolution are often tolerable and in many cases, negligible, However, they can have a significant impact on our viewing experience when lift untreated in a series of images that animate moving objects. For example a line being rotated around one of its endpoints becomes a rotating escalator with length altering steps. A moving object with small parts of surface details may have some of those features intermittently change shape of even disappear.  Although increasing image resolution is straightforward way to decrease the size of   many aliasing artifacts and alleviate their negative we pay a heavy price in terms of system resource and the results are not always satisfactory. On the other hand there are techniques that can greatly reduce aliasing artifacts and improve the appearance of images without increasing their resolution. These techniques are collectively referred to as anti aliasing techniques. Some anti- aliasing techniques are designed to treat a particular type of artifact. For instance, an outline font can be associated with a set of rules or hints to guide the adjustment and realignment that is necessary for its conversion into bitmaps of relatively low resolution. An example of such approach is called the
True Type font.
1. Pre- filtering and post- Filtering Pre- filtering and post-filtering are two types of general- purpose anti- aliasing techniques. The concept of filtering originates from the field of signal processing, where true intensity values are continuous signals that consist of elements of various frequencies. Constant intensity values that correspond to a uniform region are at the low end of the spectrum. In order to lessen the jagged appearance of lines and other contours in the image space, we seek to smooth out sudden intensity changes, or in signal- processing terms, to filter out the high frequency components. A pre- filtering techniques works on the true signal in the continuous space to derive proper values for individual pixels (filtering before sampling), whereas a post- filtering techniques takes discrete samples of the continuous signal and uses the samples to compute pixel values (sampling before filtering).

2. Area Sampling Area sampling is a pre- filtering techniques in which we superimpose a pixel grid pattern onto the continuous object, definition. For each pixel area that intersects the object, we calculate the percentage of overlap by the object. This percentage determines the proportion of the overall intensity values of the corresponding pixel that is due to the object's contribution. In other words, the higher the percentage of overlap, the greater influence the object has on the pixel's overall intensity value. In fig. (a) a mathematical shown in dotted form is represented by a rectangular region that is one pixel wide. The percentage of overlap between the rectangle and each intersection pixel is calculated analytically. Assuming that the background is black and the line is white, the percentage values can be used directly to set the intensity of the pixel [see fig. (b)]. On the other hand, had the background been gray (0.5, 0.5, 0.5) and the line green (0, 1, 0), each blank pixel in the grid would have had the background gray value and each pixel filled with a fractional number F would have been assigned a value of [0.5 (1-f), 0.5 (1-f) +f, (1-f)] a proportional blending of the background and object colors. Although the resultant discrete approximation of the line in Fig. (c) takes on a blurry appearance, it no longer exhibits the sudden transition from an on pixel to an off pixel and vice versa, which is what we would get with an ordinary scan- conversion method [see in fig.] . This trade- off is characteristic of an anti- aliasing techniques based on supper sampling.

3. Super Sampling In this approach we subdivide each pixel into sub pixels and check the position of each sub pixel in relation to the object to be scan- converted. The object's contribution to a pixel's overall intensity value is proportional to the number of sub pixels that are inside the area occupied by the object. Fig 5 shows a example where we have a white object that is bounded by two slanted lines on a black background. We subdivide each pixel into nine (3*3) subpixels. The scene is mapped to the pixel values in Fig. (b). The pixel at the upper 7 right corner, for instance, is assigned- since seven of its nine sub pixels are inside the object area. Had the object been red (1,0,0) and the background light yellow (0.5, 0.5, 0), the pixel would have been assigned (1*7/9+0.5*2/9,0.5),which is (8/9,1/9,0). Super sampling is often regarded as a post filtering technique since discrete samples are first taken and then used to calculate pixel values. On the other hand it can be viewed as an approximation to the area sampling method since we are simply using a finite number of values in each pixel area to approximate the accurate analytical result. 

4. Low pass Filtering This is a post filtering technique in which we reassign each pixel a new value that is a weighted average of its original value and the original values of its neighbors. A low pass filter in the form of a (2/I + 1) (2/I + 1) grid, where n> 1, holds the weights for the computation. All weight values in a filter should sum to one. To compute a new value for pixel, we align the filter with the pixel grid and center it at the pixel. The weighted average is simply the sum of products of each weight in the filter times the corresponding pixel original value. The filter shown in fig. means that half of each pixel's original value is retained in its new value, while each of the pixel four immediate neighbors contributes one eighth of its original value . A low pass filter with equal weights sometimes referred to as a box filter, is said to be doing neighborhood averaging. On the other hand a filter with its weight values conforming to a two dimensional is called a Gaussian filter.      

5. Pixel Phasing Pixel phasing is a hardware based anti aliasing technique. The graphics system in this case is capable of shifting individual pixels from their normal positions to the pixel grid by fraction of the unit distance between pixels. By moving pixels closer to the true line of other contour this technique is very effective in smoothing out the stair steps without reducing the sharpness of the edges.


No comments:

Post a Comment