Registering multiple images - cpselect in loop?

5 visualizaciones (últimos 30 días)
Ron P
Ron P el 19 de Mzo. de 2020
Respondida: Abhisek Pradhan el 27 de Mzo. de 2020
Hi all,
Apologies if this is a trivial question - I'm relatively new to MATLAB compared to other languages. I'm working on registering multiple images from different modalities. I'm currently using the image processing toolbox, specifically the cpselect tool to do control point selection.
I've setup a small script to loop to allow me to select the corresponding images, then do the control point selection, then finally save the transformation matrix. Unfortunately, the loop executes before the cpselect command is finished. Is there a way to "pause" the loop like pausing a thread in MATLAB?
for i = 1:10
[f,p] = uigetfile({'*.png;*.jpg;*.bmp;*.tif','Supported images';...
'*.png','Portable Network Graphics (*.png)';...
'*.jpg','J-PEG (*.jpg)';...
'*.bmp','Bitmap (*.bmp)';...
'*.tif','Tagged Image File (*.tif,)';...
'*.*','All files (*.*)'});
rgb = imread([p f]);
[f,p] = uigetfile({'*.png;*.jpg;*.bmp;*.tif','Supported images';...
'*.png','Portable Network Graphics (*.png)';...
'*.jpg','J-PEG (*.jpg)';...
'*.bmp','Bitmap (*.bmp)';...
'*.tif','Tagged Image File (*.tif,)';...
'*.*','All files (*.*)'});
thermal = imread([p f]);
cpselect(rgb, thermal);
% Want to "pause" the loop here, so I can select the control points for the set of images, before moving on to the next pair of images
a = 'mytform_' ;
b = num2str(i) ;
c = '.mat' ;
file_name = [a b c];
mytform = fitgeotrans(movingPoints, fixedPoints, 'affine');
save(file_name, 'mytform')
end

Respuestas (1)

Abhisek Pradhan
Abhisek Pradhan el 27 de Mzo. de 2020
I could understand that you want to pause the loop till cpselect is complete. There may be couple of ways of doing it using waitfor or pause.
Following link may help –

Community Treasure Hunt

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

Start Hunting!

Translated by