Iteratively selecting rotation angle for alingment

5 views (last 30 days)

Hi all, I am trying to build an alignment function to find the lowest RMSE. I can’t upload the code but this works by taking 3 rotation angle for x,y and z as input. My polblme is trying to not just brute force try all angle possibilities so for example right now I have x = linspace(-10,0,50) for each but this is a crazy amount of permutations to try has anybody tried to solve anything similar. I know I could just randomly choose an angle and see if lowers my error. Any tips please tim

Answers (2)

Star Strider
Star Strider on 5 Jan 2025
I do not understand what you are doing or want to do. Calculating the RMSE implies that you have something you want to compare the input values to, however it is not obvious what that is.
If (x,y,z) are Cartesian values (with respect to an origin at (0,0,0)), you can use the cart2pol function to convert them to azimuth, elevation, and radius.
  2 Comments
tim pearce
tim pearce on 5 Jan 2025
Moved: Walter Roberson on 5 Jan 2025

Hi thanks for the reply’s the optimisation toolbox may be helpful if I can use my own function with it I’ll have a read of it to see if it will help. @starstrider. Sorry it’s not all that clear. But yea these are Cartesian angles I know there is no built in function to do as I which it’s more about setting out how to solve to reduce the error as small as possible with the 3 angles being my changing variables. I have it working in a loop that would just take a value for each angle and compute the error but to brute force this would be crazy and take weeks to run! I know this is an optimisation problem so looking for how others have set-up similar workflows.

Star Strider
Star Strider on 5 Jan 2025
To do nonlinear optimisation, using your own function would be required.
What I still do not understand are the data you are working with, and what you want to do with them. What are you comparing? (Wanting to calculate the RMSE implies minimising the error in comparing your data with something.) What information do you want as the result?

Sign in to comment.


Matt J
Matt J on 5 Jan 2025
Use imregtform if you are aligning images. If you are aligning points, use this,
Even if these do not use the alignment cost function you want, they ought to provide decent initial guesses for the Optimization Toolbox solvers.

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!