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 bwFrame(height, width, CV_8UC1);
103 cv::Mat segmentationMap(height, width, CV_8UC1);
104 bool firstFrame =
true;
106 while (decoder.read(frame)) {
107 cv::cvtColor(frame, bwFrame, CV_RGB2GRAY);
111 vibe =
new ViBe(height, width, bwFrame.data);
116 vibe->segmentation(bwFrame.data, segmentationMap.data);
117 vibe->update(bwFrame.data, segmentationMap.data);
120 medianBlur(segmentationMap, segmentationMap, 3);
122 imshow(
"Input video", bwFrame);
123 imshow(
"Segmentation by ViBe", segmentationMap);
130 cvDestroyAllWindows();
Distance function for computing the Euclidean distance between the pixel and samples of the model...
Interface for the libvibe++ library.