How to perform image registration on non-rectangular image

12 visualizzazioni (ultimi 30 giorni)
I'm interesting in peforming image registration using imregtform on a non-rectangular region of interest that would be the "moving" image. Is there any way to do this? I initially tried to turn all the pixels within the "moving" image matrix that I don't want to affect registration to NaNs, but the imregtform function won't accept that input.
  3 Commenti
Jeremy Eekhoff
Jeremy Eekhoff il 6 Giu 2022
That would not work because the black pixels would still affect registration. My images do not have a black background.
raym
raym il 8 Nov 2024 alle 6:09
Modificato: Walter Roberson il 8 Nov 2024 alle 6:15
Dear Jeremy D. Eekhoff,
I'm sorry to trouble you on on the forum here.
I read your article "Three-dimensional computation of fibre orientation, diameter and branching in segmented image stacks of fibrous networks" by Jeremy D. Eekhoff and Spencer P. Lake.This is a really great application on detection of fibers in 3D space. I want to have a try and download the code from github: https://github.com/jeremyeekhoff/Fiber-Analysis-Algorithm .
I used a demo 3D stack fiber stainning image to run the function fiberAnalysisAlgorithm.m on R1026a, with MinGW64 compiler on win8.1.
However, it shows the error on the two mexw64 files:
Invalid MEX-file 'mexfilename': The specified module could not be found.
I have tried using dependencywalker to find which dlls are missing. It first says that several dlls in C:\Program Files\MATLAB\R2016a\bin\win64 is missing. Thus I add this folder to env and restart computer and re-run, then it says the following dlls are missing, although most of them exist in folders below, except API-MS-WIN-CORE-SHUTDOWN-L1-1-1.DLL.
API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL
API-MS-WIN-CORE-SHUTDOWN-L1-1-1.DLL
API-MS-WIN-SERVICE-PRIVATE-L1-1-1.DLL
I searched and find that API-MS-WIN-CORE-SHUTDOWN-L1-1-1.DLL is obselete in Win8.1
After I download API-MS-WIN-CORE-SHUTDOWN-L1-1-1.DLL and place in the same folder of m code, the error still persist, and
dependencywalker shows more complicated errors. I guess it is a problem of mexw64 compiling environment differs too much with my environment. Could you give me some instructions on this?
Thank you.
----the path to most of dlls above:
C:\Windows\System32\downlevel\API-MS-Win-Core-Kernel32-Private-L1-1-1.dll
C:\Windows\SysWOW64\downlevel\API-MS-Win-Core-Kernel32-Private-L1-1-1.dll
C:\Windows\WinSxS\amd64_microsoft-windows-m..namespace-downlevel_31bf3856ad364e35_6.3.9600.16384_none_2c5177c069a919dd\API-MS-Win-Core-Kernel32-Private-L1-1-1.dll
C:\Windows\WinSxS\x86_microsoft-windows-m..namespace-downlevel_31bf3856ad364e35_6.3.9600.16384_none_d032dc3cb14ba8a7\API-MS-Win-Core-Kernel32-Private-L1-1-1.dll
C:\Users\rmd\AppData\Local\GeoGebra_6\app-6.0.583\API-MS-Win-Core-Kernel32-Private-L1-1-1.dll
-----
C:\Windows\System32\downlevel\api-ms-win-core-privateprofile-l1-1-1.dll
C:\Windows\SysWOW64\downlevel\api-ms-win-core-privateprofile-l1-1-1.dll
C:\Windows\WinSxS\amd64_microsoft-windows-m..namespace-downlevel_31bf3856ad364e35_6.3.9600.16384_none_2c5177c069a919dd\api-ms-win-core-privateprofile-l1-1-1.dll
C:\Windows\WinSxS\x86_microsoft-windows-m..namespace-downlevel_31bf3856ad364e35_6.3.9600.16384_none_d032dc3cb14ba8a7\api-ms-win-core-privateprofile-l1-1-1.dll
C:\Users\rmd\AppData\Local\GeoGebra_6\app-6.0.583\api-ms-win-core-privateprofile-l1-1-1.dll
-----this one may be missing, I will copy it and have a try
C:\Users\rmd\AppData\Local\GeoGebra_6\app-6.0.583\api-ms-win-core-shutdown-l1-1-1.dll
-----
C:\Users\rmd\AppData\Local\GeoGebra_6\app-6.0.583\api-ms-win-service-private-l1-1-1.dll
C:\Windows\System32\downlevel\api-ms-win-service-private-l1-1-1.dll
C:\Windows\SysWOW64\downlevel\api-ms-win-service-private-l1-1-1.dll
C:\Windows\WinSxS\amd64_microsoft-windows-m..namespace-downlevel_31bf3856ad364e35_6.3.9600.16384_none_b8233abb5511544f\api-ms-win-service-private-l1-1-1.dll
C:\Windows\WinSxS\x86_microsoft-windows-m..namespace-downlevel_31bf3856ad364e35_6.3.9600.16384_none_5c049f379cb3e319\api-ms-win-service-private-l1-1-1.dll

Accedi per commentare.

Risposte (2)

Matt J
Matt J il 6 Giu 2022
Modificato: Matt J il 6 Giu 2022
If you have the Optimization Toolbox, you could use lsqcurvefit (don't be misled by the name) to minimize your own reigstration cost function, one which accepts an ROI mask.
  5 Commenti
Matt J
Matt J il 1 Ago 2022
Modificato: Matt J il 1 Ago 2022
What is usually done to improve robustness is that you first smooth and downsample the images and perform an initial registration. Then you reduce the smoothing and repeat the registration with the previous registration result as your initial guess. This is repeated until the registration is done at full resolution.

Accedi per commentare.


Image Analyst
Image Analyst il 1 Ago 2022
Is it rotating and scaling while it translates? If not, you could use normalized cross correlation. See attached demo.
Or try one of the panoramic stitching algorithms. They find matching regions, which is necessary to construct the overall image.
  5 Commenti
Jeremy Eekhoff
Jeremy Eekhoff il 11 Ago 2022
Hey - quick following up on this. I was able to somewhat get this working using fmincon, but the results weren't quite as good as I get using imregtform and I would often have to change the optimizer options for different sets of images. I had the idea to try to go back and use imregtform and set the pixel intensities of all pixels outside of the polygonal region of interest to uniformly distributed random values, the idea being that the blocks of random pixels would have zero mutual information with the fixed image regardless of where it ended up and therefore wouldn't affect the registration. This ended up working better than my attemps to make my own registration optimizer. Does this seem like a reasonable solution or am I missing something that could be problematic?
Matt J
Matt J il 11 Ago 2022
Does this seem like a reasonable solution or am I missing something that could be problematic?
I can't argue with success, but I vaguely wonder why setting the background pixels to some constant wouldn't do the same thing. An atomic distribution is independent of every distribution as well.

Accedi per commentare.

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by