Is TS asking about an algorithm to remove the integral mask from scanned color negatives? I have read this thread just quickly, so sorry for my ignorance if I have misunderstood completely!
If this thread *is* about removing the integral mask from scanned negatives, then I might be able to contribute some. I tried to solve this task myself some time ago and studied e.g. "Advanced Photography" by M.J Langford to learn about how integral masks are constructed and from that I tried to do some reverse engineering. To my understanding, the integral mask is actually made up from 2 (or 3 depends on how you look at it), a pinkish mask that is due to the cyan layer in the film, and a yellowish mask due to the magenta layer in the film. Together, this two masks form a gives an overall orange appearance. The key observation is that the mask are not constant density, but depends on the density of the cyan and magenta dye layers in the film. So, to remove the integral mask digitally, one must first estimate how dense the integral masks are. Below in this post is piece of code that i have written. The code is in matlab, but should be understandable for anyone with skills in programming. In this code, it is assumed that the input image 'imRGBin' is *linear* (i.e. no jpeg-file, no gamma encoding etc, just raw data from the scanner) and with all pixel values in the range [0 1]. The constants dMY, dCY, dCM are constants representing the maximum density of the masks, these constants depend on the film at hand and must be tuned for each scanned negative/roll. Good starting points are dMY=0.2, dCY=0.4, dCM=0.4.
I hope this makes sense to someone (TS perhaps) and is not completely out of scope!?
function imRGBout = integralMaskEstimation(imRGBin, dMY, dCY, dCM)
% integralMaskRemovalCore core algorithm to estimate integral mask
%
% Convert RGB ---> CMY (CMY = 1 - RGB)
imCMY = bsxfun(@minus, 1, imRGBin);
% Calculate the pinkish integral mask due to cyan layer
imMaskCY = dCY .* imageInvert( imCMY( :,:,1) );
imMaskCM = dCM .* imageInvert( imCMY( :,:,1) );
% Calculate the yellowish integral mask due to magenta layer
imMaskMY = dMY .* imageInvert( (imCMY( :,:,2) - imMaskCM));
% Build integral mask
imIntegralMask = zeros( size(imCMY) );
imIntegralMask( :,:,2) = imMaskCM;
imIntegralMask( :,:,3) = imMaskMY + imMaskCY;
imIntegralMask(imIntegralMask > 1) = 1;
imIntegralMask(imIntegralMask < 0) = 0;
% Generate output (and convert CMY ---> RGB)
imRGBout = bsxfun(@minus, 1, imCMY - imIntegralMask);
imRGBout(imRGBout > 1) = 1;
imRGBout(imRGBout < 0) = 0;
end%function