[aravis] Re: Getting Thermal Imaging data using python and ARAVIS

  • From: Saurabh Chatterjee <saurabhsaurc@xxxxxxxxx>
  • To: aravis@xxxxxxxxxxxxx
  • Date: Tue, 5 Dec 2017 20:36:44 +0530

Hey thanks dude

I tried this

device = camera.get_device()

device.set_string_feature_value('SensorGainMode', 'HighGainMode')
device.set_string_feature_value('TemperatureLinearMode', 'On')
device.set_string_feature_value('TemperatureLinearResolution', 'High')

and it worked great! I can now get the temperature values in deg. C

will post again if I have any more problems.

On Mon, Dec 4, 2017 at 6:40 PM, Rens Köhne <rens.kohne@xxxxxxxxx> wrote:

Hi Saurabh,

I'm not sure as I do not have any experience with thermal cameras. But my
guess is you would probably do this:
device.set_string_feature_value('SensorGainMode', 'HighGainMode')
device.set_string_feature_value('TemperatureLinearMode', 'On')
device.set_string_feature_value('TemperatureLinearResolution', 'High')

2017-12-03 12:17 GMT+01:00 Saurabh Chatterjee <saurabhsaurc@xxxxxxxxx>:

Thanks, that worked quite good. I am now able to get the data in 8 bit
format ( ie. B/W image )

Next, I actually require temperature values from the thermal camera
rather than BW images. In order to do this, we have to set some properties
for the camera.
In MATLAB, it is done like this

source.SensorGainMode = 'HighGainMode';
source.TemperatureLinearMode = 'On';
source.TemperatureLinearResolution = 'High';

these properties can also be set using EBus Player -- but that seems to
be reset upon disconnection.

How can we do this in ARAVIS? I searched for some camera properties in
the reference manual but could find nothing.

On Thu, Nov 30, 2017 at 8:54 PM, Rens Köhne <rens.kohne@xxxxxxxxx> wrote:

Hi Saurabh,

I use Aravis with python, however not with thermal imaging cameras. I
use it with B+W and color cameras.
I have included some example code how to convert an aravis buffer to a
numy array.

I hope the code below helps.

Kind regards,
Rens

---
from gi.repository import Aravis
import numpy as np
import cv2

camera = Aravis.Camera.new(None)
device = camera.get_device()
# set acquisition mode to continuous
device.set_string_feature_value("AcquisitionMode", 'Continuous')
# set camera trigger to software
camera.set_trigger('Software')

stream = camera.create_stream()
camera.start_acquisition()

# lets take 10 images
images = []
for i in range(10):
    camera.software_trigger()
    payload = camera.get_payload()
    stream.push_buffer(Aravis.Buffer.new_allocate(payload))
    image_buffer = stream.pop_buffer()
    data_from_buffer = image_buffer.get_data()
    # depending on the pixel format the stuff below is a bit different
    # for Mono8
    img_data = np.ndarray(buffer=data_from_buffer, dtype=np.uint8,
shape=(camera.get_region()[3], camera.get_region()[2], 1))
    # for Mono12
    img_data = np.ndarray(buffer=data_from_buffer, dtype=np.uint16,
shape=(camera.get_region()[3], camera.get_region()[2], 1))
    # for color you need to de-bayer, for example BayerBG8
    img_data = np.ndarray(buffer=data_from_buffer, dtype=np.uint8,
shape=(camera.get_region()[3], camera.get_region()[2], 1))
    rgb_img_data = cv2.cvtColor(img_data, cv2.COLOR_BAYER_BG2BGR_VNG)

camera.stop_acquisition()

2017-11-28 10:54 GMT+01:00 Saurabh Chatterjee <saurabhsaurc@xxxxxxxxx>:

Hi,

I have connected my FLIR AX5 camera to my computer and used ARAVIS to
see the output. Viewer works fine, test codes work fine. I want to write a
python application which takes this data and does some processing on it.

How can I proceed from here? I checked out the arv-camera-test.py, it
works fine. It returns data as an 'Aravis buffer' What is an aravis buffer?
How can I convert it into data in a convenient format, such as numpy arrays
for example? Can I get some example code?

Thank you for your assistance

Saurabh Chatterjee
Phd, Aerospace Engineering
Indian Institute of Space Science and Technology, Thiruvananthapuram





--
Saurabh Chatterjee
Phd, Aerospace Engineering
Indian Institute of Space Science and Technology, Thiruvananthapuram





-- 
Saurabh Chatterjee
Phd, Aerospace Engineering
Indian Institute of Space Science and Technology, Thiruvananthapuram

Other related posts: