Basler|基于OpenCV的Basler相机采集图像程序
来源:互联网 发布:对称矩阵特征向量正交 编辑:程序博客网 时间:2024/05/15 01:14
http://www.ithao123.cn/content-8057925.html
采用Basler4.0SDK编写,利用Event机制在回调函数中生成灰度图像
回调函数中图像生成代码,利用CCD中获取的无符号字符型数组转变成
Mat类型
Mat grab( siz, CV_8UC1, ptrGrabResult->GetBuffer(), siz.width*1 ); namedWindow( "test" ); imshow( "test", grab ); cvWaitKey(300);
生成的IplImage类型
IplImage* src = cvCreateImage( siz,IPL_DEPTH_8U, 1 ); cvSetData( src, ptrGrabResult->GetBuffer(), siz.width*1 ); cvNamedWindow("test"); cvShowImage( "test", src );
设置Basler相机的内部参数以及图像获取
// Create an instant camera object with the camera device found first. CBaslerGigEInstantCamera camera( CTlFactory::GetInstance().CreateFirstDevice()); // Print the model name of the camera. cout << "Using device " << camera.GetDeviceInfo().GetModelName() << endl; // For demonstration purposes only, register another image event handler. camera.RegisterImageEventHandler( new CSampleImageEventHandler, RegistrationMode_Append, Cleanup_Delete); // Camera event processing must be activated first, the default is off. camera.GrabCameraEvents = true; camera.Open(); // Set the AOI: // On some cameras the Offsets are read-only, // so we check whether we can write a value. Otherwise, we would get an exception. // GenApi has some convenience predicates to check this easily. camera.OffsetX.SetValue(0); camera.OffsetY.SetValue(0); camera.Width.SetValue(1280); camera.Height.SetValue(960); //Disable acquisition start trigger if available { GenApi::IEnumEntry* acquisitionStart = camera.TriggerSelector.GetEntry( TriggerSelector_AcquisitionStart); if ( acquisitionStart && GenApi::IsAvailable( acquisitionStart)) { camera.TriggerSelector.SetValue( TriggerSelector_AcquisitionStart); camera.TriggerMode.SetValue( TriggerMode_Off); } } // Set pixel format to Mono8 if available. if ( GenApi::IsAvailable( camera.PixelFormat.GetEntry(PixelFormat_Mono8))) { camera.PixelFormat.SetValue(PixelFormat_Mono8); } //Set exposure settings camera.ExposureMode.SetValue(ExposureMode_Timed); camera.ExposureTimeRaw.SetValue(1500); //100 by default // The parameter MaxNumBuffer can be used to control the count of buffers // allocated for grabbing. The default value of this parameter is 10. camera.MaxNumBuffer = 5; // Start the grabbing of c_countOfImagesToGrab images. // The camera device is parameterized with a default configuration which // sets up free-running continuous acquisition. camera.StartGrabbing(); // This smart pointer will receive the grab result data. CGrabResultPtr ptrGrabResult; // Camera.StopGrabbing() is called automatically by the RetrieveResult() method // when c_countOfImagesToGrab images have been retrieved. while ( camera.IsGrabbing()) { camera.RetrieveResult( 5000, ptrGrabResult, TimeoutHandling_ThrowException); }
0 1
- Basler|基于OpenCV的Basler相机采集图像程序
- Basler工业相机基于opencv 采集图像
- basler相机采集程序
- Basler相机采集的彩色图像转换到opencv中Mat的问题
- C#用basler相机sdk采集图像并用halcon显示的小程序
- Qt+BASLER相机+OpenCV
- Basler|basler设置相机参数
- Basler相机抓取图像并保存 Pylon
- basler pilot系列相机 MFC opencv
- Basler相机windows Opencv开发1
- Basler相机windows Opencv开发2
- basler 相机使用出现的问题
- Basler Pylon工业相机SDK的使用
- basler设置相机参数
- basler相机使用记录
- Basler|5.Pylon 相机程序开发中的若干总结
- basler相机硬件连接设置
- 关于basler相机sample使用的一些说明
- 浏览器及代码调试
- linux 查找命令
- iOS在控制器中使用NSTimer导致控制器无法销毁的解决方法
- Java Web(十三) 使用javamail进行发送邮件,(使用QQ,163,新浪邮箱服务器)
- 思维导图如何辅助程序设计师工作
- Basler|基于OpenCV的Basler相机采集图像程序
- 自定义浏览器滚动条的样式,打造属于你的滚动条风格
- Spark优化-troubleshooting-错误的持久化方式以及checkpoint的使用
- Transparent(透明的Toolbar) AppBarLayout and CollapsingToolbarLayout
- 历届试题 猜字谜
- 解决Android studio 编译报错 Error:null value in entry: outputDirectory=null
- 详解java设计模式(二)之工厂模式上篇(创建型)
- Linux到底是什么
- win7 : 找不到该项目,无法删除