The input BMP image (24-bit RGB) contains one of three food types from the given set (Table 1). Your task is to recognize the food and print in the console window its three-character code given in Table 1.

The recognition should be performed in two/three steps:

  1. Preparation of the histogram of given color component (table 1). The histogram contains number of pixels for each value of given color component.
  2. Based on the histogram the mode should be calculated. Mode of a set of data values is the value that appears most often.
  3. Mode ranges of images belonging to different food types are different. So, you can make decision which food type the image should be assigned to.

Input
BMP file containing the source image:
- sub format: 24 bit RGB – no compression,
- size: width 200px, height up to 200 px,
- file name: “source.bmp”

Output
- Console window – plain text
enter image description here

I don't think I understood the problem clearly.

What I understood is this:

  1. Each food item has a specific major color-component (and, hence, a fixed mode-value of that specific color component). First, I need to calculate all mode values, and use them as constants in my program.
  2. When I am given a sample image as an input, 1st I need to see which component is major (based on its mode-value).
  3. Then, I need to compare that mode-value with previously computed constant mode values.
  4. Closest one matches the food.

Am I correct?

If that is so, what is the purpose of that table with 12 rows? What is it given for?

Especially, take a look at 11th row of the table where all pictures are red, but says green-component.

0 Answers