Search a bitmap in rgb format and count the number

Assignment Help Computer Graphics
Reference no: EM132105133

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

Reference no: EM132105133

Questions Cloud

Ethical dilemma that a project team member might face : Discuss how the project manager could aid in avoiding or resolving such a dilemma. Discuss where this dilemma falls within PMI codes.
Write a recursive method waystoclimb : You want to count the number of ways to climb the entire staircase based on different combinations of large and small strides.
What are project reports : What are project reports and how does help with me with report writing in the future?
What are the four precedence diagram methods : What are the four precedence diagram methods? Give an example of each.
Search a bitmap in rgb format and count the number : You are to search a bitmap in RGB format and count the number of pixels which match a set of colors.
What is the impact of crashing on the project : When should a project crash? What is the impact of crashing on the project, which affects compressing the project's schedule?
Scheduling software in a project schedule : What are some benefits and values of scheduling software in a project schedule?
Compute the average number of letters per sentence : A data file for this exercise will consist of several lines of text that form sentences. The text may include letters, punctuation marks, and/or digits.
Consider health and safety legislation : Why is it necessary to consider health and safety legislation, regulations and requirements in the context of any project work?

Reviews

Write a Review

Computer Graphics Questions & Answers

  Create a simple warm-up program using your g3d

Create a simple warm-up program using your G3D programming and graphics environment.

  Shadow effect while rolling a sphere

Shadow effect while rolling a sphere as well as the options of shading and lighting.

  Relative positioning and interactive positioning

Relative Positioning and Interactive Positioning by Dragging and Clicking and some Simple Animation

  Draw a teapot at the global origin

Draw a teapot at the global origin

  Concepts of computer graphics

Concepts of Computer Graphics and develop a program using OpenGL

  The security policy document outline

Using the GDI Case Study below, complete the Security Policy Document Outline

  Develop the image manipulations

Develop the image manipulations

  What does resolution mean

What does resolution mean How is resolution connected to ppi and dpi units

  Differentiate between a bitmap image and a vector image

Differentiate between a bitmap image and a vector image Explain the following terms

  Essential elements of a design pattern

configuration of an Iterator pattern, patterns could be used in a Library System, Singleton, Template, Decorator, Façade,What does Alexander means by the following declaration "But it is impossible to form anything which has the temperament of natu..

  Framework of user interface design

design of user interfaces, natural mapping, GUI applications, web page design different to designing for printed media, risks exposed in this "phone as individual proxy" approach, interaction designers of ubicomp applications, Storyboards are usual..

  What are the factors affecting picture composition

Define picture composition What are the factors affecting picture composition. Elaborate on each factor Describe the basic lines present in a composition

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd