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

video cropping #38

Closed
kingkw1 opened this issue Jan 8, 2022 · 1 comment
Closed

video cropping #38

kingkw1 opened this issue Jan 8, 2022 · 1 comment

Comments

@kingkw1
Copy link

kingkw1 commented Jan 8, 2022

I've encountered issues with using the detection_box argument in the Video.analyze() function. With a little digging, I've found that self._crop(frame, detection_box) results in the following error:

{TypeError}_crop() missing 1 required positional argument: 'detection_box'

This problem stems from the combination of a @staticmethod decorator and "self" as an input argument to the _crop() function, and can be resolved by removing the "self" input argument from the _crop function definition.


    @staticmethod
    def _crop(self, frame, detection_box):

For the time being I've gotten around this with a monkey patch:

from fer import Video
Video._crop = lambda self, frame, _detection_box: frame[
                                                  _detection_box.get("y_min"): _detection_box.get("y_max"),
                                                  _detection_box.get("x_min"): _detection_box.get("x_max")]
@JustinShenk
Copy link
Owner

Thank you for opening this! This has been fixed in v22.0.1.

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

No branches or pull requests

2 participants