Pointers on solving this Image Processing challenge?
c, c++, image
Solution
Since you are provided the image data in RGB format, first prepare a copy of the same image data in YUV. This is essential as some of the image features are easily identified patterns in the Luma(Y) and Chroma(U,V) maps.
Based on the samples provided, here are some of the salient features of each "style" of art :
Style1 - Neoplastic modern art
- Zero graininess - Check for large areas with uniform Luma(Y)
- Black pixels at edges of the areas(transition between different chroma).
Style2 - Impressionist landscapes
- High graininess - Check for high entropy (salt-n-pepper-noise like) patterns in Luma(Y).
- Pre-dominantly green - High values in green channel. Greenavg >> Redavg Greenavg >> Blueavg
Style3 - Expressionist action paintings
- High graininess - Check for high entropy (salt-n-pepper-noise like) patterns in Luma(Y).
- NOT green.
Style4 - Color field paintings
- Zero graininess - Check for large areas with uniform Luma(Y)
- NO black(or near black) pixels at the transition between different chroma.
As long as the input image belongs to one of these classes you should have no trouble in classification by running the image data through functions that are implemented to identify the above features.
Basically it boils down to the following code-flow :
- Image has uniform luma?
- (If Yes) Image has black pixels at chroma transitions?
- (If Yes) Style1
- (If No) Style4
- (If No) Image is green-ish?
- (If Yes) Style2
- (If No) Style3
Problem
The 2nd problem in IOI 2013 states: You have an Art History exam approaching, but you have been paying more attention to informatics at school than to your art classes! You will need to write a program to take the exam for you. The exam will consist of several paintings. Each painting is an example of one of four distinctive styles, numbered 1, 2, 3 and 4. Style 1 contains neoplastic modern art. Style 2 contains impressionist landscapes. Style 3 contains expressionist action paintings. Style 4 contains colour field paintings. Your task is, given a digital image of a painting, to determine which style the painting belongs to. The image will be given as an H×W grid of pixels. The rows of the image are numbered 0, …, (H 1) from top to bottom, and the columns are numbered 0, …, W 1 from left to right. The pixels are described using twodimensional arrays R , G and B , which give the amount of red, green and blue respectively in each pixel of the image. These amounts range from 0 (no red, green or blue) to 255 (the maximum amount of red, green or blue). Implementation You should submit a file that implements the function style(), as follows: ``` int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]); ``` This function should determine the style of the image. Parameters are: - H: The number of rows of pixels in the image. - W: The number of columns of pixels in the image. - R: A twodimensional array of size H×W , giving the amount of red in each pixel of the image. - G: A twodimensional array of size H×W , giving the amount of green in each pixel of the image. - B: A twodimensional array of size H×W , giving the amount of blue in each pixel of the image. Example pictures are in the problem PDF I do not want a readymade program. A hint or two to get me started would be nice, as I am clueless about this might be solved.