Caffe2 - C++ API
A deep learning, cross platform ML framework
video_io.h
1 
17 #ifndef CAFFE2_VIDEO_VIDEO_IO_H_
18 #define CAFFE2_VIDEO_VIDEO_IO_H_
19 
20 #include <caffe/proto/caffe.pb.h>
21 #include <caffe2/video/optical_flow.h>
22 #include <caffe2/video/video_decoder.h>
23 #include <opencv2/opencv.hpp>
24 #include <random>
25 
26 #include <istream>
27 #include <ostream>
28 
29 namespace caffe2 {
30 
31 void ClipTransformRGB(
32  const unsigned char* buffer_rgb,
33  const int multi_crop_count,
34  const int crop_height,
35  const int crop_width,
36  const int length_rgb,
37  const int channels_rgb,
38  const int sampling_rate_rgb,
39  const int height,
40  const int width,
41  const int h_off,
42  const int w_off,
43  const int* multi_crop_h_off,
44  const int* multi_crop_w_off,
45  const bool mirror_me,
46  const bool color_jitter,
47  const float saturation,
48  const float brightness,
49  const float contrast,
50  const bool color_lighting,
51  const float color_lighting_std,
52  const std::vector<std::vector<float>>& color_lighting_eigvecs,
53  const std::vector<float>& color_lighting_eigvals,
54  const std::vector<float>& mean_rgb,
55  const std::vector<float>& inv_std_rgb,
56  std::mt19937* randgen,
57  float* transformed_clip);
58 
59 void ClipTransformOpticalFlow(
60  const unsigned char* buffer_rgb,
61  const int crop_height,
62  const int crop_width,
63  const int length_of,
64  const int channels_of,
65  const int sampling_rate_of,
66  const int height,
67  const int width,
68  const cv::Rect& rect,
69  const int channels_rgb,
70  const bool mirror_me,
71  const int flow_alg_type,
72  const int flow_data_type,
73  const int frame_gap_of,
74  const bool do_flow_aggregation,
75  const std::vector<float>& mean_of,
76  const std::vector<float>& inv_std_of,
77  float* transformed_clip);
78 
79 void FreeDecodedData(std::vector<std::unique_ptr<DecodedFrame>>& sampledFrames);
80 
81 bool DecodeMultipleClipsFromVideo(
82  const char* video_buffer,
83  const std::string& video_filename,
84  const int encoded_size,
85  const Params& params,
86  const int start_frm,
87  const int clip_per_video,
88  const bool use_local_file,
89  int& height,
90  int& width,
91  std::vector<unsigned char*>& buffer_rgb);
92 
93 } // namespace caffe2
94 
95 #endif // CAFFE2_VIDEO_VIDEO_IO_H_
Copyright (c) 2016-present, Facebook, Inc.