Interface and control FLIR (BlackFly S) with Matlab 64-bit platform code
60 次查看(过去 30 天)
显示 更早的评论
Hello Mathworks team,
This is a follow up on @Zoran Popovic's comment here: Does Image Acquisition Toolbox support FLIR (Point Grey) Blackfly S model camera?
Aim: To interface the BlackFly S camera (Model # BFS-U3-04S2M-CS) with Matlab such that I can control the camera through it.
I would like to try loading the Spinnaker drivers into Matlab and use the corresponding register read/write functions. Following are my questions:
1. I would like to know which DLL should I be adding following the procedure Loadlibrary function in Matlab
2. Once the DLL gets loaded, I would like to have the inbuilt register read/write functions list?
I am writing here as I have already tried contacting the FLIR Integrated Imaging Solutions Inc. (formerly known as Point Grey Research) technical support. The lady there informed me to contact Mathworks for further help on this issue.
I use the Spinnaker 64-bit DLL v140 (install the SDK using VS2015 setting) as recommended by the FLIR support team. In Matlab I use C++ compiler configured to:
MEX configured to use 'Microsoft Visual C++ 2015 Professional' for C++ language compilation.
The following is the code I tried:
function [rawfile] = acquireRawImg32Bit()
loadlibrary('C:\Program Files\Point Grey Research\Spinnaker\bin\vs2015\SpinnakerC_v140.dll', 'C:\Program Files\Point Grey Research\Spinnaker\include\spinc\SpinnakerC.h')
libfunctions('SpinnakerC_v140')
hCam = libpointer('hCam', 'spinCamera');
calllib('SpinnakerC_v140', 'spinCameraBeginAcquisition', hCam);
unloadlibrary('SpinnakerC_v140');
end
After which I got a huge bunch of errors:
Warning: Warnings messages were produced while parsing. Check the
functions you intend to use for correctness. Warning text can be
viewed using:
[notfound,warnings]=loadlibrary(...)
> In loadlibrary
Error loading library intermediate output follows.
The actual error is at the end of this output.
*********
Bareword found where operator expected at (eval 119) line 1, near "0xffffffffL"
(Missing operator before L?)
Type 'lconvPtr' was not found. Defaulting to type voidPtr.
Found on line 5665 of input from line 2111 of file C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\INCLUDE\\crtdefs.h
Eval of const expression 0xffffffffL failed with error syntax error at (eval 119) line 2, near "0xffffffffL
"
.
Found on line 14010 of input from line 201 of file c:\\program files\\point grey research\\spinnaker\\include\\spinc\\SpinnakerGenApiDefsC.h
Type ')' was not found. Defaulting to type error.
Found on line 18701 of input from line 2176 of file C:\\Program Files\\Point Grey Research\\Spinnaker\\include\\spinc\\SpinnakerC.h
Failed to parse type 'dllimport ) spinError spinAVIRecorderClose ( spinAVIRecorder hRecorder' original input 'dllimport ) spinError spinAVIRecorderClose ( spinAVIRecorder hRecorder '
Found on line 18701 of input from line 2176 of file C:\\Program Files\\Point Grey Research\\Spinnaker\\include\\spinc\\SpinnakerC.h
Error parsing argument for function __declspec function may be invalid.
*********
Error using loadlibrary
Building SpinnakerC_v140_thunk_pcwin64 failed. Compiler output is:
cl -I"C:\MATLAB\R2016a\extern\include" /Zp8 /W3 /nologo
-I"C:\Users\******\Documents\MATLAB" -I"C:\Program Files\Point Grey
Research\Spinnaker\include\spinc" "SpinnakerC_v140_thunk_pcwin64.c" -LD
-Fe"SpinnakerC_v140_thunk_pcwin64.dll"
SpinnakerC_v140_thunk_pcwin64.c
SpinnakerC_v140_thunk_pcwin64.c(444) : error C2059: syntax error : ')'
SpinnakerC_v140_thunk_pcwin64.c(444) : error C2061: syntax error :
identifier 'spinErrorspinAVIRecorderClose'
SpinnakerC_v140_thunk_pcwin64.c(444) : error C2059: syntax error : ';'
SpinnakerC_v140_thunk_pcwin64.c(445) : error C2143: syntax error :
missing ')' before '{'
SpinnakerC_v140_thunk_pcwin64.c(446) : error C2059: syntax error : ')'
SpinnakerC_v140_thunk_pcwin64.c(446) : error C2065: 'dllimport' :
undeclared identifier
SpinnakerC_v140_thunk_pcwin64.c(446) : error C2146: syntax error :
missing ';' before identifier 'spinError'
SpinnakerC_v140_thunk_pcwin64.c(446) : error C2275: 'spinError' :
illegal use of this type as an expression
c:\program files\point grey
research\spinnaker\include\spinc\SpinnakerDefsC.h(273) : see
declaration of 'spinError'
SpinnakerC_v140_thunk_pcwin64.c(446) : error C2146: syntax error :
missing ';' before identifier 'spinAVIRecorderClose'
SpinnakerC_v140_thunk_pcwin64.c(446) : error C2143: syntax error :
missing ')' before 'type'
SpinnakerC_v140_thunk_pcwin64.c(446) : error C2198:
'spinAVIRecorderClose' : too few arguments for call
SpinnakerC_v140_thunk_pcwin64.c(447) : error C2065: 'p0' : undeclared
identifier
SpinnakerC_v140_thunk_pcwin64.c(447) : error C2065: 'dllimport' :
undeclared identifier
SpinnakerC_v140_thunk_pcwin64.c(447) : error C2100: illegal indirection
SpinnakerC_v140_thunk_pcwin64.c(447) : error C2146: syntax error :
missing ';' before identifier 'spinError'
SpinnakerC_v140_thunk_pcwin64.c(447) : error C2275: 'spinError' :
illegal use of this type as an expression
c:\program files\point grey
research\spinnaker\include\spinc\SpinnakerDefsC.h(273) : see
declaration of 'spinError'
SpinnakerC_v140_thunk_pcwin64.c(447) : error C2146: syntax error :
missing ';' before identifier 'spinAVIRecorderClose'
SpinnakerC_v140_thunk_pcwin64.c(447) : error C2143: syntax error :
missing ')' before 'type'
SpinnakerC_v140_thunk_pcwin64.c(447) : error C2198:
'spinAVIRecorderClose' : too few arguments for call
SpinnakerC_v140_thunk_pcwin64.c(447) : error C2059: syntax error : ')'
SpinnakerC_v140_thunk_pcwin64.c(448) : error C2065: 'p0' : undeclared
identifier
SpinnakerC_v140_thunk_pcwin64.c(449) : error C2059: syntax error : ')'
end
Do not know how to resolve these errors, although I tried various recommended methods on stackoverflow as well as Mathworks forums. Please help as Mathworks team would know how to resolve this in a timely and efficient manner.
1 个评论
Hadar Pinhas
2018-10-25
编辑:Hadar Pinhas
2018-10-25
Had the same problem, solution for my case here: Does Image Acquisition Toolbox support FLIR (Point Grey) Blackfly S model camera?
采纳的回答
Andrei
2018-11-27
编辑:Andrei
2022-10-20
As of MATLAB R2018b, a custom adaptor for FLIR/PointGrey Spinnaker drivers is available for Image Acquisition Toolbox. Refer to instructions from the following File Exchange entry:
Update: This Spinnaker adaptor is supported for MATLAB® R2018b to R2022a only. Starting in R2022b, the recommended way to use FLIR Spinnaker supported cameras (such as Blackfly S) in MATLAB is with GenTL Support from Image Acquisition Toolbox. (This approach is also supported in releases earlier than R2022b.) For more information on using FLIR Spinnaker supported cameras with the GenTL adaptor, see the following article: How Can I use my FLIR Spinnaker SDK USB3 Vision or GigE Vision Camera with MATLAB?
1 个评论
az clearview
2019-1-29
My understanding is that this Answer does not address the request for camera control originally posed. It's functionality is that of the winvideo adapter, with no control of exposure, gain, etc.
Any input into how to address the compiling errors reported by original poster (@Harsha)?
Thanks! A
更多回答(1 个)
Andrei
2022-10-20
There is now a GenICam GenTL producer included with the vendor's Spinnaker SDK, which means that you can use the BlackFly S camera models with videoinput gentl in Image Acquisition Toolbox. This approach provides fine control for the camera properties. Refer to the following post for more details:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 National Instruments Frame Grabbers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!