MCPcopy Create free account
hub / github.com/ARM-software/armnn / GetFrameSourceAndSink

Function GetFrameSourceAndSink

samples/ObjectDetection/src/Main.cpp:91–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91std::tuple<std::unique_ptr<common::IFrameReader<cv::Mat>>,
92 std::unique_ptr<common::IFrameOutput<cv::Mat>>>
93 GetFrameSourceAndSink(const std::map<std::string, std::string>& options) {
94
95 std::unique_ptr<common::IFrameReader<cv::Mat>> readerPtr;
96
97 std::unique_ptr<common::CvVideoFrameReader> reader = std::make_unique<common::CvVideoFrameReader>();
98 reader->Init(GetSpecifiedOption(options, VIDEO_FILE_PATH));
99
100 auto enc = reader->GetSourceEncodingInt();
101 auto fps = reader->GetSourceFps();
102 auto w = reader->GetSourceWidth();
103 auto h = reader->GetSourceHeight();
104 if (!reader->ConvertToRGB())
105 {
106 readerPtr = std::move(std::make_unique<common::CvVideoFrameReaderRgbWrapper>(std::move(reader)));
107 }
108 else
109 {
110 readerPtr = std::move(reader);
111 }
112
113 if(CheckOptionSpecified(options, OUTPUT_VIDEO_FILE_PATH))
114 {
115 std::string outputVideo = GetSpecifiedOption(options, OUTPUT_VIDEO_FILE_PATH);
116 auto writer = std::make_unique<common::CvVideoFileWriter>();
117 writer->Init(outputVideo, enc, fps, w, h);
118
119 return std::make_tuple<>(std::move(readerPtr), std::move(writer));
120 }
121 else
122 {
123 auto writer = std::make_unique<common::CvWindowOutput>();
124 writer->Init("Processed Video");
125 return std::make_tuple<>(std::move(readerPtr), std::move(writer));
126 }
127}
128
129int main(int argc, char *argv[])
130{

Callers 1

mainFunction · 0.85

Calls 8

GetSpecifiedOptionFunction · 0.85
CheckOptionSpecifiedFunction · 0.85
GetSourceEncodingIntMethod · 0.80
GetSourceFpsMethod · 0.80
GetSourceWidthMethod · 0.80
GetSourceHeightMethod · 0.80
ConvertToRGBMethod · 0.80
InitMethod · 0.45

Tested by

no test coverage detected