Example #1
0
    def processImages(self, image1):

        """
        The rest of the logic to stitch the image
        Args:
            image1: image from camera 1
        Returns:
            finalImage: image to be displayed to user to confirm it is correct
        """
        configCom = ConfigCommunicator()

        # Grabs skew info from config, and creates instance of ScannerCamera()

        skewObject = ScannerCamera(1)
        mtx, dist, newmtx = configCom.getSkew(1)
        skewObject.setSkewMtx(mtx, dist, newmtx)
        # Process board image
        image1 = skew_correction(image1, skewObject)

        # Grabs scale info from config
        dictionary = configCom.getScale()

        scale_detect = ScaleDetection()
        scale_detect.setScale(dictionary['x_scale'], dictionary['y_scale'], dictionary['units'])


        #finalImage = stitch_images(image1, image2)
        finalImage = image1
        cv2.imwrite('FinalImage.jpg', finalImage)
        contours, contourImage = find_contours(np.array(finalImage, dtype=np.uint8))
        xscale, yscale, units = get_scale(scale_detect)
        export_json(contours, xscale, yscale, units) #do I need to do something with return value?


        return contourImage #do we want to show the contours on this as well?