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

cv2.imread()读取的图文维度存在随机性 #1049

Open
4 tasks
XFNxiaofuni opened this issue Nov 25, 2024 · 0 comments
Open
4 tasks

cv2.imread()读取的图文维度存在随机性 #1049

XFNxiaofuni opened this issue Nov 25, 2024 · 0 comments

Comments

@XFNxiaofuni
Copy link

XFNxiaofuni commented Nov 25, 2024

Expected behaviour

Write here how did you expect the library to function.

Actual behaviour

(160, 256)
(160, 256, 1)
(160, 256)
(160, 256, 1)

(160, 256)
(160, 256, 1)
(160, 256, 1)
(160, 256, 1)

多次运行,会不断改变,我不太明白是什么原因。我希望能保持单通道的1这个参数,在我的结果里。

Steps to reproduce

fundus_img = cv2.imread('/root/autodl-fs/Imag_split/processed_data/1-1 dose/0_0.jpg', cv2.IMREAD_GRAYSCALE)
print(fundus_img.shape)
name = np.expand_dims(fundus_img, axis=2)
print(name.shape)
nameimg = name.astype(np.float32)
nameimg2 = img_train_transforms(nameimg)
print(nameimg2.shape)
if len(nameimg2.shape) != 3:
nameimg2 = np.expand_dims(nameimg2, axis=2)

print(nameimg2.shape)

  • operating system
    linux
  • architecture (e.g. x86)
    x86
  • opencv-python version:opencv-python 4.10.0.84
Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python
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

No branches or pull requests

1 participant