LJMUAstroecology / flirpy

Python library to interact with FLIR camera cores
Other
184 stars 54 forks source link

boson radiometric #87

Open bakas90 opened 11 months ago

bakas90 commented 11 months ago

I'm using a Boson R camera. I am getting raw data using flirpy.

However, I'm not exactly sure how to get the metadata.

I want to get the radiometric value. I also want to create a SEQ file.

I would be grateful if you could tell me how.

jveitchmichaelis commented 11 months ago

Hi,

I want to get the radiometric value.

Flirpy was written before the R variant was released and unfortunately I don't have a radiometric camera to test with.

Do you know what format the raw data from the camera is returned as? It should be straightforward to update the library to include radiometric support. Documentation is here

I'd guess we need to check if TLinear mode is enabled at least, and there seem to be options to control what units are output.

I also want to create a SEQ file.

SEQ files are a sequence of FFF files. In theory you could construct these manually, but this isn't something that Flirpy supports - it's mostly used in the opposite direction (getting data out of SEQ files).

Is there a reason you want an SEQ file?

jveitchmichaelis commented 11 months ago

Assuming you've created a camera object, give this a go. This should change the video mode to TLinear.

function_id = 0x000E000E #sysctrlSetUsbVideoIR16Mode
command = struct.pack(">H", 2) # FLR_SYSCTRL_USBIR16_MODE_TLINEAR = 2
res = camera._send_packet(function_id, data=command)
#res = camera._decode_packet(res) # Not needed, but you can see what res is to check if the command went through

# Now try grabbing a frame

...

This should put your camera into TLinear mode and then multiply your raw values by 0.01 to get to Kelvin.

jveitchmichaelis commented 10 months ago

@bakas90 I see the thumbs up, any luck with this? :)

olfk1234 commented 3 months ago

@jveitchmichaelis Hello! I tried the code above and I got a warning stating "WARNING:flirpy.camera.boson:Boson response: bad command ID" when running the decode packet function. Is there another workaround to convert the Boson into TLinear mode or to get the temperatures using flirpy?

jveitchmichaelis commented 3 months ago

If you go to the receive function and print/dump the return from the camera, what do you get?

I don't have a radiometric Boson so I'm unable to check this myself.

olfk1234 commented 3 months ago

@jveitchmichaelis After doing print(camera.receive()) after the code that you mentioned before, I am getting b' '

jveitchmichaelis commented 3 months ago

Try with 0x000E000D:

image

Looks like a typo with the previous function code (that was get, not set).

However you should also send the 0x000E000E command after to check that the setting is correct. I suggest having a read through the document in the link above, it has all the information about which commands you can send and what should be returned. It should be straightforward to figure out how to use Flirpy to implement the ones you need.