Key to Minor - I


  1. A photo contains pink and red flowers. It is needed to pick only the pink but not the red flowers. Write down an algorithm to do so for images represented in the RGB space. State the problems if any in picking up the pink flowers. Which colour space do you think is best for this task? Why?

    (This is an open question with no single correct answer)
    Pink is an unsaturated red colour. It is not very easy to define it in the RGB colour space, but a possible definition is that

    • \(R > 140\)
    • \(R > G, R > B\)
    • \(G \approx B\)
    • \(R - G > 20, R - B > 20\)
    For every pixel in the image, check if the above conditions are satisfied. If yes, output the colour as it is; if not, output \(0\).

    Pink and red are easier to separate in HSI space. Both have the same hue but their saturation values are different. The definition of pink in HSI space may be

    • \(S > 0.33\) and \(S < 0.67\)
    Why is the first part of the condition important?
  2. Write down two \(3\times3\) masks – one for retaining only the details and another for enhancing the details. Write down the reasoning for your design of the masks.

    -1-1-1
    -18-1
    -1-1-1
    This mask retains only the details. All the uniform regions become \(0\).

    -1-1-1
    -19-1
    -1-1-1
    This mask enhances the details. All the uniform regions are unaffected while the details get enhanced.

    Any mask containing positive and negative coefficients summing up to \(0\) is a high-pass filter that retains only the details. An edge detector is a special case of detail enhancer where the positive and negative values are separable by a straight line.

    Any mask containing positive and negative coefficients summing up to \(1\) is a detail enhancement filter. When such a mask is used, the uniform regions remain the same in the output but the variations in intensity are enhanced.

    It is also a good practice to keep the masks symmetric around their centre for general purpose processing.


  3. Given below is a histogram of the red component of a 640 × 480 image that was taken with a camera whose sensor was not as sensitive to red as to the other two colours. Write down the precise equation of a point operation that you would use to enhance the red colour. Assume that the maximum intensity is 164.

    Almost all of you answered this correctly. The simplest solution is a linear stretch using the equation $$ I^\prime(x,y) = \frac{255}{I_h - I_l}(I(x,y) - I_l) $$ where \(I_h\) is the maximum input value of red pixels (=164) and \(I_l\) is the minimum value (=32).


  4. Find the resulting value at the centre of the image segment given below when using \(3\times3\) scalar and vector median filters.
    (200, 100, 50)(200, 150, 50) (150, 150, 100)
    (230, 80, 80)(200, 180, 30) (100, 100, 100)
    (200, 150, 100)(100, 140, 70) (200, 150, 150)

    Scalar median filter replaces the value at the centre with the individual medians of the components which come out as (200, 150, 80).

    Vector median filter has three major steps.

    • Calculate mean colour \(\overline{C}\) which comes to (175, 133, 81).
    • Calculate distances of each pixel to \(\overline{C}\).
    • Pick the smallest distance. It is the colour closest to \(\overline{C}\). Replace the central pixel with it.
    The vector median is (200, 150, 100).


  5. Write down a \(5\times5\) mask for detecting edges oriented at \(150^\circ\). Explain in one or two sentences why it will detect such edges. $$ \begin{array}{|c|c|c|c|c|} \hline -1 & -1 & -1 & -1 & -1 \\ \hline 0 & 0 & -1 & -1 & -1 \\ \hline 1 & 1 & 0 & -1 & -1 \\ \hline 1 & 1 & 1 & 0 & 0 \\ \hline 1 & 1 & 1 & 1 & 1 \\ \hline \end{array} $$ An edge detector has both positive and negative coefficients which sum up to 0. It is also possible to draw a line such that all the positive coefficients are on one side and all the negative coefficients are on the other side. The angle of edges detected is the angle made by this line. The exact angle, this mask detects is about \(154^\circ\). Figure it out yourself.