Detecting luminance level of a room using CCTV camera feed

Published on 2020-03-25

NOTE :Work in Progress

Recently I started working on a new research project. Goal of this project is to find a relationship between luminance value and RGB value. The application of the project is to find the luminance level in a in a small room using CCTV camera feed and adjust it to a optimum level.

Bellow is a outline of the plan,

  1. Find the background part of the scene.
  2. Segment the image.
  3. Find out suitable segments to keep a pixel value -> illuminance level mapping.
  4. Collect illuminance level(lux value)+images for period of time for above found out patches.
  5. Analize the relationship between the lux values and pixel values.
  6. Train a model using pixel values annotated with lux values to get lux value for new pixel values.

Find the background part of the scene

To find the background part, used the opencv implementation of MOG2 method. This implementation is focused on finding the foreground using a sequece of images. But it can be easily modified to get the background. Simply calculating the NOT of the foreground mask got the background mask.

Segment the image

In this case it was possible to leverage the fact that the target envirenment is known beforehand. So it's possible to pick ceratain colors of the background objects. Then we convert the rgb image to hsv color space and segment the image based on above picked colors.

Find out suitable segments to keep a pixel value -> illuminance level mapping.

Using the segmented and filtered image, manually picked a regions of interest to calculate the pixel values.

Collect illuminance level(lux value)+images for period of time for above found out patches.

At this phase placed lux meters on the previosly picked regions of interest and collect images from the CCTV camera.

Analize the relationship between the lux values and pixel values.

Here calculate the pixel values of captured images and compare them against the collected lux values.

Train a model using pixel values annotated with lux values to get lux value for new pixel values

Finally build a model using lux+pixel values collected in previous stages to get the lux values for new pixel values.