Mean of a frame always change?

asked 2020-02-01 09:11:48 -0500

hernancrespo gravatar image

Hi everyone, i read frames from webcam and print mean of 3-channels of frame.

import cv2
import numpy as np
capture = cv2.VideoCapture(0,cv2.CAP_DSHOW)
while (True):
    ret, frame =
    cv2.imshow('video', frame)
    a=np.mean(frame, axis=(0, 1))
    if cv2.waitKey(30) == 27:

everything is consant (lightness,camera etc.) But values are always changing. What is the reason of that?

edit retag flag offensive close merge delete


What do you mean (changing)? 100% 10% 0.01%? What is light source?

LBerger gravatar imageLBerger ( 2020-02-01 09:54:11 -0500 )edit

It is around %0.1. There is no any light source

hernancrespo gravatar imagehernancrespo ( 2020-02-01 12:05:05 -0500 )edit

" There is no any light source" it's a black image so...

0.1% it is possible. Instead cv2.imshow('video', frame) try :

dst = cv.cvtColor(frame,cv.COLOR_RGBA2GRAY)
dst = dst & 31
cv.imshow('video', dst)

Normally you will see image noise

LBerger gravatar imageLBerger ( 2020-02-01 12:19:28 -0500 )edit

I mean, there is just day light not any external source.

dst = cv.cvtColor(frame,cv.COLOR_RGBA2GRAY)
dst = dst & 31
cv.imshow('video', dst)

i tried it is better but i think it is impossible to reduce that to zero, isn't it?

hernancrespo gravatar imagehernancrespo ( 2020-02-01 12:36:58 -0500 )edit

Cool your camera at -200°C no noise!

or if your image is not moved then you can mean succesive image

LBerger gravatar imageLBerger ( 2020-02-01 12:41:03 -0500 )edit

0.1 % is not "change" it is "variation of input" within "tolerances"

mvuori gravatar imagemvuori ( 2020-02-01 13:55:28 -0500 )edit