Skip to content

Commit 4f05d4c

Browse files
committed
Merge branch 'master' into hf-merge/video-rotation
2 parents c166a1c + 9645444 commit 4f05d4c

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

detection/api/include/MPFVideoCapture.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ namespace MPF { namespace COMPONENT {
169169
const cv::VideoCapture &cvVideoCapture);
170170

171171
static SeekStrategy::CPtr GetSeekStrategy(const MPFVideoJob &job);
172+
173+
static cv::VideoCapture GetCvVideoCapture(const std::string &videoPath);
172174
};
173175

174176

detection/api/src/MPFImageReader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ namespace MPF { namespace COMPONENT {
3737

3838
MPFImageReader::MPFImageReader(const MPFImageJob &job) {
3939
cv::VideoCapture video_cap(job.data_uri);
40+
video_cap.set(cv::CAP_PROP_ORIENTATION_AUTO, 0);
4041
if (!video_cap.isOpened()) {
4142
throw MPFDetectionException(MPFDetectionError::MPF_COULD_NOT_OPEN_MEDIA,
4243
"Failed to open \"" + job.data_uri + "\".");

detection/api/src/MPFVideoCapture.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
* limitations under the License. *
2525
******************************************************************************/
2626

27-
#include <algorithm>
2827
#include <iostream>
2928
#include <map>
3029
#include <stdexcept>
@@ -49,7 +48,7 @@ namespace MPF { namespace COMPONENT {
4948
MPFVideoCapture::MPFVideoCapture(const MPFVideoJob &videoJob, bool enableFrameTransformers,
5049
bool enableFrameFiltering)
5150
: videoPath_(videoJob.data_uri)
52-
, cvVideoCapture_(videoJob.data_uri)
51+
, cvVideoCapture_(GetCvVideoCapture(videoJob.data_uri))
5352
, frameFilter_(GetFrameFilter(enableFrameFiltering, videoJob, cvVideoCapture_))
5453
, frameTransformer_(GetFrameTransformer(enableFrameTransformers, videoJob))
5554
, seekStrategy_(GetSeekStrategy(videoJob)) {
@@ -68,6 +67,13 @@ namespace MPF { namespace COMPONENT {
6867
}
6968

7069

70+
cv::VideoCapture MPFVideoCapture::GetCvVideoCapture(const std::string &videoPath) {
71+
cv::VideoCapture videoCapture(videoPath);
72+
videoCapture.set(cv::CAP_PROP_ORIENTATION_AUTO, 0);
73+
return videoCapture;
74+
}
75+
76+
7177
IFrameTransformer::Ptr MPFVideoCapture::GetFrameTransformer(bool enableFrameTransformers,
7278
const MPFVideoJob &job) const {
7379
if (enableFrameTransformers) {

0 commit comments

Comments
 (0)