FlyCapture2 Qt5 MinGW Configuration
Install FlyCatprue2 to the folder "C:\PointGreyResearch\"
Add the following to the .pro file:
# Add FlyCapture2
INCLUDEPATH += C:\PointGreyResearch\FlyCapture2\include
INCLUDEPATH += C:\PointGreyResearch\FlyCapture2\include\C LIBS += "C:\PointGreyResearch\FlyCapture2\lib\C\FlyCapture2_C.lib"
LIBS += "C:\PointGreyResearch\FlyCapture2\lib\C\FlyCapture2GUI_C.lib"
Note:
The C++ library only works with visual studio on Windows, not MinGW. So if we want to use MinGW, only the C library would work!
Sample FlyCapture2 API C Code:
#include "C/FlyCapture2_C.h"
#include <stdio.h> typedef enum _AviType
{
UNCOMPRESSED,
MJPG,
H264
} AviType; void PrintCameraInfo( fc2Context context )
{
fc2Error error;
fc2CameraInfo camInfo;
error = fc2GetCameraInfo( context, &camInfo );
if ( error != FC2_ERROR_OK )
{
// Error
} printf(
"\n*** CAMERA INFORMATION ***\n"
"Serial number - %u\n"
"Camera model - %s\n"
"Camera vendor - %s\n"
"Sensor - %s\n"
"Resolution - %s\n"
"Firmware version - %s\n"
"Firmware build time - %s\n\n",
camInfo.serialNumber,
camInfo.modelName,
camInfo.vendorName,
camInfo.sensorInfo,
camInfo.sensorResolution,
camInfo.firmwareVersion,
camInfo.firmwareBuildTime );
} int SaveAVIHelper(fc2Context context, AviType aviType, float frameRate)
{
fc2Error error;
const int k_numImagesToGrab = ;
fc2Image rawImage;
fc2AVIContext aviContext;
fc2AVIOption aviOption;
fc2H264Option h264Option;
fc2MJPGOption mjpgOption;
int i; error = fc2CreateAVI(&aviContext);
if (error != FC2_ERROR_OK)
{
printf("Error in fc2CreateAVI: %d\n", error);
return -;
} error = fc2CreateImage( &rawImage );
if ( error != FC2_ERROR_OK )
{
printf( "Error in fc2CreateImage: %d\n", error );
fc2DestroyAVI(aviContext);
return -;
} for (i=; i < k_numImagesToGrab; i++)
{
// Retrieve the image
error = fc2RetrieveBuffer(context, &rawImage);
if (error != FC2_ERROR_OK)
{
printf("Error in retrieveBuffer: %d\n", error);
continue;
} // Perform some initialization for the first time
if (i == )
{
switch (aviType)
{
case UNCOMPRESSED:
aviOption.frameRate = frameRate;
error = fc2AVIOpen(aviContext, "SaveImageToAviEx_C-Uncompressed", &aviOption);
if (error != FC2_ERROR_OK)
{
printf("Error opening AVI: %d\n", error);
}
break; case MJPG:
mjpgOption.frameRate = frameRate;
mjpgOption.quality = ;
error = fc2MJPGOpen(aviContext, "SaveImageToAviEx_C-MJPG", &mjpgOption);
if (error != FC2_ERROR_OK)
{
printf("Error opening AVI: %d\n", error);
}
break; case H264:
h264Option.frameRate = frameRate;
h264Option.bitrate = ;
h264Option.width = rawImage.cols;
h264Option.height = rawImage.rows;
error = fc2H264Open(aviContext, "SaveImageToAviEx_C-H264", &h264Option);
if (error != FC2_ERROR_OK)
{
printf("Error opening AVI: %d\n", error);
}
break;
}
} error = fc2AVIAppend(aviContext, &rawImage);
if (error != FC2_ERROR_OK)
{
printf("Error appending to AVI: %d\n", error);
} printf("Appended image %d\n", i);
} error = fc2DestroyImage(&rawImage);
if ( error != FC2_ERROR_OK )
{
printf( "Error in fc2CreateImaged: %d\n", error );
fc2DestroyAVI(aviContext);
return -;
} error = fc2DestroyAVI(aviContext);
if (error != FC2_ERROR_OK)
{
printf("Error in fc2DestroyAVI: %d\n", error);
return -;
} return ;
} float GetFrameRate(fc2Context context)
{
fc2Error error;
fc2PropertyInfo propInfo;
fc2Property prop; // Check if the camera supports the FRAME_RATE property
printf( "Detecting frame rate from camera... \n" );
propInfo.type = FC2_FRAME_RATE;
error = fc2GetPropertyInfo(context, &propInfo);
if (error != FC2_ERROR_OK)
{
return 0.0f;
} if (propInfo.present)
{
// Get the frame rate
prop.type = FC2_FRAME_RATE;
error = fc2GetProperty(context, &prop);
if (error != FC2_ERROR_OK)
{
return 0.0f;
} // Set the frame rate.
// Note that the actual recording frame rate may be slower,
// depending on the bus speed and disk writing speed.
return prop.absValue;
} return 0.0f;
} int RunCamera(fc2Context context, fc2PGRGuid guid)
{
fc2Error error;
float frameRate = 0.0f; error = fc2Connect( context, &guid );
if ( error != FC2_ERROR_OK )
{
printf( "Error in fc2Connect: %d\n", error );
return -;
} PrintCameraInfo( context ); error = fc2StartCapture( context );
if ( error != FC2_ERROR_OK )
{
printf( "Error in fc2StartCapture: %d\n", error );
return -;
} frameRate = GetFrameRate(context);
if (frameRate == 0.0f)
{
printf("Invalid frame rate returned\n");
return -;
} SaveAVIHelper(context, UNCOMPRESSED, frameRate);
SaveAVIHelper(context, H264, frameRate);
SaveAVIHelper(context, MJPG, frameRate); error = fc2StopCapture( context );
if ( error != FC2_ERROR_OK )
{
printf( "Error in fc2StopCapture: %d\n", error );
return -;
} return ;
} int main(int argc, char** argv)
{
fc2Error error;
fc2Context context;
fc2PGRGuid guid;
unsigned int numCameras = ; //PrintBuildInfo(); error = fc2CreateContext( &context );
if ( error != FC2_ERROR_OK )
{
printf( "Error in fc2CreateContext: %d\n", error );
return ;
} error = fc2GetNumOfCameras( context, &numCameras );
if ( error != FC2_ERROR_OK )
{
printf( "Error in fc2GetNumOfCameras: %d\n", error );
return ;
} if ( numCameras == )
{
// No cameras detected
printf( "No cameras detected.\n");
return -;
} // Get the 0th camera
error = fc2GetCameraFromIndex( context, , &guid );
if ( error != FC2_ERROR_OK )
{
printf( "Error in fc2GetCameraFromIndex: %d\n", error );
return -;
} if (RunCamera(context, guid) != )
{
printf("Error running camera\n");
return -;
} error = fc2DestroyContext( context );
if ( error != FC2_ERROR_OK )
{
printf( "Error in fc2DestroyContext: %d\n", error );
return -;
} printf( "Done! Press Enter to exit...\n" );
getchar(); return ;
}
FlyCapture2 Qt5 MinGW Configuration的更多相关文章
- Qt5+VS2010的安装及使用
在我的博客<Win7下Qt5的安装及使用>中讲解了win7下Qt5+MinGW的安装及使用,本节再讲解win7下Qt5+VS2010的安装及使用.利用Qt5+MinGW开发应用程序比较麻烦 ...
- Qt5 installation and path configuration
Replace Default Qt version paths in: /usr/lib/x86_64-linux-gnu/qtchooser/default.confor in newer rel ...
- FLTK 1.3.3 MinGW 4.9.1 Configuration 配置
Download FLTK 1.3.3 Download CMake 3.2.0 Start CMake 3.2.0, fill the source and destination: source: ...
- ITK 4.8.1 Qt 5.4 MinGW 4.9.1 Configuration 配置
Download ITK 4.8.1 Download Qt 5.4 with MinGW 4.9.1 Download CMake 3.2.0 I assume you've already ins ...
- VTK 6.3.0 Qt 5.4 MinGW 4.9.1 Configuration 配置
Download VTK 6.3.0 Download Qt 5.4 with MinGW 4.9.1 Download CMake 3.2.0 I assume you've already ins ...
- Clion+Cmake+Qt5+Qwt+msys2+MinGW在Windows下的安装配置使用教程
摘要: CLion, a cross-platform C/C++ IDE. 本文主要介绍基于Clion作为IDE, MinGW作为编译器,CMake作为项目构建工具,开发基于Qt5.qwt的C++图 ...
- Qt5.8 在windows下mingw静态编译
官方对编译一些条件介绍:https://doc.qt.io/qt-5/windows-requirements.html 在默认情况下,用QtCreator编译程序时,使用的是动态编译.编译好的程序在 ...
- 使用mingw编译完整Qt5的过程(使用了niXman的msys套装)good
使用mingw编译完整Qt5的过程 坛子里似乎已经有人编译出Qt5了,不过大多有问题,不是缺少opengl就是缺少openssl,还有缺少webkit的,本文提供的仍然不能说是绝对完整的,不过相对以前 ...
- 用mingw静态编译Qt4.8.2和Qt5.1.1(需要修改不少源码)
因为一些乱七八糟的原因,我需要用mingw静态编译Qt4.8.2和Qt5.1.1.经历了一天的折腾之后,自觉编译一下Qt还是件颇为麻烦的事情,故将过程略作总结,以备不时之需. 首先,在编译之前,我需要 ...
随机推荐
- .html和.htm的区别
很多人会认为网页扩展名html和htm是等同的,但事实上他们还是有区别的. 包含HTML内容的文件最常用的扩展名是.html,但是像DOS这样的旧操作系统限制扩展名为最多3个字符,所以.htm扩展名也 ...
- wsp反编译
最后出于好奇,我把wsp文件解压缩,看看里面是什么(如果您的机器上的压缩软件不能直接解压,可尝试修改后缀名为cab.).我看到的首先是一个清单文件(manifest.xml),一个DLL文件(Shar ...
- 21.左旋转字符串[LeftRotateString]
[题目] 定义字符串的左旋转操作:把字符串前面的若干个字符移动到字符串的尾部.如把字符串AB1234 左旋转2位得到字符串1234AB.请实现字符串左旋转的函数.要求时间对长度为n的字符串操作的复杂度 ...
- PHP实现 bitmap 位图排序 求交集
2014年12月16日 17:15:09 初始化一串全为0的二进制; 现有一串无序的整数数组; 如果整数x在这个整数数组当中,就将二进制串的第x位置为1; 然后顺序读取这个二进制串,并将为1的位转换成 ...
- ext树表+ZeroClipboard复制链接功能
效果图:
- July 30th, Week 31st Saturday, 2016
No matter how far you may fly, never forget where you come from. 无论你能飞多远,都别忘了你来自何方. No matter how fa ...
- sublime text3侧边栏主题不生效问题解决
sublime text3主题插件: Seti_UI 插件安装: 在线安装:需要FQ window: ctrl+shift+p 找install package:之后搜索 Seti_UI 安装完成后需 ...
- onsubmit="return false;"报错
<form id="formpersonal" method="post" onsubmit="return false;">. ...
- JavaScript字符串&数字间转换
比较操作符的操作数可以是任意类型.然而,只有数字和字符串才能真正执行边角操作,因此那些不是数字和字符串的操作数都讲进行类型转换,类型转换规则如下: 如果操作数为对象,那么对象转换为原始值:如 ...
- Javascript模块化编程之路——(require.js)
转自:http://www.ruanyifeng.com/blog/2012/10/javascript_module.html Javascript模块化编程(一):模块的写法 随着网站逐渐变成&q ...