groupgets / purethermal1-uvc-capture

USB Video Class capture examples for PureThermal 1 / PureThermal 2 FLIR Lepton Dev Kit
125 stars 81 forks source link

Media foundation radiometry #21

Closed kamil321-rgb closed 4 years ago

kamil321-rgb commented 4 years ago

Hi Application from media foundation looks fine for my needs but I can't set radiometry parameters from there. I added static constexpr XuGuid _xuLepRad{ { 'p','t','1','-','l','e','p','-','r','a','d','-','0','0','0','0' } }; in device.h and edited line in device.cpp std::vector<std::reference_wrapper<const XuGuid> > xuGuids{ _xuLepRad,_xuLepOem , _xuLepSys }; but I still it throw an error. I use pure thermal 2 board. Could you help me with this one?

kekiefer commented 4 years ago

Can you confirm if the extension units from other modules work? Is the problem specific to a particular register within the RAD module, or all registers? Is it specific to the Windows interface?

kamil321-rgb commented 4 years ago

Sample modules like SYS and OEM works fine. Rest module (AGC, RAD) doesn't work with this code. Using Python and LINUX RAD module works ok. I even change some registers from firmware. But i can't do this from this mediafoundation code.

kekiefer commented 4 years ago

@ghellwig will probably have to speak to this, I'm not sure what would be special about the windows interface in this regard.

ghellwig commented 4 years ago

@kamil321-rgb The code should work for any of the extension units. The only caveat is that there's a limit on the number of controls per unit on Windows. To clarify if that's the issue here I would need the exact unit ID and the exact control ID, i.e. I need the parameters of your call to Device::SetGetExtensionUnit().

kamil321-rgb commented 4 years ago

I tried using something like this: LEP_RAD_FLUX_LINEAR_PARAMS_T_TAG flux; SetGetExtensionUnit(_xuLepRad, 48, KSPROPERTY_TYPE_GET, &flux, sizeof(flux)); and LEP_RAD_FLUX is defined as struct LEP_RAD_FLUX_LINEAR_PARAMS_T_TAG { /* Type Field name format comment */ std::uint16_t sceneEmissivity; /* 3.13 */ std::uint16_t TBkgK; /* 16.0 value in Kelvin 100x */ std::uint16_t tauWindow; /* 3.13 */ std::uint16_t TWindowK; /* 16.0 value in Kelvin 100x */ std::uint16_t tauAtm; /* 3.13 */ std::uint16_t TAtmK; /* 16.0 value in Kelvin 100x */ std::uint16_t reflWindow; /* 3.13 */ std::uint16_t TReflK; /* 16.0 value in Kelvin 100x */ }; _xuLepRad is static constexpr XuGuid _xuLepRad{ { 'p','t','1','-','l','e','p','-','r','a','d','-','0','0','0','0' } };

ghellwig commented 4 years ago

Ok, this confirms my assumption. Have a look at this PR: https://github.com/groupgets/purethermal1-firmware/pull/13 You have to use the second set of controls, i.e. RAD2 in your case, and subtract the offset of 32 (or 31, but you can check this easier than me because I am not at my computer these days). Hope this helps.

kamil321-rgb commented 4 years ago

Ok I tried: _xuLepRad is static constexpr XuGuid _xuLepRad{ { 'p','t','1','-','l','e','p','-','r','a','d','2','0','0','0','0' } }; but still the same error. Sorry but i can't fully understand "subtract" the offset of 32" How can I do this in this app?

ghellwig commented 4 years ago
kamil321-rgb commented 4 years ago

Ok thank you really much. For those who looking answers correct guid: static constexpr XuGuid _xuLepRad2{ { 'p','t','1','-','l','e','p','-','r','a','d','2','0','0','0','0' } }; and offset is 31

ghellwig commented 4 years ago

Great that it works now. Thanks also for picking the correct option of the two offsets I proposed 😉 Btw, on Linux you can also use RAD2 if you want to use the extension units in a uniform way. However, you don't need to because there is no such arbitrary limit as under Windows.