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的更多相关文章

  1. Qt5+VS2010的安装及使用

    在我的博客<Win7下Qt5的安装及使用>中讲解了win7下Qt5+MinGW的安装及使用,本节再讲解win7下Qt5+VS2010的安装及使用.利用Qt5+MinGW开发应用程序比较麻烦 ...

  2. Qt5 installation and path configuration

    Replace Default Qt version paths in: /usr/lib/x86_64-linux-gnu/qtchooser/default.confor in newer rel ...

  3. 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: ...

  4. 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 ...

  5. 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 ...

  6. Clion+Cmake+Qt5+Qwt+msys2+MinGW在Windows下的安装配置使用教程

    摘要: CLion, a cross-platform C/C++ IDE. 本文主要介绍基于Clion作为IDE, MinGW作为编译器,CMake作为项目构建工具,开发基于Qt5.qwt的C++图 ...

  7. Qt5.8 在windows下mingw静态编译

    官方对编译一些条件介绍:https://doc.qt.io/qt-5/windows-requirements.html 在默认情况下,用QtCreator编译程序时,使用的是动态编译.编译好的程序在 ...

  8. 使用mingw编译完整Qt5的过程(使用了niXman的msys套装)good

    使用mingw编译完整Qt5的过程 坛子里似乎已经有人编译出Qt5了,不过大多有问题,不是缺少opengl就是缺少openssl,还有缺少webkit的,本文提供的仍然不能说是绝对完整的,不过相对以前 ...

  9. 用mingw静态编译Qt4.8.2和Qt5.1.1(需要修改不少源码)

    因为一些乱七八糟的原因,我需要用mingw静态编译Qt4.8.2和Qt5.1.1.经历了一天的折腾之后,自觉编译一下Qt还是件颇为麻烦的事情,故将过程略作总结,以备不时之需. 首先,在编译之前,我需要 ...

随机推荐

  1. html span标签 不换行(有时span带中文时候是可以自动换行的)

    <span>你好111111111111111111111111111111111111111111111111111aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ...

  2. 【转】 Mybatis/Ibatis,数据库操作的返回值

    该问题,我百度了下,根本没发现什么有价值的文章:还是看源代码(详见最后附录)中的注释,最有效了!insert,返回值是:新插入行的主键(primary key):需要包含<selectKey&g ...

  3. Android app主线程UI更新间歇性崩溃的问题

    对App进行开发测试时,偶尔出现app崩溃的问题.日志如下: 10-25 18:44:52.935 15290-15290/com.zzq.cnblogs E/AndroidRuntime﹕ FATA ...

  4. Objective-C ,C++,java中常用编码格式对比

    这个题目可能不太对!主要总结一下这3种语言的不同格式 1.创建一个A类,继承B类,实现C接口(协议) 先看oc的代码 @interface A : B <C> { int a; } @pr ...

  5. js删除提醒

    2014年7月3日 16:28:03 html <input type="submit" name="submit" value="删除&quo ...

  6. sqlcmd

    使用sqlcmd可以在批处理脚本中执行SQL.虽然这个命令的参数很多,但幸运的是,我们不需要全部理解,在这里简要介绍以下几个: { -U login_id [ -P password ] } | –E ...

  7. tomcat启动,输出system.out.println()

    tomcat6.0在使用System.out.println("aa")的时候,用cmd启动startup.bat,弹出的那个cmd窗口看到 还可以看logs/catalina.o ...

  8. Replace Nested Conditional with Guard Clauses(用卫语句代替嵌套循环)

    函数中的条件逻辑,使人难以看清正常的执行路径. 使用卫语句表现所有特殊情况. double getPayAmount() {double result;if (_isDead) result = de ...

  9. javaweb实现验证码功能

    在javaweb的用户注册与登陆功能时,有时为了防止漏洞或者大量注册,可以使用验证码功能,下面是验证码的一个简单实现 验证码类 public class ValiImg extends HttpSer ...

  10. linux下常见的文件夹含义

    1./bin :获得最小的系统可操作性所需要的命令2./boot :内核和加载内核所需的文件3./dev :终端.磁盘.调制解调器等的设备项4./etc :关键的启动文件和配置文件5./home :用 ...