def single_scan_for_max_temperature(self):
        lepton_interface = Lepton_interface()
        # time.sleep(0.2)
        raw_values = lepton_interface.get_raw_values()              # Get camera output (raw values)
        max_temperature_old = self.get_max_temperature_data(raw_values)  # Get the maximum temperature from raw values

        return max_temperature_old                                      # Return the max temperature
Ejemplo n.º 2
0
    def iterate_for_max_temperature(self):
        lepton_interface = Lepton_interface()
        ITERATIONS = 5  # How many times to take image
        max_temperature_old = {
            "max_raw_pixel": 0,
            "max_pixel_locations_x": 0,
            "max_pixel_locations_y": 0,
            "max_temperature": 0,
            "raw_values": 0,
            "min_temperature": 0
        }
        # Initialize variable
        for i in range(0, ITERATIONS - 1):  # Repeat as required by Iterations
            time.sleep(0.2)
            raw_values = lepton_interface.get_raw_values(
            )  # Get camera output (raw values)
            max_temperature_new = self.get_max_temperature_data(
                raw_values)  # Get the maximum temperature from raw values
            if max_temperature_new["max_temperature"] > max_temperature_old[
                    "max_temperature"]:
                max_temperature_old = max_temperature_new  # If new temp is max, record new max temperature
            else:
                continue  # Else keep the old max temperature and continue

        return max_temperature_old  # Return the max temperature
Ejemplo n.º 3
0
    def single_scan_for_max_temperature(self):
        lepton_interface = Lepton_interface()
        # time.sleep(0.2)
        raw_values = lepton_interface.get_raw_values(
        )  # Get camera output (raw values)
        max_temperature_old = self.get_max_temperature_data(
            raw_values)  # Get the maximum temperature from raw values

        return max_temperature_old  # Return the max temperature
Ejemplo n.º 4
0
 def coloured_image_from_raw(self,raw_values, image_scalar):
     STORED_IMAGE_NAME = "DetectionImage1.jpg"
     lepton_object = Lepton_interface()
     # Convert raw data to 8 bit image - takes 0.0008s
     bit8_image = lepton_object.raw_to_8bit(raw_values)
     bit8_image = bit8_image.astype(uint8)
     # Remove non-needed dimension
     bit8_image = bit8_image.squeeze()
     # Colour image takes ~0.005
     coloured_image = self.colour_thermal_image(bit8_image)
     # Scale 8 bit coloured image # CV_INTER_CUBIC might be used - slow but looks better. INTER_NEAREST.
     # INTER_LINEAR takes ~0.025s INTER_CUBIC - ~0.07s. Nearest - 0.01s
     coloured_image = cv2.resize(coloured_image, (0,0), None, image_scalar, image_scalar, cv2.INTER_LINEAR)
     # Takes ~0.2s, updated one takes ~0.0001s
     # cv2.imwrite(STORED_IMAGE_NAME, np.uint8(coloured_image)) # Write the image to file
     mat_array = cv.fromarray(coloured_image)
     # Take the image from file as SIMPLECV image. Updated one ~0.005s
     simplecv_img = Image(mat_array)
     # simplecv_img = Image(STORED_IMAGE_NAME)
     return simplecv_img
    def iterate_for_max_temperature(self):
        lepton_interface = Lepton_interface()
        ITERATIONS = 5                                               # How many times to take image
        max_temperature_old = {"max_raw_pixel": 0,
                               "max_pixel_locations_x": 0,
                               "max_pixel_locations_y": 0,
                               "max_temperature": 0,
                               "raw_values": 0,
                               "min_temperature": 0}
                                                                        # Initialize variable
        for i in range(0, ITERATIONS-1):                                # Repeat as required by Iterations
            time.sleep(0.2)
            raw_values = lepton_interface.get_raw_values()              # Get camera output (raw values)
            max_temperature_new = self.get_max_temperature_data(raw_values)  # Get the maximum temperature from raw values
            if max_temperature_new["max_temperature"] > max_temperature_old["max_temperature"]:
                max_temperature_old = max_temperature_new               # If new temp is max, record new max temperature
            else:
                continue                                                # Else keep the old max temperature and continue

        return max_temperature_old                                      # Return the max temperature
Ejemplo n.º 6
0
 def coloured_image_from_raw(self, raw_values, image_scalar):
     STORED_IMAGE_NAME = "DetectionImage1.jpg"
     lepton_object = Lepton_interface()
     # Convert raw data to 8 bit image - takes 0.0008s
     bit8_image = lepton_object.raw_to_8bit(raw_values)
     bit8_image = bit8_image.astype(uint8)
     # Remove non-needed dimension
     bit8_image = bit8_image.squeeze()
     # Colour image takes ~0.005
     coloured_image = self.colour_thermal_image(bit8_image)
     # Scale 8 bit coloured image # CV_INTER_CUBIC might be used - slow but looks better. INTER_NEAREST.
     # INTER_LINEAR takes ~0.025s INTER_CUBIC - ~0.07s. Nearest - 0.01s
     coloured_image = cv2.resize(coloured_image, (0, 0), None, image_scalar,
                                 image_scalar, cv2.INTER_LINEAR)
     # Takes ~0.2s, updated one takes ~0.0001s
     # cv2.imwrite(STORED_IMAGE_NAME, np.uint8(coloured_image)) # Write the image to file
     mat_array = cv.fromarray(coloured_image)
     # Take the image from file as SIMPLECV image. Updated one ~0.005s
     simplecv_img = Image(mat_array)
     # simplecv_img = Image(STORED_IMAGE_NAME)
     return simplecv_img