0

As far as I know, all pixel values of a hdr image should be less than 1 and greater than 0.

However, I tried to read hdr images and checked pixel values of one of images:

train_set_y_original = [cv.imread(fn, -1) for fn in train_img_folder] 

print(train_set_y_original[20])

But, some of values are greater than 1.

I tried both

print(train_set_y_original[20].astype('float32') 

and

print(train_set_y_original[20].astype('float64')) 

The results were same.

I don't understand why I got this result.

I need to make labels of hdr images so I need unchanged pixel values of a hdr image.

Lescurel
  • 10,749
  • 16
  • 39
Min Lee
  • 1
  • 1
  • what result do you get? Maybe you have to convert image ie. from RGB to Grayscale or other format. OR maybe you have to normalize it. Most images keep colors as 0...255. – furas Feb 03 '21 at 09:11
  • `float32`, `float64` can't change ie. `12` to value smaller then `1` - it will convert only `integer` value `12` to float value `12.0`. To convert `12` to ie. `1` you would have to rather `normalize` values. – furas Feb 03 '21 at 09:13
  • Try printing `img.mean(), img.max(), img.min()` – Mark Setchell Feb 03 '21 at 09:23
  • This is the (0,0,0) of train_set_y_original[20]:[ 0.2578125 0.2578125 0.2578125] [ 0.765625 1.484375 1.0234375] [ 0.6953125 1.171875 0.734375 ] ... [19.875 25.125 11.125 ] [19.125 24.75 11. ] [ 0.2578125 0.2578125 0.2578125]] And I need to make labels of hdr images so I should not convert those values to between 0 and 255. – Min Lee Feb 03 '21 at 09:26
  • As HDR treatment uses exponential expresions, it is normally dealed with float s, but in most of the cases (probably yours) the image is saved in a RGB - unsigned 8 bit integers. this means max value (maybe 1) -> 255 and minimun (maybe 0) -> 0, If you want 0 to 1 Values you will have to normalize yourself, but you won't get the exact same information as when the HDR was calculated – Ivan Feb 03 '21 at 12:09

1 Answers1

0

Yes, in case of limited range. For 10 bit 16-940 is used for Y' and Cb, Cr that is 16-960. Out of that it will be less that 0 and more than 1. That was used by xvYCC, BTW. And is used by Superwhite and Superblack. Not that it makes any sense with PQ transfer.

In case of full range, no in Y, Cb, Cr, but still yes in R', G', B'.