Goal
In this tutorial you will learn how to:
Theory
Code
This tutorial code's is shown lines below. You can also download it from here
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;
int thresh = 100;
int max_thresh = 255;
void thresh_callback(int, void* );
int main(
int,
char** argv )
{
const char* source_window = "Source";
createTrackbar(
" Threshold:",
"Source", &thresh, max_thresh, thresh_callback );
thresh_callback( 0, 0 );
return(0);
}
void thresh_callback(int, void* )
{
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
vector<vector<Point> >hull( contours.size() );
for( size_t i = 0; i < contours.size(); i++ )
for( size_t i = 0; i< contours.size(); i++ )
{
Scalar color =
Scalar( rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255) );
}
imshow(
"Hull demo", drawing );
}
Explanation
Result
Here it is:
Original
Result