I have a nonlinear curve (found using bicubic interpolation; see below) that describes the transformation of intensity values from the target image to reference image values. (Apologies if I'm not using the correct terminology here).
What is the best way of applying this curve to the target image?
I am basically looking for the fastest way to achieve this;
for i = 1:length(curve)
I(I==i) = curve(i);
end
which is fairly slow.
Your curve function as look-up table, the simplest way to execute look up table is:
lookuptable=[ 9 8 7 6 5 4 3 2 1 0 ];
I=[ 1 3 4;
5 3 8];
Itransformed=lookuptable(I)
Notice that the index of the lookuptable is accessed by the value of the pixel. So if the pixel value range is 0-255, first you should use lookuptable with size of 256 use, and second remember to compensate the fact that matlab index is 1:256 so use:
Itransformed=lookuptable(I-1);