Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Graphics Expert

The problem:

You are to search a bitmap in RGB format and count the number of pixels which match a set of colors. The bitmap will be 1024 by 1024 pixels for the purposes of explaining this problem. The set of colors will comprise 64 entries.

Input:

You shall process a file named CS546.bmp located in the C:\Temp directory. Note that your program will be tested with different sized bit maps. You will also receive a file containing the 64 colors, formatted as three integer values in the range of 0 to 255 (for red, green, and blue), along with a color name. The color name is a string which may contain spaces and apostrophes. For example:

79 105 198 Indigo
95 167 119 Forest Green
0 204 204 Robin's Egg Blue

This file will be named Colors64.txt and it will be located in the C:\Temp directory. You should assume that the number of colors in the file may vary. You should reject any input which has a negative value, or a value greater than 255 and display an appropriate message.

Processing:

1) Open the input files. End the program execution if either open fails. Initialize CPU time and storage usage measurements.

2.) Read the color file and construct an appropriate container. (For example, an array of structures would be appropriate here. CS532 students may substitute a more sophisticated method.) Initialize the color array (or whatever technique is used) with the contents of the color file. Include an integer count initialized to zero for each entry.

Read the bitmap array. For each pixel in the bitmap, determine if it matches one of the color entries. Maintain a count of the comparisons, matching or not. If it does, add one to the count associated with that entry. If it does not match any entries in the table, add one to a separate count of unmatched color entries.

Output

When all pixels in the bitmap have been evaluated, print out the color name and count of matches from the color array (or whatever other data structure you have chosen). Print the count of comparisons.

The following is the colors.txt file you may use for testing:

Apricot 253 213 177
Aquamarine 149 224 232
Bittersweet 254 111 94
Black 0 0 0
Blue 46 180 230
Blue-Gray 200 200 205
Blue-Green 0 149 183
Blue-Violet 100 86 183
Brick Red 198 45 66
Brown 175 89 62
Burnt Orange 255 112 52
Burnt Sienna 233 116 81
Cadet Blue 169 178 195
Carnation Pink 255 166 201
Copper 218 138 103
Cornflower 147 204 234
Forest Green 95 167 119
Gold 146 146 110
Goldenrod 252 214 103
Gray 139 134 128
Green 58 166 85
Green-Blue 40 135 200
Green-Yellow 241 231 136
Lavender 191 143 204
Lemon Yellow 255 255 159
Magenta 246 83 166
Mahogany 202 52 53
Maize 242 198 73
Maroon 195 33 72
Melon 254 186 173
Midnight Blue 0 70 140
Mulberry 200 80 155
Navy Blue 0 102 204
Olive Green 181 179 92
Orange 255 136 100
Orange-Red 255 63 52
Orange-Yellow 248 213 104
Orchid 226 156 210
Peach 255 203 164
Periwinkle 195 205 230
Pine Green 1 120 111
Plum 142 49 121
Raw Sienna 210 125 70
Raw Umber 102 82 51
Red 237 10 63
Red-Orange 255 104 31
Red-Violet 187 51 133
Salmon 255 145 164
Scarlet 253 14 53
Sea Green 147 223 184
Sepia 158 91 64
Silver 201 192 187
Sky Blue 118 215 234
Spring Green 236 235 189
Tan 217 154 108
Thistle 235 176 215
Turquoise Blue 108 218 231
Violet 115 46 108
Violet-Blue 118 110 200
Violet-Red 247 70 138
White 255 255 255
Yellow 252 232 131
Yellow-Green 197 225 122
Yellow-Orange 255 174 66

Computer Graphics, Computer Science

  • Category:- Computer Graphics
  • Reference No.:- M93092602

Have any Question?


Related Questions in Computer Graphics

Question a describe the architecture of simple raster

Question : a) Describe the architecture of simple raster graphics system? b) Explain raster scan display processor?

The problemsit is strongly recommended that you tackle the

The problems: It is strongly recommended that you tackle the following tasks in a modular way -- a separate standalone function for each task. Draw a rectangle as a Rectangle and as a Polygon. Make the lines of the Polyg ...

The saffir-simpson hurricane scale classifies hurricanes

The Saffir-Simpson Hurricane Scale classifies hurricanes into five categories numbered 1 through 5. Write an application named Hurricane that outputs a hurricane's category based on the user's input of the wind speed. CA ...

Please read my question if you post copy and pasted code

Please read my question if you post copy and pasted code you will get a negative review. This is java In this graphical program, you are going to simulate arcade car racing game. You need a single player that is movable ...

The problemyou are to search a bitmap in rgb format and

The problem: You are to search a bitmap in RGB format and count the number of pixels which match a set of colors. The bitmap will be 1024 by 1024 pixels for the purposes of explaining this problem. The set of colors will ...

You have a program draw a rectangle on the screen and allow

You have a program draw a rectangle on the screen and allow the user to change the color/size of the rectangle. The program will store in the browser the settings of the color/size so that upon revisiting the page, the v ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As