CSE 4227 · Deck 10 · Chain code, CFD, shape number

Chain Code Paper Trainer

Walk the boundary arrow by arrow, then turn the code into the CFD and the shape number. Show me plays the whole answer one step at a time. Do it yourself makes you pick every direction, count every CFD step and find where the 0s start, and marks each one.

Everything in this chapter is three moves

STEP 1 · CHAIN CODE (CC)

Stand on the start pixel. Look at the next boundary pixel. Write the number of the arrow that points to it. Step there. Repeat until you are back at the start.

STEP 2 · CFD

From each digit to the next, count the anticlockwise steps on the compass. Same arrow = 0. The last digit goes to the first. This kills rotation.

STEP 3 · START AT THE 0

Underline the 0s. Start at the longest run of 0s (the end joins the start), read to the end, wrap round. Two runs the same length? Compare the digits after them. On the CC: start-point invariant. On the CFD: the NCFD = shape number.

Arrow numbers go round counterclockwise from 0 = right, like angles: k means k × 45°. Rows count downward, so a smaller row number is “up”.

Trainer

Mode

Things that cost marks