Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I am using thermal sensor and HAT Zero with Raaspberry Pi. I wanted to set ROI from my python script to get temperature. I have tried setting the ROI using ti.set_spotmeter_config(first_column=20, first_row = 20, last_column = 40, last_row = 40). It is giving me this kind of error. TypeError: set_spotmeter_config() takes 2 positional arguments but 5 were given How can I resolve this error? code: #!/usr/bin/env python # -*- coding: utf-8 -*- # # Shows live thermal image video in Tk window # HOST = "localhost" PORT = 4223 UID = "LcZ" # Change XYZ to the UID of your Thermal Imaging Bricklet from tinkerforge.ip_connection import IPConnection from tinkerforge.bricklet_thermal_imaging import BrickletThermalImaging import math import time try: from Tkinter import Tk, Canvas, PhotoImage, mainloop, Label # Python 2 from Queue import Queue, Empty except: from tkinter import Tk, Canvas, PhotoImage, mainloop, Label # Python 3 from queue import Queue, Empty from PIL import Image, ImageTk WIDTH = 80 HEIGHT = 60 SCALE = 10 # Use scale 5 for 400x300 window size (change for different size). Use scale -1 for maximized mode image_queue = Queue() # Creates standard thermal image color palette (blue=cold, red=hot) def get_thermal_image_color_palette(): palette = [] for x in range(256): x /= 255.0 palette.append(int(round(255*math.sqrt(x)))) # RED palette.append(int(round(255*pow(x, 3)))) # GREEN if math.sin(2 * math.pi * x) >= 0: palette.append(int(round(255*math.sin(2 * math.pi * x)))) # BLUE else: palette.append(0) return palette # Callback function for high contrast image def cb_high_contrast_image(image): # Save image to queue (for loop below) global image_queue image_queue.put(image) def on_closing(window, exit_queue): exit_queue.put(True) if __name__ == "__main__": ipcon = IPConnection() # Create IP connection ti = BrickletThermalImaging(UID, ipcon) # Create device object ipcon.connect(HOST, PORT) # Connect to brickd print (ti.get_spotmeter_config()) ti.set_spotmeter_config(20,20,40,40) # Don't use device before ipcon is connected # Register illuminance callback to function cb_high_contrast_image ti.register_callback(ti.CALLBACK_HIGH_CONTRAST_IMAGE, cb_high_contrast_image) # Enable high contrast image transfer for callback ti.set_image_transfer_config(ti.IMAGE_TRANSFER_CALLBACK_HIGH_CONTRAST_IMAGE) # Create Tk window and label window = Tk() # Run maximized if SCALE == -1: window.geometry("%dx%d+0+0" % (window.winfo_screenwidth(), window.winfo_screenheight())) window.update() # Update to resize the window w, h = window.winfo_width(), window.winfo_height() SCALE = min(w // WIDTH, h // HEIGHT) label = Label(window) label.pack() image = Image.new('P', (WIDTH, HEIGHT)) # This puts a color palette into place, if you # remove this line you will get a greyscale image. image.putpalette(get_thermal_image_color_palette()) #ti.set_spotmeter_config(120,310,360,510) exit_queue = Queue() window.protocol("WM_DELETE_WINDOW", lambda: on_closing(window, exit_queue)) while True: try: exit_queue.get_nowait() break # If the exit_queue is not empty, the window was closed. except Empty: pass # Get image from queue (blocks as long as no data available) image_data = image_queue.get(True) # Use original width/height to put data and resize again afterwards image = image.resize((WIDTH, HEIGHT)) image.putdata(image_data) image = image.resize((WIDTH*SCALE, HEIGHT*SCALE), Image.ANTIALIAS) # Translate PIL Image to Tk PhotoImageShow and show as label photo_image = ImageTk.PhotoImage(image) label.configure(image=photo_image) y = ti.get_statistics() z = ((y[0][1]*655)/65535)- 273 print (z) window.update() window.destroy()
  2. Hi, I am tracking one object using camera and wanted to track the temperature of the same object. For the temperature I am using tinkerforge thermal imaging bricklet. I wanted to know, whether I can apply the ROI of the camera to the ROI of the thermal sensor. Dose thermal sensor accepts the foreign ROI coordinates from another camera? Kind Regards, Ravi
  3. I have tried, now I am getting "could not connect error". I have tried to check the config using "brickd --check-config" and got brick config error. I am also attaching the log file. brickd.log
  4. in /etc/brickd.conf, there are other Contents. Do you want me to replace everything or just past these configurations at the end?
  5. I have tried this solution and got this (Could not open HAT product_id in device tree, not using pre-configured HAT Brick setup ) sort of error (please find it in attachment). I guess the configurations got changed by me at some Point. How can I use the pre-defined configurations?
  6. Hi, When I am connecting the Brick Viewer with Pi, I am not able to see the HAT Zero Brick. How can I check if brick Viewer is able to connect to the Pi or not? Meanwhile I am sending you the log file. I also have the file called 'brickd.log.1', if you want I am happy to send you. Kind Regards, Ravi brickd.log
  7. Hi, I am using HAT zero Brick and Thermal sensor by FLIR. I am using these components since last 1 week or something and they were working fine until now. Now whenever I am trying to connect it via python script, I am just getting one response, did not receive response. I have also tried to connect it via brick viewer and there is not response at all. I have checked the host address, port address and UID, everything is correct. The shutter of the thermal sensor works some time. Tried attaching sensor at other ports B, and D, but the same response. What can be the problem here? thanks in advance. Ravi
  8. Ravi

    Herr Mevada

    Dear Sir/Madam. We just bought thermal camera from you. It came without any cable connection. We want to buy cable to connect the camera with Raspberry Pi. Can you please suggest any cable to connect it with Raspberry Pi? Kind Regards, Ravi
  • Create New...