Borrar filtros
Borrar filtros

How does imregtform work?

21 visualizaciones (últimos 30 días)
Manasvini
Manasvini el 5 de Sept. de 2022
Comentada: Manasvini el 9 de Sept. de 2022
Hello! I'm trying to register two images taken with an endoscope. When I run this piece of code, Matlab gets stuck in the imregtfrom function and I have to end the program manually. This is what my code looks like:
fixed = rgb2gray(imread('test1.jpg'));
moving = rgb2gray(imread('test2.jpg'));
imshowpair(fixed, moving,'Scaling','joint')
optimizer = registration.optimizer.OnePlusOneEvolutionary;
metric = registration.metric.MattesMutualInformation
optimizer.InitialRadius = 0.009;
optimizer.Epsilon = 1.5e-4;
optimizer.GrowthFactor = 1.01;
optimizer.MaximumIterations = 300;
movingRegistered = imregister(moving,fixed,'affine',optimizer,metric);
figure
imshowpair(fixed, movingRegistered,'Scaling','joint')
When I end the run session, I get these messages in the command window:
I'm not sure where my mistake is, I am trying to do something similar to the example on this page. Thank you!
  2 comentarios
Matt J
Matt J el 5 de Sept. de 2022
I suggest attaching test1.png and test2.ng so that we can try ourselves.
Manasvini
Manasvini el 5 de Sept. de 2022
The photos are attatched here, they are dental images taken with an endoscope. Thank you!

Iniciar sesión para comentar.

Respuesta aceptada

Chaitanya Krishna Kantambhatla
Chaitanya Krishna Kantambhatla el 8 de Sept. de 2022
Thanks for sharing the image files.
I could execute the code that you shared, and the code runs with out any error. However, it is taking a long time to get the results. (It took 437.251294 sec on my end).
There are a few approaches that you may wish to explore when increasing your performance of the 'imregister' function. Please find a brief summary of the possible approaches below:
1) As 'imregister' uses an iterative algorithm, it's performance will linearly scale with the number of iterations. You may wish to try to manually tune the 'MaximumIterations' property of the optimizer object returned by 'imregconfig' to determine if you can obtain an acceptable registration in fewer iterations.
2) As the image registration is computed with an optimization approach, registration will always be quicker if you can provide a good initial condition for the registration estimate. The closer this initial condition is to the correct alignment, the faster 'imregister' will converge.
3) You may wish to use the 'registrationEstimator' app in MATLAB if you have not already, as this application can help define a registration pipeline that may be able to achieve a good registration and alignment in less time than using 'imregister' alone. Please find a link to the documentation page for this application below:
  3 comentarios
Matt J
Matt J el 8 de Sept. de 2022
Editada: Matt J el 8 de Sept. de 2022
(I need my final image to be grayscale)
Use im2gray, or similar.
I reduced the 'MaximumIterations' property and was able to get a registered image much faster.
It should also help to crop your images to a smaller bounding box around the teeth. All the surrounding black pixels are just increasing the required computations and don't really contribute any information to the registration.
.
Manasvini
Manasvini el 9 de Sept. de 2022
Thank you for the cropping advice! I tried doing that and my runtime was much quicker. I don't think using im2gray will work for my project because I will be creating a heatmap from the registered image. Thus, if the Registration Estimator App adds a color overlay and then I convert the image to grayscale, I'll end up with an inaccurate heatmap.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by