Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Applying CLAHE reshapes image

I'm following this guide here to try out CLAHE in Python, so I have the following code:

import numpy as np
import cv2

img = cv2.imread('t1.JPG',0)
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
cl1 = clahe.apply(img)

cv2.imwrite('t1-clahe.JPG',cl1)

Before (t1.JPG): https://www.dropbox.com/s/m20spcyuf00oilr/t1.JPG?dl=0

After (t1-clahe.JPG): https://www.dropbox.com/s/zg7t6yq4wr7hwdd/t1-clahe2.JPG?dl=0

So, if you see the links provided, the image has been reshaped. There doesn't seem to be any indication in the guide that this should happen. Am I missing something here? I don't want to reshape the image.

Funny thing is that if I output the shape of the image then there seems to be no change. I get the following:

Before: (2448, 3264)
After: (2448, 3264)

But if you look at the after image, it has clearly been reshaped. I noticed another thing. This problem is only happening with images taken from my iPhone 5S. I tried other images and they did not have the same issue. I tried to find differences between the images that are being reshaped and ones that aren't. So, I noticed the following difference:

reshaped    : JPEG image data, EXIF standard 2.21
not reshaped: JPEG image data, JFIF standard 1.01

Any help with this problem would be greatly appreciated.

OpenCV version being used: 2.4.8

click to hide/show revision 2
No.2 Revision

updated 2016-01-09 03:23:56 -0500

berak gravatar image

Applying CLAHE reshapes image

I'm following this guide here to try out CLAHE in Python, so I have the following code:

import numpy as np
import cv2

img = cv2.imread('t1.JPG',0)
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
cl1 = clahe.apply(img)

cv2.imwrite('t1-clahe.JPG',cl1)

Before (t1.JPG): https://www.dropbox.com/s/m20spcyuf00oilr/t1.JPG?dl=0
image description

After (t1-clahe.JPG): https://www.dropbox.com/s/zg7t6yq4wr7hwdd/t1-clahe2.JPG?dl=0
image description

So, if you see the links provided, the image has been reshaped. There doesn't seem to be any indication in the guide that this should happen. Am I missing something here? I don't want to reshape the image.

Funny thing is that if I output the shape of the image then there seems to be no change. I get the following:

Before: (2448, 3264)
After: (2448, 3264)

But if you look at the after image, it has clearly been reshaped. I noticed another thing. This problem is only happening with images taken from my iPhone 5S. I tried other images and they did not have the same issue. I tried to find differences between the images that are being reshaped and ones that aren't. So, I noticed the following difference:

reshaped    : JPEG image data, EXIF standard 2.21
not reshaped: JPEG image data, JFIF standard 1.01

Any help with this problem would be greatly appreciated.

OpenCV version being used: 2.4.8

Applying CLAHE reshapes image

I'm following this guide here to try out CLAHE in Python, so I have the following code:

import numpy as np
import cv2

img = cv2.imread('t1.JPG',0)
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
cl1 = clahe.apply(img)

cv2.imwrite('t1-clahe.JPG',cl1)

Before (t1.JPG):
image descriptiont1.JPG

After (t1-clahe.JPG):
image descriptionimage description

So, if you see the links provided, the image has been reshaped. There doesn't seem to be any indication in the guide that this should happen. Am I missing something here? I don't want to reshape the image.

Funny thing is that if I output the shape of the image then there seems to be no change. I get the following:

Before: (2448, 3264)
After: (2448, 3264)

But if you look at the after image, it has clearly been reshaped. I noticed another thing. This problem is only happening with images taken from my iPhone 5S. I tried other images and they did not have the same issue. I tried to find differences between the images that are being reshaped and ones that aren't. So, I noticed the following difference:

reshaped    : JPEG image data, EXIF standard 2.21
not reshaped: JPEG image data, JFIF standard 1.01

Any help with this problem would be greatly appreciated.

OpenCV version being used: 2.4.8

Applying CLAHE reshapes imagecv::imread - Camera orientation problem

I'm following this guide here to try out CLAHE in Python, so I have the following code:

import numpy as np
import cv2

img = cv2.imread('t1.JPG',0)
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
cl1 = clahe.apply(img)

cv2.imwrite('t1-clahe.JPG',cl1)

Before (t1.JPG):
t1.JPG

After (t1-clahe.JPG):
image description

So, if you see the links provided, the image has been reshaped. There doesn't seem to be any indication in the guide that this should happen. Am I missing something here? I don't want to reshape the image.

Funny thing is that if I output the shape of the image then there seems to be no change. I get the following:

Before: (2448, 3264)
After: (2448, 3264)

But if you look at the after image, it has clearly been reshaped. I noticed another thing. This problem is only happening with images taken from my iPhone 5S. I tried other images and they did not have the same issue. I tried to find differences between the images that are being reshaped and ones that aren't. So, I noticed the following difference:

reshaped    : JPEG image data, EXIF standard 2.21
not reshaped: JPEG image data, JFIF standard 1.01

Any help with this problem would be greatly appreciated.

OpenCV version being used: 2.4.8