implemented binary template matching data recording.