70 #include <opencv2/opencv.hpp> 75 #include <libvibe++/system/types.h> 81 int main(
int argc,
char** argv) {
83 cerr <<
"A video file must be given as an argument to the program!";
95 cv::VideoCapture decoder(argv[1]);
98 int32_t height = decoder.get(CV_CAP_PROP_FRAME_HEIGHT);
99 int32_t width = decoder.get(CV_CAP_PROP_FRAME_WIDTH);
102 cv::Mat segmentationMap(height, width, CV_8UC1);
103 bool firstFrame =
true;
105 while (decoder.read(frame)) {
108 vibe =
new ViBe(height, width, frame.data);
113 vibe->segmentation(frame.data, segmentationMap.data);
114 vibe->update(frame.data, segmentationMap.data);
117 medianBlur(segmentationMap, segmentationMap, 3);
119 imshow(
"Input video", frame);
120 imshow(
"Segmentation by ViBe", segmentationMap);
127 cvDestroyAllWindows();
Distance function for computing the Euclidean distance between the pixel and samples of the model...
Interface for the libvibe++ library.