Ask Your Question
0

How to crop human detected frame from live video.

asked 2020-03-25 16:06:33 -0600

salmaUCP gravatar image

updated 2020-11-30 03:25:00 -0600

I have already done human detection but don't know how to crop detected frames of video and save it in video format... here is the code link which i followed https://github.com/ambakick/Person-De...

Plz suggest me !!! Thanks

edit retag flag offensive close merge delete

Comments

1

Surprisily, when you google "opencv write video", you'll find lots of information

mvuori gravatar imagemvuori ( 2020-03-26 02:15:14 -0600 )edit

Thanks for your reply & I will be definitely search your suggestion on google but i want to crop human detected frames as i already mention above and provide link also( which i followed) On different websites(like stack overflow , git hub, pyImageSearch) they all are talking about the images not video & they all crop image not video frames... I am beginner in Computer vision and i don't have any idea about it... Please help me!!! Thanks!

salmaUCP gravatar imagesalmaUCP ( 2020-03-26 04:21:57 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-03-26 05:03:26 -0600

berak gravatar image

the main problem here is, that a writing video file needs a constant frame size, while size of your crops will vary due to person size & distance. so try following approach:

Size dstSize(64,128); // dst video size
VideoWriter vid("my.avi", VideoWriter::fourcc('M','J','P','G'), 10, dstSize); 

// later, in a loop, detect humans
Rect rec = ...
Mat cropped = frame(rec);
Mat dst;
resize(cropped, dst, dstSize);
vid.write(dst);
edit flag offensive delete link more

Comments

thank you so much @berak

salmaUCP gravatar imagesalmaUCP ( 2020-03-26 05:20:20 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-03-25 16:06:33 -0600

Seen: 1,511 times

Last updated: Mar 26 '20