diff --git a/homeassistant/components/opencv/image_processing.py b/homeassistant/components/opencv/image_processing.py index f35d063de50..6b5e4e85513 100644 --- a/homeassistant/components/opencv/image_processing.py +++ b/homeassistant/components/opencv/image_processing.py @@ -160,6 +160,9 @@ class OpenCVImageProcessor(ImageProcessingEntity): """Process the image.""" cv_image = cv2.imdecode(numpy.asarray(bytearray(image)), cv2.IMREAD_UNCHANGED) + matches = {} + total_matches = 0 + for name, classifier in self._classifiers.items(): scale = DEFAULT_SCALE neighbors = DEFAULT_NEIGHBORS @@ -177,8 +180,6 @@ class OpenCVImageProcessor(ImageProcessingEntity): detections = cascade.detectMultiScale( cv_image, scaleFactor=scale, minNeighbors=neighbors, minSize=min_size ) - matches = {} - total_matches = 0 regions = [] # pylint: disable=invalid-name for (x, y, w, h) in detections: