## Matlab

Moderators: None (Apply to moderate this forum)
Number of posts: 2147

This Forum Only

Hello, i am currently trying to optimize on a function for a camera calibration code to give the correct x,y,z as well as the phi, theta, and alpha (the rotational values). So far i have written an if,else statement that says that the if the x = [ x, y, z, p, t, a] is +/- 3 or +/- 1 for any value of the matrix then the score will be very very large and that if it falls within the constraint it will optimize as normal. Everything seems to be working ok, EXCEPT for the z value. No matter what constraint i place on the z value it will always give me an optimized matrix of the upper limit of the constraint. (i.e. constraint= 300, opt(z)=299.999) now i know that this is not correct because i meticulously measured the z value when taking the real life picture that i am optimizing on it should be 200. what is wrong with my code? any suggestions?

Here are my if,else lines.....

upper = [ 3 1.4 203 181 1 .1];
lower = [-3 -4.6 197 179 -1 -.1];

if (x(1) < upper(1) > lower(1)) & (x(2) < upper(2) & x(2) > lower(2)) & (x(3) < upper(3) & x(3) > lower(3)) & (x(4) < upper(4) & x(4) > lower(4)) & (x(5) < upper(5) & x(5) > lower(5)) & (x(6) < upper(6) & x(6) > lower(6))
d = sqrt(((u(1)-U(1))^2)+((v(1)-V(1))^2))+(((u(2)-U(2))^2)+((v(2)-V(2))^2))+(((u(3)-U(3))^2)+((v(3)-V(3))^2))+(((u(4)-U(4))^2)+((v(4)-V(4))^2))+(((u(5)-U(5))^2)+((v(5)-V(5))^2))+(((u(6)-U(6))^2)+((v(6)-V(6))^2))+(((u(7)-U(7))^2)+((v(7)-V(7))^2))+(((u(8)-U(8))^2)+((v(8)-V(8))^2))+(((u(9)-U(9))^2)+((v(9)-V(9))^2))+(((u(10)-U(10))^2)+((v(10)-V(10))^2))
else
d = 10000000000
end

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic