91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 10KB
    文件類型: .m
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-04
  • 語言: Matlab
  • 標簽: 立體視覺??

資源簡介

立體視覺,求取視差圖,效果不錯,可以使用

資源截圖

代碼片段和文件信息

hIdtc?=?vision.ImageDataTypeConverter;
hCsc?=?vision.ColorSpaceConverter(‘Conversion‘‘RGB?to?intensity‘);
leftI3chan?=?step(hIdtcimread(‘shudxc1.png‘));
leftI?=?step(hCscleftI3chan);
rightI3chan?=?step(hIdtcimread(‘shudxc2.png‘));
rightI?=?step(hCscrightI3chan);

figure(1)?clf;
imshow(rightI3chan)?title(‘Right?image‘);

figure(2)?clf;
imshowpair(rightIleftI‘ColorChannels‘‘red-cyan‘);axis?image;
title(‘Color?composite?(right=red?left=cyan)‘);
Dbasic?=?zeros(size(leftI)?‘single‘);
disparityRange?=?16;
%?Selects?(2*halfBlockSize+1)-by-(2*halfBlockSize+1)?block.
halfBlockSize?=?4;
blockSize?=?2*halfBlockSize+1;
%?Allocate?space?for?all?template?matcher?System?objects.
tmats?=?cell(blockSize);

%?Initialize?progress?bar
hWaitBar?=?waitbar(0?‘Performing?basic?block?matching...‘);
nRowsLeft?=?size(leftI?1);

%?Scan?over?all?rows.
for?m=1:nRowsLeft
????%?Set?min/max?row?bounds?for?image?block.
????minr?=?max(1m-halfBlockSize);
????maxr?=?min(nRowsLeftm+halfBlockSize);
????%?Scan?over?all?columns.
????for?n=1:size(leftI2)
????????minc?=?max(1n-halfBlockSize);
????????maxc?=?min(size(leftI2)n+halfBlockSize);
????????%?Compute?disparity?bounds.
????????mind?=?max(?-disparityRange?1-minc?);
????????maxd?=?min(?disparityRange?size(leftI2)-maxc?);

????????%?Construct?template?and?region?of?interest.
????????template?=?rightI(minr:maxrminc:maxc);
????????templateCenter?=?floor((size(template)+1)/2);
????????roi?=?[minc+templateCenter(2)+mind-1?...
???????????????minr+templateCenter(1)-1?...
???????????????maxd-mind+1?1];
????????%?Lookup?proper?TemplateMatcher?object;?create?if?empty.
????????if?isempty(tmats{size(template1)size(template2)})
????????????tmats{size(template1)size(template2)}?=?...
????????????????vision.TemplateMatcher(‘ROIInputPort‘true);
????????end
????????thisTemplateMatcher?=?tmats{size(template1)size(template2)};

????????%?Run?TemplateMatcher?object.
????????loc?=?step(thisTemplateMatcher?leftI?template?roi);
????????Dbasic(mn)?=?loc(1)?-?roi(1)?+?mind;
????end
????waitbar(m/nRowsLefthWaitBar);
end

close(hWaitBar);

figure(3)?clf;
imshow(Dbasic[])?axis?image?colormap(‘jet‘)?colorbar;
caxis([0?disparityRange]);
title(‘Depth?map?from?basic?block?matching‘);

DbasicSubpixel=?zeros(size(leftI)?‘single‘);
tmats?=?cell(2*halfBlockSize+1);
hWaitBar=waitbar(0‘Performing?sub-pixel?estimation...‘);
for?m=1:nRowsLeft
????%?Set?min/max?row?bounds?for?image?block.
????minr?=?max(1m-halfBlockSize);
????maxr?=?min(nRowsLeftm+halfBlockSize);
????%?Scan?over?all?columns.
????for?n=1:size(leftI2)
????????minc?=?max(1n-halfBlockSize);
????????maxc?=?min(size(leftI2)n+halfBlockSize);
????????%?Compute?disparity?bounds.
????????mind?=?max(?-disparityRange?1-minc?);
????????maxd?=?min(?disparityRange?size(leftI2)-maxc?);

????????%?Construct?template?and?region?of?interest.
????????template?=?rightI(minr:maxrminc:maxc);
?

評論

共有 條評論