A Novel Machine Vision Algorithm for a Fast Response Quality Control System