K M
Posts:
17
Registered:
4/26/12


Re: Intensity correction using leastsquares nonlinear approximation question
Posted:
Jul 5, 2012 5:16 AM


"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <jsvqi3$otd$1@newscl01ah.mathworks.com>... > "K M" wrote in message <jsvom2$ikn$1@newscl01ah.mathworks.com>... > > > > > I is the image to be transformed and thus X in the MATLAB lsqcurvefit syntax. > > 1_ Fine, but where do you declare it (I) in cost? Did you want I to be x_data? > > 2) If you want to solve leastsquare equality: y_data = a*x_data + b, > > then just do > P = [ones(numel(xdata,1) xdata(:)] \ y_data(:); > a = P(2); b = P(1); > > 3) But I still don't think that's the correct way to formulate the matching intensity. The unknown affine transform is operated on the input space of the histogram, not the output values; which is entirely different. > > Bruno
My apologies Bruno. I have spotted a rather big typo. The function is F = cost(val,I)) and not F = cost(val,xo,x_data,y_data).
I wanted the probability density function of I to be x_data so that the function would find a linear transformation for I such that its histogram matches y_data.
I think your comment in point 3 describes why it is not working. However, I was under the impression that by stipulating the histogram of I to be x_data and by defining the function as I did, lsqcurvefit would find the parameters such that
hist(fun(I)) is approximately hist(J) and thus does operate on the input space ?

