Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Say there’s an existing component (service or actuator) that does almost everything you want it to, but there’s some slight changes you wish you could make. Luckily, SIC’s object-oriented architecture enables you to inherit from and extend the component you wish to modify. Let’s take the ‘detect’ function of the FaceDetectionComponent service, for example:

Code Block
    def detect(self, image):
        img = array(image).astype(np.uint8)

        gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)

        faces = self.faceCascade.detectMultiScale(
            gray,
            scaleFactor=1.2,
            minNeighbors=5,
            minSize=(int(self.params.minW), int(self.params.minH)),
        )

        faces = [BoundingBox(x, y, w, h) for (x, y, w, h) in faces]

        return BoundingBoxesMessage(faces)

...