Example #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)
Example #2
0
And a single polarization state (unpol, H,V, ect)
Output will be saved as a hdf5 file 
Uses flirpy, make sure enviroment is open
uses python-usbtmc

@author: khart
"""
from flirpy.camera.boson import Boson
import matplotlib.pyplot as plt
import numpy as np
import h5py
import time

#choose the ROI
ymin = 100
ymax = 250
xmin = 100
xmax = 200

camera1 = Boson()
print(camera1.find_serial_device())
image1 = camera1.grab()
t1 = camera1.get_fpa_temperature()
camera1.close()

print('cam temp is ' + str(t1) + ' C')

plt.matshow(image1[xmin:xmax, ymin:ymax])
plt.colorbar()
plt.show()
Example #3
0
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'))
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()

plt.imshow(im2)
plt.title('camera 2 ' + str(temp2))
plt.show()
Example #5
0
motor.set_velocity_parameters(minv, maxa, maxv)
motor.move_home(True)

for a in range(angle_start, angle_stop, angle_step):

    name = str(int(a)) + 'deg.h5'
    print('starting ' + name)

    t1s = np.zeros(meas_num)
    t2s = np.zeros(meas_num)
    ims1 = np.zeros((meas_num, 256, 320))
    ims2 = np.zeros((meas_num, 256, 320))

    for i in range(meas_num):
        # get FPA temperature
        t1s[i] = camera1.get_fpa_temperature()
        t2s[i] = camera2.get_fpa_temperature()

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

        ims1[i, :, :] = im1
        ims2[i, :, :] = im2

        time.sleep(wait)

    # move motor
    print('completed ' + name)
    print('cam 1 is {0}'.format(str(t1s[i])))
    print('cam 2 is {0}'.format(str(t2s[i])))