Пример #1
0
 def __init__(self):
     Thread.__init__(self)
     t0 = time.time()
     self.sensor = []
     self.pixels = []
     while (time.time() - t0) < 1:  # wait 1sec for sensor to start
         try:
             # AD0 = GND, addr = 0x68 | AD0 = 5V, addr = 0x69
             self.sensor = amg8833_i2c.AMG8833(addr=0x69)  # start AMG8833
         except:
             self.sensor = amg8833_i2c.AMG8833(addr=0x68)
         finally:
             pass
     time.sleep(0.1)  # wait for sensor to settle
     # If no device is found, exit the script
     if self.sensor == []:
         print("No AMG8833 Found - Check Your Wiring")
Пример #2
0
def amg8833():
    sensor = []
    t0 = time.time()
    while (time.time()-t0) < 1:
        try:
            sensor = amg8833_i2c.AMG8833(addr=0x69)
        except:
            try:
                sensor = amg8833_i2c.AMG8833(addr=0x68)
            except:
                break
        finally:
            pass
    time.sleep(0.1)

    cv2.namedWindow("Waermebild")
    cv2.setWindowProperty(
        "Waermebild", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
    width, height = screen_size()
    if width > height:
        sidelength = height
    else:
        sidelength = width

    cv2.moveWindow("Waermebild", int((width-sidelength)/2), 0)
    while True:
        status, pixels = sensor.read_temp(64)
        if not status:
            smallImage = np.reshape(pixels, (8, 8)).astype(np.uint8)
            contrastEnhancedImage = (smallImage-15)*19
            bigImage = cv2.resize(contrastEnhancedImage,
                                  (sidelength, sidelength))
            colorImage = cv2.applyColorMap(bigImage, cv2.COLORMAP_JET)
            cv2.imshow("Waermebild", colorImage)

        key = cv2.waitKey(1) & 0xFF
        if key == ord("q"):
            break
Пример #3
0
from tensorflow.keras.models import load_model
import numpy as np
import time, sys
import amg8833_i2c
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate

model = load_model("maskerfix1.h5")

t0 = time.time()
sensor = []
while (time.time() - t0) < 1:  # wait 1sec for sensor to start
    try:
        # AD0 = GND, addr = 0x68 | AD0 = 5V, addr = 0x69
        sensor = amg8833_i2c.AMG8833(addr=0x69)  # start AMG8833
    except:
        sensor = amg8833_i2c.AMG8833(addr=0x68)
    finally:
        pass
time.sleep(0.1)  # wait for sensor to settle
if sensor == []:
    print("No AMG8833 Found - Check Your Wiring")
    sys.exit()
    # exit the app if AMG88xx is not found

pix_res = (8, 8)  # pixel resolution
xx, yy = (np.linspace(0, pix_res[0],
                      pix_res[0]), np.linspace(0, pix_res[1], pix_res[1]))
zz = np.zeros(pix_res)  # set array with zeros first
# new resolution
Пример #4
0
import sys
import numpy as np
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
import time
sys.path.append('../AMG8833Lib/')
import amg8833_i2c

t0 = time.time()
sensor = []
while (time.time()-t0) < 1:
    try:
        sensor = amg8833_i2c.AMG8833(addr=0x69)
    except:
        sensor = amg8833_i2c.AMG8833(addr=0x68)
    finally:
        pass
time.sleep(0.1)

pix_to_read = 64
pix_res = (8, 8)

camera = PiCamera()
rawCapture = PiRGBArray(camera)
time.sleep(0.1)


def grab_frame():
    camera.capture(rawCapture, format="bgr", use_video_port=True)