Skip to content

python : numpy > 2.0 no more has 'ptp' member #27131

@berak

Description

@berak

System Information

os: win11
opencv: 4.11.0
python: 3.13
numpy: 2.2.4

Detailed description

running samples/python/mosse.py:

File "D:\p\opencv-4.x\samples\python\mosse.py", line 110, in state_vis

  kernel = np.uint8( (f-f.min()) / f.ptp()*255 )

AttributeError: ptp was removed from the ndarray class in NumPy 2.0. Use np.ptp(arr, ...) instead.

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

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions