How to perform image registration on non-rectangular image
14 views (last 30 days)
Show older comments
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 Comments
raym
on 8 Nov 2024 at 6:09
Edited: Walter Roberson
on 8 Nov 2024 at 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
Answers (2)
Matt J
on 6 Jun 2022
Edited: Matt J
on 6 Jun 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 Comments
Matt J
on 1 Aug 2022
Edited: Matt J
on 1 Aug 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.
Image Analyst
on 1 Aug 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 Comments
Matt J
on 11 Aug 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.
See Also
Categories
Find more on Geometric Transformation and Image Registration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!