rewriting equation for optimization to matrix equation -
i need minimize equation in attached picture.
given function p=f(q). p integers ranging 1 254, while q set of 254 real numbers. f monotonic function maps member set q set p. n number of pixels in image, while a, b , c refer 3 different images. need find inverse of f, or 244 real numbers in q (since f function integers) in q[i] = f_inverse(p[i]) (assume p arranged 1 254 in order).
my approach write p nx3 array, nth row contains 3 elements pa(n),pa(n), pb(n). array can constructed 3 images each contain n pixels. have following code:
def g(q,p): n = p.shape[0] value = 0 in range(n): value = value + (q[p[i,0]+q[p[i,1]-q[p[i,2]])**2 return value guess = np.arange(0,256)/255.0 q = spo.minimize(g,guess,args=p)
and try minimize function g try vector q. however, says 'operands not broadcast shapes (1,254) (87500,3)'. these shapes of q (the unknown solved) , p (87500 number of pixs) respectively. why that?
besides, if works, seems slow method trying optimize function 244 untry solution consists of 254 unknowns simultaneously. equation i'm trying solve research paper, , paper mentions rewriting equation aq=0, using singular value decomposition obtain solution. have no idea whole paragraph means, i'm wondering if there ways rewrite problem can handled more , efficiently.
Comments
Post a Comment