regarding passing input as images to a function from two different folders

1 回表示 (過去 30 日間)
Poreddy ajaykumar reddy
Poreddy ajaykumar reddy 2021 年 9 月 6 日
編集済み: Abolfazl Chaman Motlagh 2021 年 9 月 6 日
function [disparity map]=map(leftview,rightview)
%some processing steps will be there
end
I need to call two differentimages at a time from two different folders at a time
can any suggest how to call them at a time
example:assume i have 5 images for left view-seperate folder
assume i have two 5 images from right view-seperate folder
now i need to one from one from right view
how to write a loop for that
  4 件のコメント
Jan
Jan 2021 年 9 月 6 日
How can the code decide which two images are shown together?
Poreddy ajaykumar reddy
Poreddy ajaykumar reddy 2021 年 9 月 6 日
example
leftview=[1, 1, 1, 1];
right view=[1,2, 3, 4];
function should call
leftview =1;
right view =1;
next iteration
left view=2;
right view=2;
like that it should continue
please help me to write a loop

サインインしてコメントする。

回答 (1 件)

Abolfazl Chaman Motlagh
Abolfazl Chaman Motlagh 2021 年 9 月 6 日
編集済み: Abolfazl Chaman Motlagh 2021 年 9 月 6 日
i think it is easier for you to use imagedatastore.
use :
images_left = imageDatastore('left_view_folder');
images_right = imageDatastore('right_view_folder');
where left_view_folder and right_view_folder are name of two folder. (you should run the code in folder contain these to folder otherwise put while path.)
then assuming you have a sequence for selection as you mentioned in comment: (for example)
left_views = [1, 1, 1, 1];
right_views = [1, 2, 3, 4];
so just do this:
for i=1:numel(left_view)
disparityMap{i} = map(readimage(images_left,left_views(i)) , readimage(images_right,right_views(i)));
end
readimage is a function wich get imageDatastore and index of image and return the image.
the above code is equal to :
for i=1:numel(left_view)
left_image = readimage(images_left,left_views(i));
right_image = readimage(images_right,right_view(i));
disparityMap{i} = map(left_image,right_image);
end

カテゴリ

Help Center および File ExchangeCamera Calibration についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by