Repository navigation
Conversation
lagru
left a comment
There was a problem hiding this comment.
Thank you @Coilm for coming back to this. This is marked as a "Draft" but let me know if you already want broad feedback and / or help. :)
|
Please ignore most of the CI for now. The one things you could do is to setup & run your pre-commit hooks: The pre-commit.ci - pr job is complaining about some formatting. |
|
@lagru hello ! I definitely would be interested in some feedback on the implementation, I marked it as draft because it is still missing proper docstring/tests/demos. |
|
Anyone is able to help me with the circleci;doc error?
I am probably missing some part of init somewhere? |
Still need to work on the homography since this one will need to use warp, so need to be carefull with the x,y vs i,j convention
|
Hi @Coilm, I found this because I'm looking into using ECC in python, great work! Cheeky question: I wish there were an additional motion type between euclidean and affine for similarity transforms: e.g. it would use translation, rotation, and scaling, but not shear. Does that seem possible with ECC? Not a feature request, just curious in general how you would implement it. |
|
Hello @eliotl, If you want to try to implement it yourself, here is the procedure: Considere your transformation matrix defined in the homogeneous coordinate If you do the matrix product, then Therefore MX give us two equations: Then the gradient is defined as where Therefore the function to compute the jacobian should look something like this (did not test it): def compute_jacobian_custom(grad, xy_grid, warp_matrix):
grad_iw_x, grad_iw_y = grad
x_grid, y_grid = xy_grid
h0 = warp_matrix[0, 0] # a0 cos(theta)
h1 = -warp_matrix[0, 1] # a0 sin(theta)
h2 = warp_matrix[1,0 ] # a1 sin(theta)
h3 = warp_matrix[1, 1] # a1 cos(theta)
theta = np.arctan2(h1, h0)
return np.stack([
(-h1 * x_grid - h0 * y_grid) * grad_iw_x + (h3 * x_grid - h2 * y_grid) * grad_iw_y,
grad_iw_x * (np.cos(theta) * x_grid - np.sin(theta) * y_grid),
grad_iw_y * (np.sin(theta) * x_grid + np.cos(theta) * y_grid),
grad_iw_x,
grad_iw_y
])and the update function would be something like this: def update_warping_matrix_custom(map_matrix, update):
new_theta = update[0]
new_theta += np.arctan2(-map_matrix[0, 1], map_matrix[0, 0])
map_matrix[0, 0] = update[1] * np.cos(new_theta)
map_matrix[1, 1] = update[2] * np.cos(new_theta)
map_matrix[1, 0] = update[2] * np.sin(new_theta)
map_matrix[0, 1] = -update[1]* np.sin(new_theta)
map_matrix[0, 2] += update[3]
map_matrix[1, 2] += update[4]
return map_matrixLet me know if you manage to make it work, or if you need help. |
|
😍 wow, thank you so much! |
|
@Coilm Thanks for this work. I have been testing it with some large images and have some minor changes to support running using CuPy on the GPU, reduce memory footprint, and support homographic transforms (CuPy doesn't support |
Hello @tkunicki ! I am glad to see that this implementation was usefull for you. You can do a pull request on my mirror: |
|
We have changed the base branch for this PR from the Summary - what this means for your PRYou can continue to work on your PR, now based on Once we've merged your PR into the In addition - our automated script detected that your branch had merge conflicts with the pre-Megamove branch. Please make sure to merge in the Read on for the Megamove rationale, and more detailed instructions. DetailsRationaleWe've changed the base branch to make it easier and smoother to continue to work on your PR, while we work through a rather large change in the directory structure of the repository - a change that we have called Megamove. See the Megamove explanation issue for more detail. Changing the base branch means you do not see merge conflicts related to the Megamove change, and can continue to work with the repository in its original state, without worrying about porting those changes across to the new post-Megamove structure. As you'll see in the linked issue, you can continue to work on your PR as before, and you can continue to use the Github GUI to "Update branch" - this updates from the new To emphasize again, do not try and merge the scikit-image When we've approved your PR, we'll merge into the Any questions, please reply here. |
Description
(Modified from PR#7050)
Implementation of the enhanced correlation coefficient used for image alignement.
The code is based on the original paper from G.D Evangelidis and the implementation by the authors into OpenCV (here).
Compared to the initial implementation in PR#7050, this one leverage numpy broadcasting for most of the operations, and therefore is roughly 40% faster.
Checklist
./doc/examplesfor new featuresRelease note
For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.