Ejemplo n.º 1
0
def take_image(filename):
    """take_image: The function will create a Operating System timestamp variable (OS_time), configure
                the 2 IRCSP cameras to take an image (image1 & image2) and store the FPA temperatures
                (temp1 & temp2) into an HDF5 File format with a unique naming convention.

    Parameters:
                filename - the filename of the HDF5 file.


    Returns: HDF5 file with 2 FLIR Boson Images, 2 FPA Temperatures & OS_time string.
    """

    # Time/Speed Test - Start
    start = datetime.datetime.now()

    #Create Timestamp for File Creation Tracking
    now = datetime.datetime.now()
    OS_time = now.strftime("%H:%M")

    camera1 = Boson(port='/dev/ttyACM0')
    camera2 = Boson(port='/dev/ttyACM1')

    #set FFC to manual
    camera1.set_ffc_manual()
    camera2.set_ffc_manual()

    #get FPA temperature
    temp1 = camera1.get_fpa_temperature()
    temp2 = camera2.get_fpa_temperature()

    #Take Image
    image1 = camera1.grab(device_id = 1)
    image2 = camera2.grab(device_id = 2)


    #Close Camera
    camera1.close()
    camera2.close()

    # Open as Read-Write ("a" - creates file if doesn't exist)
    with h5py.File(filename, "a") as h5:
        h5.attrs["OS_time"] = OS_time
        h5["image1"] = image1
        h5["image2"] = image2
        h5["temp1"] = temp1
        h5["temp2"] = temp2


    #Time/Speed Test - Finish
    finish = datetime.datetime.now()
    print("Image Capture File: ", filename," created in " , finish - start)

    #Adjust Sleep Value for File Creation Rate - (File/Seconds)
    time.sleep(10)
Ejemplo n.º 2
0
name = "dark"
save_path = 'C:\\Users\\khart\\Documents\\IRCAM_data\\jun032021\\'

#SET UP MOTOR
motor = apt.Motor(83830277)

#set velocity parameters to be maximum
[minv, a, v] = motor.get_velocity_parameters()
[maxa, maxv] = motor.get_velocity_parameter_limits()

motor.set_velocity_parameters(minv, maxa, maxv)
motor.move_home(True)

#initialize camera
camera = Boson(port='COM4')
camera.set_ffc_manual()
wait = 5
frames = 100


def take_image(frames):
    image = np.zeros([frames, 256, 320])
    for i in range(frames):
        im = camera.grab(device_id=1)
        image[i] = im
    return (np.mean(image, axis=0))


#measurement sequence
I0 = take_image(frames)
motor.move_by(45)
Ejemplo n.º 3
0
from flirpy.camera.boson import Boson
import numpy as np
import matplotlib.pyplot as plt
import os.path
import h5py
import time

#ask user to input correct COM port
COM = input("What is the COM PORT? \n ")
print("Attempting to open ", COM)

#open camera object and set FFC to manual
try:
    cam = Boson(COM)
    cam.setup_video(device_id=1)
    cam.set_ffc_manual()
    temp = cam.get_fpa_temperature()
    print('The FPA temp is ', temp, ' C')
except:
    print('Could not open COM port, check camera is not in use')

#Ask user if an initical ffc is requested
ffc = input('would you like to do an initial ffc? [y,n] \n')

if ffc in ['Y', 'y', 'Yes', 'yes', 'YES']:
    print('Initiating FFC')
    cam.do_ffc()

#Ask user how many images and at what intervals
num = int(input('How many images to take? \n'))
wait = float(input('How long to wait between images [s]? \n'))
Ejemplo n.º 4
0
Created on Tue Sep  8 09:50:57 2020

@author: khart
"""

import matplotlib.pyplot as plt
from flirpy.camera.boson import Boson

camera1 = Boson(port='COM5')
camera2 = Boson(port='COM6')

print(camera1.find_video_device())
print(camera2.find_video_device())

# set FFC to manual
camera1.set_ffc_manual()
camera2.set_ffc_manual()

# get FPA temperature
temp1 = camera1.get_fpa_temperature()
temp2 = camera2.get_fpa_temperature()

# take image
im1 = camera1.grab(device_id=1)
im2 = camera2.grab(device_id=2)
camera1.close()
camera2.close()

plt.imshow(im1)
plt.title('camera 1 ' + str(temp1))
plt.show()