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

Fix initialization checks in Mat classes to handle '0' values #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emilneander
Copy link

Fix for Mat Initialization with CvType Constants

Problem:

When using certain CvType constant with a value of 0 (CvType.CV_8U), the Mat class was not initializing correctly due to truthy/falsy checks in the constructor.

Solution:

Explicitly check for undefined values in the Mat class constructor to ensure that values like 0 are treated as valid.

Changes:

  • Updated checks in the Mat class constructor to explicitly check for undefined.
  • Ensured that all other related classes handle 0 values correctly.

Example:

The issue was evident when using the CvType constants:

export const CvType = {
    "CV_8U" : 0,
    // ... other constants ...
};

- Previously, the Mat classes conflated 0 with undefined or null due to truthy/falsy checks. This commit ensures that 0 is treated as a valid value by explicitly checking for undefined during initialization.
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