Fiducial recognition code.