how can i stitch different images)

3 Ansichten (letzte 30 Tage)
SAMEER BAMBAL
SAMEER BAMBAL am 20 Mär. 2019
Bearbeitet: SAMEER BAMBAL am 20 Mär. 2019
I want to stitch multiple images. Can You please tell me, how to take the multiple images using for loop.Actually I know how to use for loop but it is getting stiched .
In the Matlab example of '3-D Point Cloud Registration and Stitching'.They used living room data file to load multiple images and for loop to start from the third images by taking first as reference. And they are using point cloud object but did not mention which file type they are using.(bcz JPeg , PNG doesn't work as the down sampling and transform need 3d object). It would be helpful for me how to proceed this problem, like how to create directory and for loop to stitch together. 2)Also it would be great if I come to png or jpg format stiching also
Thank you in advance

Antworten (1)

KSSV
KSSV am 20 Mär. 2019
Check the below demo code which stitches (joins) all the RGB images given inbuit in matlab tool boxes. You may take your own directory of images which you want to stitch.
wd = pwd;
cd('C:\Program Files\MATLAB\R2017b\toolbox\images\imdata')
D = dir;
cd(wd)
C = {'.tif';'.jp';'.png';'.bmp'};
idx = false(size(D));
for ii = 1:length(C)
idx = idx | (arrayfun(@(x) any(strfind(x.name,C{ii})),D));
end
D = D(idx);
L = length(D);
II = cell([],1) ;
count = 0 ;
for i = 1:numel(D)
file = [D(i).folder,filesep,D(i).name] ;
I = imread(file) ;
% Pick only RGB images
if size(I,3)==3
count = count+1 ;
II{count} = I ;
end
end
%% Stitch them
m = cellfun(@(x) size(x,1), II) ; % get rows
n = cellfun(@(x) size(x,2), II) ; % get rows
% Get maximum to reisze the images
nx = max(m) ;
ny = max(n) ;
% resize all the images
II = cellfun(@(x) imresize(x,[nx,ny]),II,'un',0) ;
%% Arrange the cell of images in some order
R = cellfun(@(x) x(:,:,1),II,'un',0) ;
G = cellfun(@(x) x(:,:,2),II,'un',0) ;
B = cellfun(@(x) x(:,:,3),II,'un',0) ;
R = reshape(R,5,8) ; % here I choose 5*8..you may choose any so that the elements should not change
G = reshape(G,5,8) ;
B = reshape(B,5,8) ;
% Make them a matrix
R = cell2mat(R) ;
G = cell2mat(G) ;
B = cell2mat(B) ;
% make the RGB
I = cat(3,R,G,B) ;
% display them
imshow(I)
Also you have a look on _montage_.
  1 Kommentar
SAMEER BAMBAL
SAMEER BAMBAL am 20 Mär. 2019
Thank you for the response.I will try this as well.
I just edited my question.I have query regarding Ply format.
How can i do this.I am able to stitch 2 ply files but for loop i am using , it is not reading the next ply files.(Actually assigning directory might be creating problem). Any help would be appreciated regarding this.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by