[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help please converting Matlab image code

From: Terry Duell
Subject: Help please converting Matlab image code
Date: Mon, 25 Apr 2011 10:06:10 +1000
User-agent: Opera Mail/11.10 (Linux)

Hullo All,
I have run in to difficulty finding a suitable 'translation' of some Matlab code. As I understand it, the purpose of this code is to adjust the histogram of of 'gray_in' to match reference image 'gray_reference'.

The code obtains a histogram of reference gray image ('grey_reference' uint8 0-255)

 hist_reference = hist(double(gray_reference(:)),[0:255]);

 The output, 'hist_reference' appears to be a 255 vector of the bin counts.

This is then used in the 'histeq' function along with another gray image ('gray_in' double 0-1);

 [j,t] = histeq(gray_in,hist_reference);

and the output, 't' is then massaged to produce the an output image ('out') which is one of the 3 images making up an RGB.

%% Now compute output image
  for a=1:size(gray_in,3)
  q = in(:,:,a);
  out(:,:,a) = uint8(256 * reshape(qm,size(gray_in(:,:,a))));

The problem I have is that the Octave 'histeq' function baulks at being passed the vector 'hist_reference', as 'histeq' calls 'gray2ind' which will only accept a positive integer as it's second argument.

I have spent some time looking through the available Octave functions, but have not yet seen any way of reproducing the effect of this code.

Does anyone have any suggestions as to how this might be done?

Terry Duell

reply via email to

[Prev in Thread] Current Thread [Next in Thread]