JuliaHCI / SubpixelRegistration.jl

Subpixel alignment of arrays.
MIT License
18 stars 6 forks source link

Output results depends on absolute image scaling #12

Closed roflmaostc closed 1 year ago

roflmaostc commented 2 years ago

Hi!

again thanks for that package!

However, I noticed that the output results depends on the overall scaling of the image (which it should not).

The reason might be that line: https://github.com/JuliaHCI/SubpixelRegistration.jl/blob/2868fb4f29c79f9349346de947af14f0f2cd242a/src/SubpixelRegistration.jl#L52

So it divides image_product element-wise with either the element itself or the eps values of the datatype.

If that's a phase normalization, wouldn't it make more sense to calculate

    image_product ./= maximum(abs.(image_product))

So that divides image_product elementwise by the same value, which is the maximum abs value of all entries.

But more critical is probably the 100 * eps(T)? If the absolute scaling is very low, the 100 * eps(T) is simply larger than the entry, and there will be a strange mismatch in the scalings.

I would be happy to hear your thoughts! I guess, the phase scaling can be arbitrarily defined and each of them might have strengths or weaknesses.

Best,

Felix

CC: @RainerHeintzmann

mileslucas commented 1 year ago

Wow, sorry, this issue has flown completely under my radar! Let me take a look at the implementations in python and the original paper and see how they compare. I'll get back to you!

roflmaostc commented 1 year ago

I think the issue really is the 100 eps(T). It would be better to reference to the maximum or the minimum of the array to be in the right magnitude.

But thanks :))