Bonjour à tous
Je galère depuis des jours pour tenter d'utiliser de fonction accumulateWeighted mais avec un alpha
c'est à dire je souhaite ajouter au background, l'image modifiée sur son alpha pour ajouter petit à petit disons
Mon code:
en fait je ne sais pas comment faire pour que le gray que j'ajoute soit dans un alpha < 1.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 // convert to gray-level image cv::cvtColor(frame, gray, CV_BGR2GRAY); // initialize background to 1st frame if (background.empty()) { gray.convertTo(background, CV_32F); } // convert background to 8U background.convertTo(backImage,CV_8U); // compute difference between current image and background cv::absdiff(backImage,gray,foreground); // apply threshold to foreground image cv::threshold(foreground,output,detect_threshold0,remplacement0,cv::THRESH_BINARY_INV); // accumulate background cv::accumulateWeighted(gray, background, (double)(learning_rate0 + 1.0)/100.0, output); backImage.copyTo(output);
Déjà est-ce possible?
Disons que sinon, j'aoute trop d'information et cela me génère une image saturée (je suis en noir et blanc)
quelqu'un peut m'aider à savoir comment gérer l'alpha (transparence) sur opencv?
merci bien à tous
Partager