1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
class Blending
{
public:
Blending()
{
}
void Blend(int, void*);
double alpha, beta;
int key;
int minimumvalue;
};
----------------cpp------------------------
int maximumvalue = 100;
int minimumvalue;
void Blending:: Blend(int, void*)
{
alpha = (double)minimumvalue/ 100;
addWeighted(img,alpha,img2, 1.0 - alpha, 0, des);
imshow("Blendimage", des);
}
int main()
{
Blending bl;
bl.Blend(minimumvalue, 0);
createTrackbar("Blend", "Blendimage", &minimumvalue,maximumvalue,bl.Blend);
waitKey(0);
imshow("Blendimage", des),waitKey(0);
return 0;
}
| |