mirror of
https://github.com/zebrajr/opencv.git
synced 2026-01-15 12:15:17 +00:00
Add Java and Python code for trackbar tutorial.
This commit is contained in:
@@ -6,9 +6,10 @@
|
||||
|
||||
#include "opencv2/imgcodecs.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace cv;
|
||||
using std::cout;
|
||||
|
||||
/** Global Variables */
|
||||
const int alpha_slider_max = 100;
|
||||
@@ -29,11 +30,8 @@ Mat dst;
|
||||
static void on_trackbar( int, void* )
|
||||
{
|
||||
alpha = (double) alpha_slider/alpha_slider_max ;
|
||||
|
||||
beta = ( 1.0 - alpha );
|
||||
|
||||
addWeighted( src1, alpha, src2, beta, 0.0, dst);
|
||||
|
||||
imshow( "Linear Blend", dst );
|
||||
}
|
||||
//![on_trackbar]
|
||||
@@ -50,8 +48,8 @@ int main( void )
|
||||
src2 = imread("../data/WindowsLogo.jpg");
|
||||
//![load]
|
||||
|
||||
if( src1.empty() ) { printf("Error loading src1 \n"); return -1; }
|
||||
if( src2.empty() ) { printf("Error loading src2 \n"); return -1; }
|
||||
if( src1.empty() ) { cout << "Error loading src1 \n"; return -1; }
|
||||
if( src2.empty() ) { cout << "Error loading src2 \n"; return -1; }
|
||||
|
||||
/// Initialize values
|
||||
alpha_slider = 0;
|
||||
|
||||
Reference in New Issue
Block a user