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还是件颇为麻烦的事情,故将过程略作总结,以备不时之需. 首先,在编译之前,我需要 ...
随机推荐
- 数据库ACID
数据库的事务隔离级别 10.数据库的事务隔离级别一般分为4个级别,其中可能发生“不可重复读”的事物级别有()A.SERIALIZABLE B.READ COMMITTEDC.READ UNCOMMIT ...
- Java用Scanner类获取用户输入
用Java编写程序时,有些数据需要用户输入,这个时候需要调用java提供的Scanner类,这个类在包java.util下,比如求一个矩形的面积,简单的看一下用法: import java.util. ...
- HDU1004 查气球
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- [MAC] Mac下的SVN命令行
转载自: http://www.cnblogs.com/snandy/p/4072857.html Mac自带了SVN命令行,如我的升级到10.10(OSX yosemite)后命令行版本为1.7.1 ...
- IncDec Sequence(codevs 2098)
题目描述 Description 给定一个长度为n的数列{a1,a2...an},每次可以选择一个区间[l,r],使这个区间内的数都加一或者都减一. 问至少需要多少次操作才能使数列中的所有数都一样,并 ...
- 教官的游戏(codevs 2793)
题目描述 Description 有N个学生刚吃完饭,准备出食堂. 国防学校有个规矩:必须2人一排或3人一列离开. 两个教官A,B轮流取2或3人,谁先取完谁就赢得游戏.(A先取) 若两人都用最优策略, ...
- 关于Struts2上传文件的最大Size的设置
今天使用Struts2的文件上传控件时,在struts.xml中,将处理上传的action中的fileUpload拦截器的maximumSize参数设置为5000000,上传了一个3M的文件后发现控制 ...
- 【转】解决编译Apache出现的问题:configure: error: APR not found . Please read the documentation
这里写的很清楚了,已验证可用 http://blog.csdn.net/linghao00/article/details/7926458
- hdu 1515 dfs
一道不错的搜索题 题意:告诉你两个字符串a和b,要求对a进行栈的操作而产生b串,输出操作的顺序,如果有多组输出就按字典序输出. Sample Input madam adamm bahama baha ...
- CC2540开发板学习笔记(三)——外部中断
一.实验内容 通过外部中断方式依次按下按键S1控制LED1的亮灭 二.实验过程 1.电路原理图同上 2.中断的概念 比如说我们在执行main函数时,突然来了个指令.优先级比现在执行的main还高,那我 ...