MATLAB Answers

Remove temporal intensity changes in image series

2 views (last 30 days)
ecartman22 on 23 Apr 2021
Answered: Bjorn Gustavsson on 23 Apr 2021
I have a series of images in which a person (relatively still) is in the foreground with a stationary background with controlled lighting. A structured light pattern is projected on to the scene and observed by a webcam. However, due to some noise source, the intensity of the complete image changes randomly though uniformly through out the series. I would like to compensate for this intensity change from the foreground. I thought about using an roi from the background and averaging its intensity per frame over time to somehow use as a reference signal. What would be the best approach for compensating this change in intensity in the foreground?

Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 23 Apr 2021
I'd try something like this:
ImFiles = dir('*.png'); % well you have your images somehow...
roi_c = [11 37 17 51];
for iIm = numel(ImFiles):-1:1
currIm = double(imread(ImFiles(iIm).name));
rioAvg(i1,1) = mean2(currIm(roi_c(1):roi_c(2),roi_c(3):roi_c(4),1));
rioAvg(i1,2) = mean2(currIm(roi_c(1):roi_c(2),roi_c(3):roi_c(4),2));
rioAvg(i1,3) = mean2(currIm(roi_c(1):roi_c(2),roi_c(3):roi_c(4),3));
That should give you the RGB-intensity-averages in the image-regions.
When you subtract those background intensities you might have to ensure that the imagesc doesn't become negative to display with image, imagesc and imshow etc.




Community Treasure Hunt

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

Start Hunting!

Translated by