PointGrey相机使用总结.docx

上传人:b****6 文档编号:5761785 上传时间:2023-01-01 格式:DOCX 页数:10 大小:939.12KB
下载 相关 举报
PointGrey相机使用总结.docx_第1页
第1页 / 共10页
PointGrey相机使用总结.docx_第2页
第2页 / 共10页
PointGrey相机使用总结.docx_第3页
第3页 / 共10页
PointGrey相机使用总结.docx_第4页
第4页 / 共10页
PointGrey相机使用总结.docx_第5页
第5页 / 共10页
点击查看更多>>
下载资源
资源描述

PointGrey相机使用总结.docx

《PointGrey相机使用总结.docx》由会员分享,可在线阅读,更多相关《PointGrey相机使用总结.docx(10页珍藏版)》请在冰豆网上搜索。

PointGrey相机使用总结.docx

PointGrey相机使用总结

PointGrey相机使用总结

对于重装系统后的电脑,如果要使用PointGrey相机,需要进行如下步骤:

第一步:

安装相机驱动,FlyCapture2;

连接好左右相机。

第二步:

安装最新的USB驱动。

右击“我的电脑”——>“管理”——>“设备管理器”——>

——>右击“USB”更新一下相机驱动。

选择“计算机以查找驱动程序软件”

选择“浏览”,找到D:

\D_ProgramFiles\FlyCapture\driver64\signed\Windows10\UsbPro;

点选下一步,

 

第三步,VS2010配置相机。

这篇博客是在结构光系统设计中使用的,因为要用到摄像机拍摄图像,记录下来以备查用。

操作系统:

win7专业版 64bit

FlyCapture2:

 Windows 64bit  

顺便介绍一下自己所用的相机 FL3-U3-13Y3M-C是一款黑白的相机。

到官网上下载对应的SDK即可使用。

一般的只要电脑带有usb3.0的接口都可以使用,即使是用在usb2.0也是可以用的,但是帧率会降低很多,在要求的速度不高的情况下可以使用。

usb3.0的驱动一定要安装,另外连接相机时要联网保证可以下载驱动(相机驱动是自动安装的)。

SDK安装时需要选择安装的相机的类型时只选择usb相机即可。

默认安装的情况下有如下安装文件在C盘存在

安装后先联网插入相机用SDK看能否看到图像,若可以看到,则安装没有问题。

然后打开visualstudio2010

红框内的内容要看好,64bit的SDK不支持win32debug模式,要选择x64模式,这个一定要注意。

双击Debug|x64,得到下图,需要添加的部分是包含目录和库目录,其中包含目录是所用到的.h文件的路径,库目录是所用到的存放静态库.lib文件的路径。

包含目录中添加:

C:

\ProgramFiles\PointGreyResearch\FlyCapture2\include 

库目录添加:

C:

\ProgramFiles\PointGreyResearch\FlyCapture2\lib64

 

链接器输入部分加上:

FlyCapture2.lib

这样你就可以使用SDK中的函数进行相机的控制了。

下面是一个网友的程序,可以作为测试,前提是你要配置好opencv2,这个在结构光系列博文中有介绍。

如果只是实验SDK的配置,可以注释掉第二个main,使用第一个,如果没有报错则说明配置正确。

常见的错误会有linkerror类等,这个可以从网上找到答案。

.lib文件在编译链接时使用,.dll在运行时使用

[cpp] viewplain copy

1.#include "FlyCapture2.h"  

2.//#include   

3.//#include   

4.#include  

5.#include   

6.  

7.using namespace FlyCapture2;  

8.  

9.  

10./*int main() 

11.{ 

12.    // Do Flycapture2 related stuff... 

13.    Camera cam;  

14.    return 0; 

15.}*/  

16.int main()  

17.{  

18.    Error error;  

19.    Camera camera;  

20.    CameraInfo camInfo;  

21.  

22.    // Connect the camera  

23.    error = camera.Connect( 0 );  

24.    if ( error !

= PGRERROR_OK )  

25.    {  

26.        std:

:

cout << "Failed to connect to camera" << std:

:

endl;     

27.        system("pause");  

28.        return false;  

29.    }  

30.      

31.    // Get the camera info and print it out  

32.    error = camera.GetCameraInfo( &camInfo );  

33.    if ( error !

= PGRERROR_OK )  

34.    {  

35.        std:

:

cout << "Failed to get camera info from camera" << std:

:

endl;       

36.        return false;  

37.    }  

38.    std:

:

cout << camInfo.vendorName << " "  

39.              << camInfo.modelName << " "   

40.              << camInfo.serialNumber << std:

:

endl;  

41.      

42.    error = camera.StartCapture();  

43.    if ( error == PGRERROR_ISOCH_BANDWIDTH_EXCEEDED )  

44.    {  

45.        std:

:

cout << "Bandwidth exceeded" << std:

:

endl;       

46.        return false;  

47.    }  

48.    else if ( error !

= PGRERROR_OK )  

49.    {  

50.        std:

:

cout << "Failed to start image capture" << std:

:

endl;       

51.        return false;  

52.    }   

53.      

54.    // capture loop  

55.    char key = 0;  

56.    while(key !

= 'q')  

57.    {  

58.        // Get the image  

59.        Image rawImage;  

60.        Error error = camera.RetrieveBuffer( &rawImage );  

61.        if ( error !

= PGRERROR_OK )  

62.        {  

63.            std:

:

cout << "capture error" << std:

:

endl;  

64.            continue;  

65.        }  

66.          

67.        // convert to rgb  

68.        Image rgbImage;  

69.        rawImage.Convert( FlyCapture2:

:

PIXEL_FORMAT_BGR, &rgbImage );  

70.         

71.        // convert to OpenCV Mat  

72.        unsigned int rowBytes = (double)rgbImage.GetReceivedDataSize()/(double)rgbImage.GetRows();         

73.        cv:

:

Mat image = cv:

:

Mat(rgbImage.GetRows(), rgbImage.GetCols(), CV_8UC3, rgbImage.GetData(),rowBytes);  

74.          

75.        cv:

:

imshow("image", image);  

76.        key = cv:

:

waitKey(30);          

77.    }  

78.      

79.    error = camera.StopCapture();  

80.    if ( error !

= PGRERROR_OK )  

81.    {  

82.        // This may fail when the camera was removed, so don't show   

83.        // an error message  

84.    }    

85.      

86.    camera.Disconnect();  

87.    system("pause");  

88.    return 0;  

89.}  

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 节日庆典

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1