Comments (3)
Hello!
I have had multiple 4 channel images (R,G,B,IR). For the imreg_dfr similarity function you have to choose one of the color channels to run on. So i just used the function:
result = ird.similarity(template_img[0], subject_img[0]], numiter=1, order=1)
Where template_img[0]
and subject_img[0]
are 2D numpy arrays.
template_img.shape=(N,y,x)
template_img[0].shape=(y,x)
Where N is number of channels, y numbers of rows and x number of collums.
Out of the similarity function you get a result
dictionary with the scale, translation and rotation values. Then you transform all of the 4 channels with the same paramaters:
subject_img[0]= ird.transform_img(subject_img[0], scale=result['scale'], angle=result['angle'], tvec=result['tvec'], mode='constant', bgval=0, order=1)
subject_img[1]= ird.transform_img(subject_img[1], scale=result['scale'], angle=result['angle'], tvec=result['tvec'], mode='constant', bgval=0, order=1)
subject_img[2]= ird.transform_img(subject_img[2], scale=result['scale'], angle=result['angle'], tvec=result['tvec'], mode='constant', bgval=0, order=1)
subject_img[3]= ird.transform_img(subject_img[3], scale=result['scale'], angle=result['angle'], tvec=result['tvec'], mode='constant', bgval=0, order=1)
I dont know your code, but the shape issue could come from not taking just one channel for either template or subject image or one image has a 3d shape and not a 2d shape.
The result vary based on the choice of the color channel (it must be the same channel on both images) so test which gives best results in your case.
So one more time, the fist two arguments of the similarity function are 2d numpy arrays presenting the same color channel in both images.
Nice grettings!
from imreg_dft.
hi @jn31 can you please post your code here ? i am trying to get imreg_dft working for a similar problem too (4 channels, 3d stack of images) but i get an error - Images must have the same shape.
from imreg_dft.
The success correlates with the contrast in the power spectrum. See _get_success. And yes, you have correctly found out that you can use the similarity
function and the succes, which is part of its result.
from imreg_dft.
Related Issues (20)
- Investigate image registration on complex arrays HOT 1
- Memory issue HOT 1
- Array dtype conversion HOT 2
- Discrepancy in command line utility (ird) and python function (similarity)
- transform_img clips image, doesn't have option to specify output size HOT 2
- Error defining mask in utils.py HOT 1
- Using tiles in image registration HOT 1
- How to convert padded border of transformed image to black HOT 1
- Image is shifted out of frame
- I think this should say anticlockwise instead of clockwise
- sample PNGs for LargeTemplate [tiling] example do not open with Pillow 7.2
- installation
- Pixel values are changed after registration.
- how to uninstall imreg_dft
- [Need Help] What's that FILE OBJECT?
- [Help needed] Different shape images
- np.bool deprecated in utils.get_borderval( )
- Please update your release that the np.bool change reflects in the download HOT 1
- Nothing runs.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imreg_dft.