face_video_segment  0.8
Adaptation of The Video Segmentation Project for face segmentation.
video_writer_unit2.h
1 // Copyright (c) 2010-2014, The Video Segmentation Project
2 // All rights reserved.
3 
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name of the The Video Segmentation Project nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 //
27 // ---
28 
29 #ifndef FACE_VIDEO_SEGMENT_VIDEO_WRITER_UNIT_2_H__
30 #define FACE_VIDEO_SEGMENT_VIDEO_WRITER_UNIT_2_H__
31 
32 #include "base/base.h"
33 #include "video_framework/video_unit.h"
34 
35 #include <opencv2/videoio.hpp>
36 
37 namespace segmentation {
38 
40  std::string video_stream_name = "VideoStream";
41  std::string segment_stream_name = "SegmentationStream";
42  std::string landmarks_model_file = "";
43  float output_scale = 1.0f;
44  };
45 
48  class VideoWriterUnit2 : public video_framework::VideoUnit {
49  public:
50  public:
52  const std::string& video_file);
54 
55  VideoWriterUnit2(const VideoWriterUnit2&) = delete;
56  VideoWriterUnit2& operator=(const VideoWriterUnit2&) = delete;
57 
58  virtual bool OpenStreams(video_framework::StreamSet* set);
59  virtual void ProcessFrame(video_framework::FrameSetPtr input, std::list<video_framework::FrameSetPtr>* output);
60  virtual bool PostProcess(std::list<video_framework::FrameSetPtr>* append);
61 
62  private:
63  VideoWriter2Options options_;
64  std::string video_file_;
65 
66  int video_stream_idx_;
67 
68  cv::VideoWriter writer_;
69  };
70 
71 } // namespace segmentation
72 
73 #endif // FACE_VIDEO_SEGMENT_VIDEO_WRITER_UNIT_2_H__
Definition: landmarks_unit.cpp:49
Definition: video_writer_unit2.h:39
Writes video frames from stream to file.
Definition: video_writer_unit2.h:48