Skip to content

Type stubs: Optional parameters incorrectly marked as not-None in cv2.calcHist and cv2.resize #23779

@Avasam

Description

@Avasam

System Information

OpenCV python: opencv_python_headless-4.7.0+772599a-cp37-abi3-win_amd64.whl
Operating System / Platform: 10.0.19045 Build 19045
Python version: 3.9.13

Detailed description

cv2.calcHist: the mask parameter should accept None
cv2.resize: the dsize parameter should accept None

Steps to reproduce

import cv2

image = cv2.imread("some_path", cv2.IMREAD_UNCHANGED)

# Argument of type "None" cannot be assigned to parameter "dsize" of type "Size" in function "resize"
#  Type "None" cannot be assigned to type "Size"PylancereportGeneralTypeIssues
cv2.resize(image, dsize=None)

# Argument of type "None" cannot be assigned to parameter "mask" of type "UMat" in function "calcHist"
#  Type "None" cannot be assigned to type "UMat"PylancereportGeneralTypeIssues
cv2.calcHist([image], [0, 1, 2], None, [8, 8, 8], [0, 256, 0, 256, 0, 256])

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions