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

Updated FaceRec/app/main/Edit.py #86

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bhavya2021245
Copy link

Description

Improper Resource Management: The camera resource (cv2.VideoCapture(0)) is now properly initialized and released to prevent the camera from being locked after the application stops. Functions for initializing and releasing the camera are added to ensure correct handling.

Lack of Comprehensive Error Handling and Input Validation: Input validation is implemented for the form data, ensuring that invalid or malicious inputs are not processed. Error handling has been added for camera access, file operations, and HTTP requests to avoid crashes and provide meaningful feedback to the user.

Avoidance of Global Variables Leading to Potential Race Conditions: Global variables are replaced by Flask’s g object to store request-specific data. This refactoring prevents race conditions and ensures data integrity across concurrent requests.

Fixes # (issue 73)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Test A: Tested video feed functionality to ensure the camera resource is properly managed and released.
Test B: Validated input for the form on the /capture route with valid and invalid inputs, ensuring proper error handling.
Test C: Simulated concurrent requests to check for race conditions and verify data consistency when using the Flask g object.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

@Devasy23
Copy link
Owner

Author's GitHub stats

@Devasy23
Copy link
Owner

📊 Contributor Stats for @bhavya2021245:

  • Total PRs Merged: 18
    • Recent Contributions (last 10 PRs):
  • Lines Added: 43209
  • Lines Deleted: 5506
    Keep up the great work! 🚀

@Devasy23
Copy link
Owner

Hello @bhavya2021245 , I appreciate your efforts towards our project, we'll shortly review your PR It would be really helpful if you include screenshots of your changes.

@puwun please look into it

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

Successfully merging this pull request may close these issues.

some major improvements in FaceRec/app/main/Edit.py
3 participants