Very impressive.. thanks
I got all the unknowns.
I was going to include more things in the "sovleeqn" but I get "limit error"
After getting unknowns (a-h) I have to transform them back to the image with
some formula.
I followed your outline to create "solveeqn"

          solveeqn=: 4 : 0
...
...  I'll skip the codes for getting unknowns (X=:Y%.A)
...
after that I create a set of grid points with the size of the image and get
the x and y grid points with:

          grid=: 4.$.$.|.(1090 1376$1)
          x_grid=:0 {"1 grid
          y_grid=: 1 {"1 grid

and transform them with the following formula for new x,y:

          x_new=: +/"1 ((x_grid,.y_grid,.1) *"1/ ((1 1 1 0 0 0 0 0)# X))  % 
(+/"1 ((x_grid,.y_grid,.1) *"1/ ((0 0 0 0 0 0 1 1)# X),1))
          y_new=: +/"1 ((x_grid,.y_grid,.1) *"1/ ((0 0 0 1 1 1 0 0)# X))  % 
(+/"1 ((x_grid,.y_grid,.1) *"1/ ((0 0 0 0 0 0 1 1)# X),1))
          x_new=: 1090 1376$x_new
          y_new=: 1090 1376$y_new
and the result:
          x_new,y_new

but I get "limit error".
now with this condition should I include loop for that or did I follow
stupid procedure to obtain x_new,y_new?

The actual formula for "x_new" and "y_new" is:

x_new = (a*x_grid + b*y_grid + c) / (g*x_grid + h*y_grid + 1)
y_new = (d*x_grid + e*y_grid + f) / (g*x_grid + h*y_grid + 1)

with "a,b,c,..,h" the unknowns in "X"



Henry Rich wrote:
> 
> OK.  I will outline a solution that you can fill in
> 
> Given the table A:
> 
> u1 v1 (x1 y1) ... repeated for many images
> 
> 0.  Create a verb 'solveeqn' that will solve one system, given
> 
>    x = 200x2 array of u v
>    y = 2x200 array of x y
> 
> 1.  Create
>    uv =. 2 {."1 A
>    xy =. 2 }. |: A
> 
> 2.  Run
>    _2 uv&solveeqn\ xy
> 
> You will get all your answers
> 
> Henry Rich
> 
> 
> 
-- 
View this message in context: 
http://old.nabble.com/make-equations-without-loop-tp34407576s24193p34410419.html
Sent from the J Programming mailing list archive at Nabble.com.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to