Skip to content

Fix NumPy casting error in blur_blending_cv2 function #305

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sayedgamal99
Copy link

Description

This PR fixes a NumPy casting error in the blur_blending_cv2 function in the Face_Detection module. The error occurs when multiplying a mask (likely of type uint8) by 255.0, resulting in a casting error:

numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'multiply' output from dtype('float64') to dtype('uint8') with casting rule 'same_kind'

Changes

  • Modified the blur_blending_cv2 function to convert the mask to float64 before multiplication
  • This allows the multiplication to happen without overflow issues
  • The result is then properly scaled back for further processing

Testing

The fix has been tested on various images and resolves the casting error that was occurring

Follow Up

Also Fixed the same function in the HR file simply.

@sayedgamal99
Copy link
Author

@microsoft-github-policy-service agree

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

Successfully merging this pull request may close these issues.

1 participant