Hi, I need some explanation for the following code we wrote in class today:
function [imageMapped] = L1_image_map(image,T)
imageMapped = zeros(size(image));
for channel = 1:size(image,3)
for ii= 1:size(image,1)
for jj=1:size(image,2)
imageMapped(ii,jj, channel)=T(image(ii,jj,channel) +1,channel);
end
imageMapped = im2uint8(imageMapped);
end
end
end
Where T is the transformation function T=255*CDF. Thanks!

 Réponse acceptée

Image Analyst
Image Analyst le 6 Déc 2017
Modifié(e) : Image Analyst le 6 Déc 2017

0 votes

Why should there be T=255*CDF? You'd use the CDF to create T if you were doing a histogram equalization, but this function doesn't do that (unless you passed in a T of that).
This code is basically a look up table operation, the kind of thing done by the function intlut(). It changes the gray level of the image based on what the value is in the index of T. For example if T(5) is 100, then a gray level of 4 would get mapped/changed to a gray level of 100.
  1. T(1) is the new gray level for pixels with a value of 0.
  2. T(2) is the new gray level for pixels with a value of 1.
  3. T(3) is the new gray level for pixels with a value of 2.
  4. etc.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by