资源简介
文章名称:3-D Point Cloud Generation from Rigid and Flexible Stereo Vision Systems
文章(英文)详细讲解了双目视觉的一些基本原理,已经如何使用两个普通的网络摄像头来实现双目视觉,以及如何根据两个摄像头来计算物体深度信息。
代码为文章中附带的代码
仅供参考学习
代码片段和文件信息
#include “StereoFunctions.h“
#include “math.h“
int fileNO = 0;
//variables for correlation routine some of them can be changed in analysis mode with
the correlation tools window
int stereoDispWindowSize //41
stereoDispTextureThreshold //15
stereoDispUniquenessRatio //10
stereoPreFilterSize
stereoPreFilterCap
stereoSavePointCloudValue
stereoSaveOriginal
stereoNumDisparities;
//Correlates pixels from the left and right images results in a disparity map which is
stored in the variable ‘disp‘
void StereoFunctions::stereoCorrelation()
{
//Setup for finding stereo corrrespondences
CvStereoBMState *BMState = cvCreateStereoBMState();
assert(BMState != 0);
BMState->preFilterSize= stereoPreFilterSize;
BMState->preFilterCap= stereoPreFilterCap;
BMState->SADWindowSize= stereoDispWindowSize;
BMState->minDisparity=0;
BMState->numberOfDisparities=stereoNumDisparities;
BMState->textureThreshold = stereoDispTextureThreshold;
BMState->uniquenessRatio = stereoDispUniquenessRatio;
//timing for stereo correspondence can be assessed by turning on the timer
/* double time_tot =0;
clock_t start diff;
double difference;
for(int i=0;i<100;i++)
{
start=clock();*/
cvFindStereoCorrespondenceBM(img1r img2r disp BMState);
//performs stereo correspondence on the rectified left and right images
/* diff = clock() - start;
difference = (double)diff/CLOCKS_PER_SEC;
time_tot+=difference;
}
printf(“Time taken %f seconds“(double)((double)time_tot/100));*/
cvNormalize( disp vdisp 0 256 CV_MINMAX );
//save rectified iamges and disparity map if SHOW_SAVE_DATA is set to 1
if(SHOW_SAVE_DATA){
cvShowImage(“Disparity Map“ vdisp);
string dispFile;
stringstream str str2str3;
string left right;
str<<“Disparities/DisparityMap“<<“-“< dispFile=str.str();
cvSaveImage(&dispFile[0]vdisp);
str2<<“Rectified/Left“<<“-“< str3<<“Rectified/Right“<<“-“< left=str2.str();
right=str3.str();
cvSaveImage(&left[0]img1r);
cvSaveImage(&right[0]img2r);
}
cvReleaseStereoBMState(&BMState);
fileNO++;
}
//Saves point clouds to Dylan‘s and Dan‘s viewer format as well as ascii format for
applied imagery integration
//
void StereoFunctions::stereoSavePointCloud()
{
//used to store reprojected 3-D image using open cv reprojection routine
CvMat* threeDimage = cvCreateMat( imageSize.height
imageSize.width CV_32FC3);
FILE * threeFile* distanceFile;
//number of points in the point cloud needed for dylans viewer
long pointCount=0;
double depth=0 horiz=0 vert=0;
//vectors to store 3-D points calculated from reprojection
CvMat *depthM = cvCreateMat(imageSize.height imageSize.width CV_32F)
*horizM = cvCreateMat(imageSize.height imageSize.width CV_32F)
*vertM = cvCreateMat(imageSize.height imageSize.width CV_32F);
//create strings for point cloud files
stringstream strThreeD;
stringstream strDistance;
if(POINT_CLOUD_FMT_DYLAN)
strThreeD<<“Image-“<
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 9733 2016-05-08 21:43 StereoMain.cpp
文件 5488715 2016-05-08 21:37 Short_NJ_T_2009.pdf
文件 2022 2016-05-08 21:44 stdafx.h
文件 13942 2016-05-08 21:50 StereoFunctions.cpp
文件 1209 2016-05-08 21:49 StereoFunctions.h
文件 8668 2016-05-08 21:48 StereoGrabber.cpp
文件 880 2016-05-08 21:45 StereoGrabber.h
----------- --------- ---------- ----- ----
5525169 7
- 上一篇:极致板材开料木工行业下料软件
- 下一篇:rar(19)
相关资源
- opencvc车流量统计
- 车辆与车道线的检测与跟踪
- 基于opencv实现的图像拼接
- ROI区域&图像混合例程by浅墨
- ASM 人脸特征点提取
- 车牌识别源代码
- 并行计算mpi与openmp之蒙特卡洛求不规
- Opencv下利用SIFT、SURF、ORB三种特征点实
- opencv 、directshow捕获摄像头实时播放
- Opencv和图像分类
- 基于opencv的车道线检测代码
- OPENCv 在图片上写字,各种格式
- QT+OpenCV实现图像识别
- 程序包.rar基于pyqt+OpenCV设计的用户密
- OpenCV双目标定双目校正
- 用OpenCV作的一个车牌识别程序,可以
- 邮政编码识别 OPENCV
- opencv 神经网络分类
- opencv中文chm参考api文档
- opencv识别单行数字
- 颜色增强算法Opencv
- 一个基于 OpenCV 的人脸识别系统
- opencv检测人眼并精准定位瞳孔
- Opencv实现物体识别和追踪
- 基于OpenCV多目标的模板匹配算法
- Opencv中文手册资料
- opencv js单独文件
- opencv车辆检测model
- 编译opencv缺失的boostdesc_bgm.i等文件
- 基于OpenCV进行图像拼接原理解析和编
评论
共有 条评论