c++ - Filter fluctuating lighting with OpenCV -


i need sensitive color (brightness) measurements in webcam footage, using opencv. problem experiencing ambient light fluctuates, makes hard accurate results. i'm looking way continuously update sequential frames of video smooth out global lighting differences. light changes i'm trying filter out occur globally in or of image. have tried calculate difference , subtract that, little luck. have advice on how approach problem?

edit: 2 images below same video, color changes magnified. if alternate between them, you'll see there's slight changes in lighting, due clouds shifting outside. problem these changes obscure other color changes might want detect.

so filter out these particular changes. given need part of frames capture, figured should possible filter out lighting changes occur in rest of footage well. outside of area of interest.

i have tried capture dominant frequencies in changes using dft, ignore changes in lighting. not familiar enough use of function. have been using opencv week, still learning.

enter image description here enter image description here

short answer: temporal low-pass filter on illumination whole

consider illumination, conceptually, time sequence of values representing light flux impinging upon scene being photographed. ideal situation function constant, second-best situation vary possible. low-pass filter changes function can vary rapidly 1 varies more slowly. basic steps thus: (1) calculate total illumination function (2) compute new illumination function using low-pass filter (3) normalize original image sequence new illumination values.

(1) simplest way of calculating illumination function add luminance values each pixel in image. in simple cases, might work; might guess tone there number of caveats.

an important issue you'd prefer add illumination values not in color space (such hsv) rather physical measure of illumination. going color space actual light in room requires data that's not in image, such spectral reflectivity of each surface in image, that's unlikely. proxy this, can use part of image, 1 has consistent reflectivity. in sample images, desk surface @ top of image use. select geometric region , compute total illumination number that.

related this, if have regions of image camera has saturated, you've lost lot of information , total illumination value won't relate physical illumination. cut out such regions (but consistently across frames).

(2) compute low-pass filter on illumination function. these transforms fundamental part of every signal processing package. don't know enough opencv know if it's got appropriate function itself, might need library. there lots of different kinds of low-pass filters, should give similar results.

(3) once you've got low-pass time series, want use normalization function total illumination. compute average value of low-pass series , divide it, yielding time series average value 1. transform each image multiplying illumination in image normalization factor. warnings working ideally in physical illumination space , not color space apply.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -