Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to crop the detetctions? #40

Open
hasantha-nirmal opened this issue Feb 5, 2021 · 2 comments
Open

How to crop the detetctions? #40

hasantha-nirmal opened this issue Feb 5, 2021 · 2 comments

Comments

@hasantha-nirmal
Copy link

How to save the detections of each frame? For an example all the frames generated by one tracker object?

@TibRib
Copy link

TibRib commented May 18, 2021

Hello, I was passing by and I saw your comment. In order to crop a detected object (to then save it), what you can do is :

  1. get the bounding box :
    bbox = track.to_tlbr()
  2. Get the cropped picture :
    cropped_picture = img[ (int(bbox[1])):(int(bbox[3])), (int(bbox[0])):(int(bbox[2])) ]
  3. Save it:
    cv2.imwrite('result.jpg', cropped_picture)
@hasantha-nirmal
Copy link
Author

Hello, I was passing by and I saw your comment. In order to crop a detected object (to then save it), what you can do is :

  1. get the bounding box :

bbox = track.to_tlbr()

  1. Get the cropped picture :

cropped_picture = img[ (int(bbox[1])):(int(bbox[3])), (int(bbox[0])):(int(bbox[2])) ]

  1. Save it:

cv2.imwrite('result.jpg', cropped_picture)

Thank you very much, really appreciate it.🙏🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants