读取灰点相机图像C++
来源:互联网 发布:2016年低头族的数据 编辑:程序博客网 时间:2024/05/05 13:24
配置:V2015 Debug x64
1.新建项目Win32控制台应用程序Point_Grey.sln
2.配置库文件
Point_Grey项目-属性-VC++目录-包含目录-添加E:\FlyCapture\include(每人存放在位置不同)
Point_Grey项目-属性-VC++目录-库目录-添加E:\FlyCapture\lib64(每人存放在位置不同)
Point_Grey项目-属性-链接器-输入-附加依赖项-添加FlyCapture2.lib
3.编写Point_Gray.cpp
#include "stdafx.h"
#include <FlyCapture2.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
using namespace FlyCapture2;
int main()
{
FlyCapture2::Error error;
Camera camera;
CameraInfo camInfo;
error = camera.Connect(0);
if (error != PGRERROR_OK)
{
std::cout << "Failed to connect to camera" << std::endl;
system("pause");
return false;
}
error = camera.GetCameraInfo(&camInfo);
if (error != PGRERROR_OK)
{
std::cout << "Failed to get camera info from camera" << std::endl;
return false;
}
std::cout << camInfo.vendorName << " "
<< camInfo.modelName << " "
<< camInfo.serialNumber << std::endl;
error = camera.StartCapture();
if (error == PGRERROR_ISOCH_BANDWIDTH_EXCEEDED)
{
std::cout << "Bandwidth exceeded" << std::endl;
return false;
}
else if (error != PGRERROR_OK)
{
std::cout << "Failed to start image capture" << std::endl;
return false;
}
Image rawImage;
Image rgbImage;
while (1)
{
FlyCapture2::Error error = camera.RetrieveBuffer(&rawImage);
if (error != PGRERROR_OK)
{
std::cout << "capture error" << std::endl;
continue;
}
rawImage.Convert(FlyCapture2::PIXEL_FORMAT_BGR, &rgbImage);
unsigned int rowBytes = (double)rgbImage.GetReceivedDataSize() / (double)rgbImage.GetRows();
cv::Mat frame = cv::Mat(rgbImage.GetRows(), rgbImage.GetCols(), CV_8UC3, rgbImage.GetData(), rowBytes);
resize(frame, frame, Size(0.3*frame.cols, 0.3*frame.rows));
imshow("显示", frame);
waitKey(10);
}
return 0;
}
- 读取灰点相机图像C++
- 使用emgucv读取USB相机图像
- Java图像变灰
- 图像变灰滤镜
- C语言实现RGB图像转换成灰(Gray)度图像
- Opencv图像变灰处理(纯C++,不依赖Opencv Manager)
- C语言读取BMP图像数据(转)
- 使用C函数读取BMP格式图像
- C/C++ 图像二进制存储与读取
- C/C++ 图像二进制存储与读取
- 纯c语言读取BMP图像
- 针孔相机拍摄的图像坐标和空间点的对应关系
- 针孔相机拍摄的图像坐标和空间点的对应关系
- 针孔相机拍摄的图像坐标和空间点的对应关系
- 读取图像中任意点的像素值
- 读取BMP图像每一像素点RGB数据
- 读取BMP图像每一像素点RGB数据
- 读取图像中任意点的像素值
- 轮播图详解
- Solr6配置中文分词库mmseg4j
- Unity3D自学笔记——角色属性设计分析
- Latex编译出现“Error: Missing $ inserted ”
- JavaWeb初级学习 之 JQuery
- 读取灰点相机图像C++
- 我的C语言学习心得(三)
- Minimum Inversion Number
- 利用python做数据分析 札记(一)
- AES工具类
- 系统设计及规划
- Linux 维护模式时磁盘为只读模式
- DOS命令
- JavaScript实现trim函数