Skip to content

Fix cv2.imread Path compatibility in io.py#1396

Closed
jimmy-liu1021 wants to merge 1 commit into
MouseLand:mainfrom
jimmy-liu1021:fix-cv2-path-io
Closed

Fix cv2.imread Path compatibility in io.py#1396
jimmy-liu1021 wants to merge 1 commit into
MouseLand:mainfrom
jimmy-liu1021:fix-cv2-path-io

Conversation

@jimmy-liu1021

Copy link
Copy Markdown

Description

cv2.imread does not accept pathlib.Path objects, but cellpose.io
passes Path objects directly in some code paths, which raises:

TypeError: Can't convert object to 'str' for 'filename'

Fix

Convert path-like objects to string before calling cv2.imread and cv2.imwrite.

@mrariden

mrariden commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator

This doesn't seem to be true if you're using openCV after 2024: opencv/opencv#24773

@mrariden mrariden closed this Mar 5, 2026
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.

2 participants