Skip to main content

Posts

Showing posts from 2015

Hidden Surface Removal

Look at the scratch code " RotatingSolidCube.cpp " and s tudy it carefully #include #include #include #include typedef struct{float x;float y;}Point2D; float dx = 200, dy = 200, dz = 200; GLfloat n[6][3]; /* Normals for the 6 faces of a cube. */ /* Vertex indices for the 6 faces of a cube. */ GLint faces[6][4] = { //traversed in counterclockwise direction as seen from outside {0, 1, 2, 3}, {3, 2, 6, 7}, {7, 6, 5, 4}, {4, 5, 1, 0}, {5, 6, 2, 1}, {7, 4, 0, 3} }; GLfloat v[8][3]; /* Will be filled in with X,Y,Z vertexes. */ void init(void) { /* Setup cube vertex data. */         v[0][0] =100; v[0][1] = 100; v[0][2] = 300;           v[1][0] =300; v[1][1] = 100; v[1][2] = 300;         v[2][0] =300; v[2][1] = 300; v[2][2] = 300;         v[3][0] =100; v[3][1] = 300; v[3][2] = 300;         v[4][0] =100; v[4][1] = 100; v[4][2] = 100;         v[5][0] =300; v[5][1] = 100; v[5][2] = 100;         v[6][0] =300; v[6][1] = 300; v[6][2] = 100;         v[7][0] =10

3D transformation & Projection

Clearly understand the given scratch code for the standard perspective projection. scratch code :  Pres_Proj.cpp Complete the code to  project the cube on the XY plane with the COP is at (0,0,-200) Use 2D translation to shift the projected cube so that the origin (0,0) moves to the centre of the screen [i.e., move the system to (WinWidth/2, WinHeight/2)] Use 3D translation to project the cube with COP is at (100,100,-200) The following file contain the answer for the above questions. While the file runs you can see the answer for 1. If you press your left-mouse button you will see the answer for 2. And by pressing right-mouse button you can view the answer for 3. PerspectiveProjection.cpp Enjoy.. #TRASHCODERS

Some more for your Hunger - I suppose

Now let's do some more. On my last post I've given a program to control contrast, Let's do Auto-Contrast now. autocontrast.m So, I think what is meant by Auto-contrast by doing some changes in the above program. Let's try Modified-Auto-Contrast. modautocontrast.m The last for this post will  be Alpha-blending.. alphablend.m

Point Operations

Okay, Now we have some basic idea of an Image, Let's do some Basic Point Operations on some images. Always remember to test these with low resolution images. Because, Larger images takes more time to process the image. For, Starters do with 512x512 is appropriate. Basic Point Operations Brightness - Increasing and reducing the image's Brightness brightness.m Contrast - Controlling the Contrast of an image contrast.m Threshold - Doing threshold operation with a specific Threshold value threshold.m Inverting - Inverting an image invert.m Do some changes in these and try it yourself for more understanding #TRASHCODERS

Finding the histogram of an image

Okay, on the last post I've said what is an histogram. Now let's do a simple example on MATLAB to understand the concept. We will be using some well known Images for our exercises. "Lena", "Barbara", "Baboon" are some. For finding the histogram I'm providing two programs. One returns the histogram as output. histogram.m One returns three graphs of three different images to look the difference. histrogram3.m #TRASHCODERS

Image Processing

Okay, Now let's start doing Image Processing exercises on MATLAB. Before diving in let's start knowing what are the terms "Histograms", "Cumulative Histograms" and "Histogram Equalization" of an image. Let's see what are those, Histogram An image histogram is a type of histogram that acts as a graphical representation of the tonal distribution in a digital image. It plots the number of pixels for each tonal value. By looking at the histogram for a specific image a viewer will be able to judge the entire tonal distribution at a glance. Cumulative Histogram A cumulative histogram is a mapping that counts the cumulative number of observations in all of the bins up to the specified bin. That is, the cumulative histogram M i of a histogram m j is defined as:  Histogram Equalization Histogram equalization is a method in image processing of contrast adjustment using the image's histogram. for more definitions visit wik

Using GitHub within a Corporate Proxy

So, when you are going use GitHub in your Windows PC/Laptop, use these steps to connect through. Step 1 : Go to your user-profile in your PC/Laptop C:\Users\<%USERPROFILE%> Step 2 : You will find a file ".gitconfig" Step 3 : Open it with any text editor. (Notepad++ recommended) Step 4 : Add the following lines with appropriate info's [http]    proxy = http:// : @ : [https]  proxy = https:// : @ : Step 5 : Just close your GitHub on Windows and open it again. Viola!! You are now up and running.. #TRASHCODERS

Window to Viewport Mapping

1.  Try to execute the " ViewPortMap.cpp " with various values o f  bottomX,  bottomY,  width, and  height. 2.  Modify this code to get the display  a) such as this one b) and such as this And the answers are   Question 2)a)    Question 2)b) Enjoy!! #TrashCoders

Transformation and Translation

The solution will be posted soon... Try it out..

Rotating a Line w.r.t Origin and an Endpoint

Assignment 10 Rotating a given point in a anticlockwise direction about the origin in 2D. (You can specify a point by the left mouse button, and click the right mouse button to rotate it). Write a program to rotate any  line  through an angle (say 30 o ) with respect to  the origin [ Answer ]  one of its end points [ Answer ]

2D Transformation (Scale and Translate)

Write a program to accomplish the following tasks: draw a rectangle with vertices (0,0), (0,100), (200,100), (200,0). translates the rectangle to the mouse clicked location. Zoom-in the shape by pressing the "+" key, and  Zoom-out by pressing the "-" key. (Hint: Use the equations x = x 0 *S x , and y = y 0 *S y , where S x  and S y  are constants)    The file for the above will be available [-here-]  

Some Basic Questions and answers on Operating System Concepts

1.        What are the three main purposes of an operating system? To provide an environment for a computer user to execute programs on computer hardware in a convenient and efficient manner. To allocate the separate resources of the computer as needed to solve the problem given. The allocation process should be as fair and efficient as possible. As a control program it serves two major functions: (1)    supervision of the execution of user programs to prevent errors and improper use of the computer, and (2)    Management of the operation and control of I/O devices. 2.       Keeping in mind the various definitions of operating system, consider whether the operating system should include applications such as web browsers and mail programs. Argue both that it should and that it should not, and support your answers. Point: Applications such as web browsers and email tools are performing an increasingly important role in modern desktop computer systems. To fulfill