Ask Your Question
1

How to ignore the first and the last 10% of the videoCaption ?

asked 2018-07-04 09:37:08 -0600

azdoud.y gravatar image

updated 2019-06-19 11:27:03 -0600

Hello,

I've a video which starts by black stream and ends with black stream I want to ignore these parts while reading this capture

Mat frameReference;
double lengthAD = captRefrnc.get(CV_CAP_PROP_FRAME_COUNT);
int partBegin = 0.1*length;
captRefrnc.set(CV_CAP_PROP_POS_FRAMES,partBegin );
while(1){
    captRefrnc >> frameReference;
    if (frameReference.empty()){
        cout << " <<< AD sequence ended!  >>> " << sourceReference <<endl;
        break;
    }

but I can ignore the 10% part but how to ignore the 10% part at the end

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
3

answered 2018-07-04 09:59:36 -0600

LBerger gravatar image

updated 2018-07-04 10:00:24 -0600

just use for :

int partBegin = 0.1*length;
captRefrnc.set(CV_CAP_PROP_POS_FRAMES,partBegin );
for (int i=partBegin;i<static_cast<int>(length*0.9);i++)
{
    captRefrnc >> frameReference;
    if (frameReference.empty()){
        cout << " <<< AD sequence ended!  >>> " <<endl;
        break;
    }
}
edit flag offensive delete link more
3

answered 2018-07-04 10:05:34 -0600

maybe like this

Mat frameReference;
double lengthAD = captRefrnc.get(CV_CAP_PROP_FRAME_COUNT);
int partBegin = 0.1*length;
captRefrnc.set(CV_CAP_PROP_POS_FRAMES,partBegin );
while(1){
    captRefrnc >> frameReference;
    partBegin++;

    if (partBegin > 0.9*length){
         break;
    }
    if (frameReference.empty()){
        cout << " <<< AD sequence ended!  >>> " << sourceReference <<endl;
        break;
    }
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-07-04 09:37:08 -0600

Seen: 312 times

Last updated: Jul 04 '18