The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Intensity correction using least-squares non-linear approximation question
Replies: 11   Last Post: Jul 5, 2012 12:06 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 17
Registered: 4/26/12
Re: Intensity correction using least-squares non-linear approximation question
Posted: Jul 5, 2012 5:16 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <jsvqi3$otd$>...
> "K M" wrote in message <jsvom2$ikn$>...

> >
> > 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 least-square 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 ?

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.