0

I want to ask how to append multiple image into a ndarray

my image's shape is (300,300,3) and I use opencv read into a ndarray

which shape if (300,300,3) but when I append another img2 to my first img.

it's shape return (5400,),it is lool like be flatten but I just append.

it want to use like :

                      img[0] #is my first image
                      img[1] #is my second image

1 Answer 1

1

You would do this like how you would in regular python just convert it at the end

data = []
files = glob.glob ("*.jpg")
for myFile in files:
    image = cv2.imread (myFile)
    data.append (image)

print('data shape:', np.array(data).shape)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.