home/exp1000/acquire_and_label_images.py
def acquire_image(self):
        """Acquire an image with the on-board camera."""

        # Build the image acquisition execution command string.
        cmd_image_acquisition = 'ims100_testapp -R {R} -G {G} -B {B} -c /dev/cam_tty -m /dev/cam_sd -v 0 -n 1 -p -e {E} >> {L} 2>&1'.format(\
            R=self.gains[0],\
            G=self.gains[1],\
            B=self.gains[2],\
            E=self.exposure,\
            L=LOG_FILE)
        
        # Log the command that will be executed.
        logger.info("Running command to acquire an image: {C}".format(C=cmd_image_acquisition))

        # Run the image acquisition command. 
        os.system(cmd_image_acquisition)

        # Check that png file exists...
        png_files = glob.glob(BASE_PATH + "/*.png")
        
        # If the png file doesn't exist then skip this iteration.
        if len(png_files) != 1:
            logger.error("Failed to acquire an image from the camera.")
            return None
            
        else:
            file_png = png_files[0]
            
            # An error in running the ims100_test_app command could result in an empty image file.
            # Make sure this is not the case.
            if Path(file_png).stat().st_size > 0:
                logger.info("Acquired image: " + file_png)

            else:
                # Empty image file acquired. Log error and skip image classification.
                logger.error("Image acquired from the camera is an empty file (0 KB).")
                return None

        # Return error status
        return file_png
Acquire an image with the on-board camera.
Acquire an image with the on-board camera.
Acquire an image with the on - board camera .
def acquire_image(self):
        cmd_image_acquisition = 'ims100_testapp -R {R} -G {G} -B {B} -c /dev/cam_tty -m /dev/cam_sd -v 0 -n 1 -p -e {E} >> {L} 2>&1'.format(\
            R=self.gains[0],\
            G=self.gains[1],\
            B=self.gains[2],\
            E=self.exposure,\
            L=LOG_FILE)
        logger.info("Running command to acquire an image: {C}".format(C=cmd_image_acquisition))
        os.system(cmd_image_acquisition)
        png_files = glob.glob(BASE_PATH + "/*.png")
        if len(png_files) != 1:
            logger.error("Failed to acquire an image from the camera.")
            return None
        else:
            file_png = png_files[0]
            if Path(file_png).stat().st_size > 0:
                logger.info("Acquired image: " + file_png)
            else:
                logger.error("Image acquired from the camera is an empty file (0 KB).")
                return None
        return file_png
def acquire_image ( self ) : cmd_image_acquisition = 'ims100_testapp -R {R} -G {G} -B {B} -c /dev/cam_tty -m /dev/cam_sd -v 0 -n 1 -p -e {E} >> {L} 2>&1' . format ( R = self . gains [ 0 ] , G = self . gains [ 1 ] , B = self . gains [ 2 ] , E = self . exposure , L = LOG_FILE ) logger . info ( "Running command to acquire an image: {C}" . format ( C = cmd_image_acquisition ) ) os . system ( cmd_image_acquisition ) png_files = glob . glob ( BASE_PATH + "/*.png" ) if len ( png_files ) != 1 : logger . error ( "Failed to acquire an image from the camera." ) return None else : file_png = png_files [ 0 ] if Path ( file_png ) . stat ( ) . st_size > 0 : logger . info ( "Acquired image: " + file_png ) else : logger . error ( "Image acquired from the camera is an empty file (0 KB)." ) return None return file_png
Acquire an image with the on-board camera.
Acquire an image with the on - board camera .
"""Acquire an image with the on-board camera.""" # Build the image acquisition execution command string. # Log the command that will be executed. # Run the image acquisition command.  # Check that png file exists... # If the png file doesn't exist then skip this iteration. # An error in running the ims100_test_app command could result in an empty image file. # Make sure this is not the case. # Empty image file acquired. Log error and skip image classification. # Return error status
self