

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to add Track-bar in OpenCV using C++?
Track-bars are controllable bars which are used to control various parameters in OpenCV. Using track-bars, we can make it easier and change the parameters graphically. Track-bar removes this limitation and enables to create of dynamic effects using OpenCV.
The following program demonstrates how to add track-bars in OpenCV using C++.
Example
#include<iostream> #include<opencv2/highgui/highgui.hpp> using namespace cv; using namespace std; int main() { Mat original;//Declaring a matrix// original = imread("sky.jpg");//loading the image in the matrix// namedWindow("Slider");//Declaring window to show the image// int light = 50;//starting value of the trackbar// createTrackbar("Brightness", "Slider", &light, 100);//creating a trackbar// int contrast = 50;//starting value of the trackbar// createTrackbar("Contrast", "Slider", &contrast, 100);//creating a trackbar// while (true) { Mat edit;//declaring a matrix// int Brightness = light - 50;//interaction with trackbar// double Contrast = contrast / 50.0;//interaction with trackbar// original.convertTo(edit, -1, Contrast, Brightness);//implement the effect of change of trackbar// waitKey(50); } return(0); }
Output
- Related Questions & Answers
- How to track the color in OpenCV using C++?
- How to track the eye in OpenCV using C++?
- How to track the face in real-time in OpenCV using C++?
- How to track the position of the face in OpenCV using C++?
- How to detect and track the motion of eyeball in OpenCV using C++?
- How to add noise to an image using Java OpenCV library?
- How to add text to an image using Java OpenCV library?
- How to add borders to an image using Java OpenCV library?
- How to add a legend on Seaborn facetgrid bar plot using Matplotlib?
- How to add scroll bar to an image in JavaFX?
- How to add group labels for bar charts in Matplotlib?
- How to change the size of an image and add a border in OpenCV using C++?
- How to add link dividers in a Navigation Bar with CSS
- How to track the order of insertion using Java collections?
- How to draw polylines in OpenCV using Java?
Advertisements