概述
matlab生成视差图函数disparity参数选择对生成的视差图效果有很大的影响,这里将matlab帮助中的参数进行列举,方便之后修改查验。
'Method' — Disparity estimation algorithm
'SemiGlobal' (default) | 'BlockMatching'
模式可选择BM和SGBM;
'DisparityRange' — Range of disparity
[0 64] (default) | two-element vector
视差图范围,默认是[0 64]
该值的设置取决于两相机的间距和物距综合影响,大基线距和近处测量时应增大视差范围,但范围差值要求可以被16整除。
'BlockSize' — Square block size
15 (default) | odd integer
窗口大小,范围是5~255,需要为奇数
'ContrastThreshold' — Contrast threshold range
0.5 (default) | scalar value
置信度区间,(0,1]
'UniquenessThreshold' — Minimum value of uniqueness
15 (default) | non-negative integer
视差唯一性百分比,视差窗口范围内最低代价是次低代价的(1 + uniquenessRatio/100)倍时,最低代价对应的视差值才是该像素点的视差,否则该像素点的视差为 0 。
当一个像素的唯一性值较低时,计算出的视差不太可靠。
'DistanceThreshold' — Maximum distance for left-to-right image checking
[] (disabled) (default) | non-negative integer
左右图像的最大阈值
matlab帮助中是这么写的,也就是当设置这个值时就能直接实现左右一致性检验了?目前还不清楚实现出来的效果怎么样
The distance threshold specifies the maximum distance between a point inI1 and the same point found from I2. The function finds the distance and marks the pixel in the following way:
Let p1 be a point in image I1.
Step 1: The function searches for point p1's best match in image I2 (left-to-right check) and finds point p2.
Step 2: The function searches for p2's best match in image I1 (right-to-left check) and finds point p3.
If the search returns a distance between p1 and p3 greater thanDistanceThreshold, the function marks the disparity for the point p1 as unreliable.
'TextureThreshold' — Minimum texture threshold
0.0002 (default) | scalar value
最小纹理阈值,This parameter applies only when you setMethodto'BlockMatching'.
程序如下:
clear;
% close all;
I1 = imread('E:leftl1.png');
% I1 = imresize(I1, 0.2);
I2 = imread('E:rightr1.png');
% I2 = imresize(I2, 0.2);
% figure, imshow(I1);
% figure
% imshow(stereoAnaglyph(I1,I2));
% title('Red-cyan composite view of the stereo images');
%
disparityRange = [0 128];
disparityMap = disparity(rgb2gray(I1),rgb2gray(I2),'BlockSize',...
15,'DisparityRange',disparityRange);
%
%disparityMap = disparity(rgb2gray(I1),rgb2gray(I2));
figure
imshow(disparityMap,disparityRange);
%imshow(disparityMap);
title('Disparity Map');
colormap jet
colorbar
最后
以上就是朴素黑米为你收集整理的matlab中disparity,matlab disparity函数的全部内容,希望文章能够帮你解决matlab中disparity,matlab disparity函数所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复