Skip to content

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

Open
@XFNxiaofuni

Description

@XFNxiaofuni

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

      Participants

      @XFNxiaofuni

      Issue actions

        cv2.imread()读取的图文维度存在随机性 · Issue #1049 · opencv/opencv-python