samples/cpp/create_mask.cpp
Примеры с cv2.imshow требуют сборки OpenCV с GUI. В ноутбуке с headless-версией используйте вывод изображений через Matplotlib.
Loading...
Searching...
No Matches
samples/cpp/create_mask.cpp
This program demonstrates using mouse events and how to make and use a mask image (black and white) .
/*
* create_mask.cpp
*
* Author:
* Siddharth Kherada <siddharthkherada27[at]gmail[dot]com>
*
* This tutorial demonstrates how to make mask image (black and white).
* The program takes as input a source image and outputs its corresponding
* mask image.
*/
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace std;
using namespace cv;
Mat src, img1, mask, final;
Point ;
<> ;
= ;
= ;
= ;
(, , , , *);
( , , , , *)
{
( == && !)
{
( == )
{
( == )
= .();
= (, );
(, , , (, , ), -, , );
.();
++;
= ;
( > )
(,[-], , (, , ), , , );
(, );
}
}
( == && )
{
(, );
= ;
}
( == )
{
= ;
= .();
( != )
{
( , , , (,,), , , );
}
(, );
}
( == )
{
= ;
= ::(.(), );
= ::(.(), );
(, , (, , ), , );
(, , , );
(, );
(, );
(, );
}
( == )
{
.();
= ;
= ;
= ;
(, );
}
}
( , **)
{
(, , );
.();
.();
<<
;
= .<>();
= (::());
(.())
{
(, .());
;
}
(, );
(, , );
(, );
();
;
}