Exercises

  1. Neglecting image noise, does the IPAN algorithm return the same "dominant points" as we zoom in on an object? As we rotate the object?

  2. Finding the extremal points (i.e., the two points that are farthest apart) in a closed contour of N points can be accomplished by comparing the distance of each point to every other point.

  3. Create a circular image queue using CvSeq functions.

  4. What is the maximal closed contour length that could fit into a 4-by-4 image? What is its contour area?

  5. Using PowerPoint or a similar program, draw a white circle of radius 20 on a black background (the circle's circumference will thus be 2 π 20 ≈ 125.7. Save your drawing as an image.

  6. Using the circle drawn in exercise 5, explore the results of cvFindDominantPoints()as follows.

  7. Subpixel corner finding. Create a white-on-black corner in PowerPoint (or similar drawing program) such that the corner sits on exact integer coordinates. Save this as an image and load into OpenCV.

  8. Suppose we are building a bottle detector and wish to create a "bottle" feature. We have many images of bottles that are easy to segment and find the contours of, but the bottles are rotated and come in various sizes. We can draw the contours and then find the Hu moments to yield an invariant bottle-feature vector. So far, so good'but should we draw filled-in contours or just line contours? Explain your answer.

  9. When using cvMoments() to extract bottle contour moments in exercise 8, how should we set isBinary? Explain your answer.

  10. Take the letter shapes used in the discussion of Hu moments. Produce variant images of the shapes by rotating to several different angles, scaling larger and smaller, and combining these transformations. Describe which Hu features respond to rotation, which to scale, and which to both.

  11. Make a shape in PowerPoint (or another drawing program) and save it as an image. Make a scaled, a rotated, and a rotated and scaled version of the object and then store these as images. Compare them using cvMatchContourTrees() and cvConvexityDefects(). Which is better for matching the shape? Why?