I change the extensions of all .png images to .jpeg inside a folder and also renamed them into using this code,
# Define directories
INPUT = 'input dir'
OUTPUT = 'output dir'
for count, filename in enumerate(os.listdir(INPUT)):
dst = "OTHERS_IMG_" + str(count) + ".jpeg"
src = INPUT + filename
dst = OUTPUT + dst
os.rename(src, dst)
I successfully got images in right format like this inside a separate folder like this. NORMAL_IMG_0 NORMAL_IMG_1 NORMAL_IMG_2 . . .
But after augmenting and reading the images using OpenCV and imgaug I got empty arrays like this using this code,
image = cv2.imread('NORMAL/NORMAL_IMG_0.jpeg')
rotate = iaa.Affine(rotate=(-25, 25))
image_rotated = rotate.augment_images([image])[0]
cv2.imwrite("image.jpeg", image_rotated)
I got this,
[[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]
...
[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]]
While the original image is like this,
[[[ 55 33 21]
[ 47 25 13]
[ 52 30 18]
...
[ 27 18 28]
[ 29 20 30]
[ 29 21 28]]
[[ 81 58 43]
[ 77 54 39]
[ 82 59 44]
...
[ 25 18 25]
[ 26 19 26]
[ 26 19 26]]
[[100 74 57]
[100 74 57]
[101 75 58]
...
[ 24 18 23]
[ 24 18 23]
[ 24 18 23]]
...
[[ 32 29 31]
[ 30 25 27]
[ 31 25 26]
...
[ 61 37 31]
[ 61 37 31]
[ 61 37 31]]
[[ 30 27 29]
[ 29 26 28]
[ 30 25 27]
...
[ 49 28 26]
[ 48 27 25]
[ 48 27 25]]
[[ 28 27 29]
[ 29 26 28]
[ 28 25 27]
...
[ 40 22 21]
[ 39 21 20]
[ 39 21 20]]]
Can anyone help me why this is happening? I also want to augment all my images. I didn't notice this until I tried to augment my images which are in JPEG format inside a directory.