Attached figure called boxes.pgm has two different kinds of objects in it, object A and object B. Write a program for (a) identifying these in the image and (b) counting how many object A's and how many object B's are there in the image. (The background has gray level value 255 and the object pixels have gray level value 0.)
Specifically do the following
(i) Your program to relabel Object A pixels with value 50 and Object B pixels with value 100 from their present value of 0.
(ii) Your program should output the number of Object A's and Object B's in the image.
Hint: See program for finding connected components in an image, relabelling them and finding their areas.
Figure below shows a scene containing 3 rectangles, A, B, C. Enclosed frame0.pgm and frame1.pgm are two consecutive frames captured using a video camera. Generate an RGB image in which vertical edges of rectangles A and B are displayed in red and blue respectively, horizontal edges of C are displayed in green. The rest of the scene should be displayed in black. You may neglect the corner effects. Submit your source code, and your result (as a ppm file) electronically to gsugata@in.ibm.com. Your source code should be commented, and modular.
Hint: Apply motion detection by image subtraction (taught in class), and convolution with x- and y-directional Sobel operator.