Why when i'm open first image, then convert to HLS, extract hue and set saturation and lightness to 127, then convert to RGB and save (second image). Why colors is wrong?
1 | initial version |
Why when i'm open first image, then convert to HLS, extract hue and set saturation and lightness to 127, then convert to RGB and save (second image). Why colors is wrong?
2 | No.2 Revision |
Why when i'm open first image, then convert to HLS, extract hue and set saturation and lightness to 127, then convert to RGB and save (second image). Why colors is wrong?
import cv2, numpy
img = cv2.imread('image.png')
img = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)
hue = img.T[0]
sl = numpy.repeat(numpy.uint8(127), hue.shape[0] * hue.shape[1])
sl = sl.reshape(hue.shape)
img = numpy.array((hue, sl, sl)).T
img = cv2.cvtColor(img, cv2.COLOR_HLS2RGB)
Image.fromarray(img).save('pew.png')
3 | No.3 Revision |
Why when i'm open first image, then convert to HLS, extract hue and set saturation and lightness to 127, then convert to RGB and save (second image). Why colors is wrong?
import cv2, numpy
img = cv2.imread('image.png')
img = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)
hue = img.T[0]
sl = numpy.repeat(numpy.uint8(127), hue.shape[0] * hue.shape[1])
sl = sl.reshape(hue.shape)
img = numpy.array((hue, sl, sl)).T
img = cv2.cvtColor(img, cv2.COLOR_HLS2RGB)
Image.fromarray(img).save('pew.png')
4 | No.4 Revision |
Why when i'm open first image, then convert to HLS, extract hue and set saturation and lightness to 127, then convert to RGB and save (second image). Why colors is wrong?
import cv2, numpy
img = cv2.imread('image.png')
img = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)
hue = img.T[0]
sl = numpy.repeat(numpy.uint8(127), hue.shape[0] * hue.shape[1])
sl = sl.reshape(hue.shape)
img = numpy.array((hue, sl, sl)).T
img = cv2.cvtColor(img, cv2.COLOR_HLS2RGB)
Image.fromarray(img).save('pew.png')
But when i do
img = cv2.cvtColor(img, cv2.COLOR_HLS2BGR)
all is right