You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
OpenCV: Adapt to API changes in OpenCV 4.5.2+ (#639)
* CVTracker: Handle API changes in OpenCV The former cv::Tracker API we've been using is now cv::legacy::Tracker, starting in OpenCV 4.5.1. * CVTracker: Move some includes, add std:: prefixes * Move ClipProcessingJobs into openshot NS * OpenCV 4.5.1 message and auto-disabling * Add fstream includes, explicit std:: namespace Work around a MacOS bug where bare fstream resolves to the wrong class. Co-authored-by: Brenno <brenno.caldato@gmail.com> Co-authored-by: Brenno A. C. Caldato <BrennoCaldato@users.noreply.github.com>
This commit is contained in:
@@ -28,6 +28,10 @@
|
||||
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
#include "CVStabilization.h"
|
||||
#include <google/protobuf/util/time_util.h>
|
||||
|
||||
@@ -276,6 +280,8 @@ std::map<size_t,TransformParam> CVStabilization::GenNewCamPosition(std::map <siz
|
||||
|
||||
// Save stabilization data to protobuf file
|
||||
bool CVStabilization::SaveStabilizedData(){
|
||||
using std::ios;
|
||||
|
||||
// Create stabilization message
|
||||
pb_stabilize::Stabilization stabilizationMessage;
|
||||
|
||||
@@ -292,7 +298,7 @@ bool CVStabilization::SaveStabilizedData(){
|
||||
// Write the new message to disk.
|
||||
std::fstream output(protobuf_data_path, ios::out | ios::trunc | ios::binary);
|
||||
if (!stabilizationMessage.SerializeToOstream(&output)) {
|
||||
cerr << "Failed to write protobuf message." << endl;
|
||||
std::cerr << "Failed to write protobuf message." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -380,12 +386,13 @@ void CVStabilization::SetJsonValue(const Json::Value root) {
|
||||
|
||||
// Load protobuf data file
|
||||
bool CVStabilization::_LoadStabilizedData(){
|
||||
using std::ios;
|
||||
// Create stabilization message
|
||||
pb_stabilize::Stabilization stabilizationMessage;
|
||||
// Read the existing tracker message.
|
||||
fstream input(protobuf_data_path, ios::in | ios::binary);
|
||||
std::fstream input(protobuf_data_path, ios::in | ios::binary);
|
||||
if (!stabilizationMessage.ParseFromIstream(&input)) {
|
||||
cerr << "Failed to parse protobuf message." << endl;
|
||||
std::cerr << "Failed to parse protobuf message." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user