OpenShot Library | libopenshot  1.0.0
ClipProcessingJobs.h
Go to the documentation of this file.
1 
10 // Copyright (c) 2008-2019 OpenShot Studios, LLC
11 //
12 // SPDX-License-Identifier: LGPL-3.0-or-later
13 
14 #ifdef USE_OPENCV
15  #define int64 opencv_broken_int
16  #define uint64 opencv_broken_uint
17  #include <opencv2/opencv.hpp>
18  #include <opencv2/core.hpp>
19  #undef uint64
20  #undef int64
21 
22  #include "CVStabilization.h"
23  #include "CVTracker.h"
24  #include "CVObjectDetection.h"
25  #include "CVObjectMask.h"
26 #endif
27 
28 #include <thread>
29 #include "ProcessingController.h"
30 #include "Clip.h"
31 
32 namespace openshot {
33 
34 // Constructor responsible to choose processing type and apply to clip
36  private:
37  std::string processInfoJson;
38  std::string processingType;
39 
40  bool processingDone = false;
41  bool stopProcessing = false;
42  uint processingProgress = 0;
43 
44  std::thread t;
45 
47  ProcessingController processingController;
48 
49  // Apply object tracking to clip
50  void trackClip(Clip& clip, ProcessingController& controller);
51  // Apply stabilization to clip
52  void stabilizeClip(Clip& clip, ProcessingController& controller);
53  // Apply object detection to clip
54  void detectObjectsClip(Clip& clip, ProcessingController& controller);
55  // Apply object segmentation mask to clip
56  void maskObjectClip(Clip& clip, ProcessingController& controller);
57 
58 
59  public:
60  // Constructor
61  ClipProcessingJobs(std::string processingType, std::string processInfoJson);
62  static std::string ValidateONNXModel(std::string modelPath);
63  static std::shared_ptr<Frame> PreviewObjectMask(std::string processInfoJson, std::shared_ptr<Frame> frame);
64  // Process clip accordingly to processingType
65  void processClip(Clip& clip, std::string json);
66 
67  // Thread related variables and methods
68  int GetProgress();
69  bool IsDone();
70  void CancelProcessing();
71  bool GetError();
72  std::string GetErrorMessage();
73 };
74 
75 } // namespace openshot
Header file for CVObjectDetection class.
Header file for CVObjectMask class.
Header file for CVStabilization class.
Track an object selected by the user.
Header file for Clip class.
This is a message class for thread safe comunication between ClipProcessingJobs and OpenCV classes.
void processClip(Clip &clip, std::string json)
static std::shared_ptr< Frame > PreviewObjectMask(std::string processInfoJson, std::shared_ptr< Frame > frame)
ClipProcessingJobs(std::string processingType, std::string processInfoJson)
static std::string ValidateONNXModel(std::string modelPath)
This class represents a clip (used to arrange readers on the timeline)
Definition: Clip.h:89
This namespace is the default namespace for all code in the openshot library.
Definition: AnimatedCurve.h:24