pattern detector based on opencv