K M
Posts:
17
Registered:
4/26/12
|
|
Re: Intensity correction using least-squares non-linear approximation question
Posted:
Jul 3, 2012 3:43 PM
|
|
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <b2ab8ee2-2406-4b6e-8231-158b48066a67@googlegroups.com>... > K M > > I have a histogram matching app in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 > > It works for monochrome images. You can match any histograms to each other perfectly. > > In fact if your target histogram is flat, then this would be the ideal histogram equalization app. It's impossible to be better than the way I did it, and is way, way better than typical histogram equalization apps that use the CDF of the image histogram, in that it produces a truly flat histogram, unlike traditional methods. That said, no one ever said that a histogram equalized image ever gave the best looking or most useful image - it usually does not. Your proposed Gaussian Mixture model will not match the histograms better than my method - I guarantee it. > > If you have color images, see http://www.eyemaginary.com/Portfolio/ColorHistogramWarp.html which is possibly the best color histogram matching algorithm out there. > ImageAnalyst
Dear ImageAnalyst,
Thank you very much for your response.
I assume your function is the "Custom-shaped histogram" function?
I need to match I to J's histogram for registration purposes. Therefore, I do not think I need a truly flat histogram, unless I stand corrected.
I will try your function. However, beforehand, I would like to understand why my method is not working. Ideally, I'd like to create something myself before resorting to third-party code.
Example Code:
[n_i,x_i] = hist(I,1000); n_i = n_i ./ numel(I); x_data = n_i;
[n_j,x_j] = hist(J,1000); n_j = n_j ./ numel(J); y_data = n_j;
xo = [0.5 20]; trans = lsqcurvefit(@cost,xo,x_data,y_data)
where cost is defined as:
function F = cost(val,xo,x_data,y_data) F = val(1) * I + val(2)
Is this not minimising || f(hist(I)) - hist(J) || .^2 ?
where f() just a linear polynomial?
Nothing seems to happen.
Thanks,
KM
|
|