Skip to content

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