Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MtS-WH data set: color correction when extracting training set #3

Open
Y-F-Yang opened this issue Jan 17, 2020 · 2 comments
Open

MtS-WH data set: color correction when extracting training set #3

Y-F-Yang opened this issue Jan 17, 2020 · 2 comments

Comments

@Y-F-Yang
Copy link

Hello,

In the MtS-WH data set, it seems that for images in training set, all the channels are corrected to 8-bit unsigned color, while for those in test set, the B-G-R channels are 11-bit and NIR channel is 16-bit. So I tried a naïve way to cast 11-bit color to 8-bit, i.e., 8-bit = 11-bit * 256 / 2048. However this does not work out well.

Here's an example:
First I load a training data file 'l2_n10_x95_y780.tif' into numpy nd-array (only B-G-R). It looks like:

[[[ 40,  23, 136],
    [ 43,  26, 143],
    [ 38,  22, 127],
    ...,
    [ 43,  26, 139],
    [ 48,  33, 152],
    [ 44,  27, 139]],

   [[ 41,  25, 140],
    [ 43,  26, 143],
    [ 45,  30, 143],
    ...,
    [ 46,  30, 147],
    [ 40,  23, 131],
    [ 48,  33, 152]], ...

Then I read the corresponding part in 'hanyang2002' into numpy array, using indices [780:780+150, 95:95+150, 0:3] (hopefully I'm correct), which looks like:

[[[330, 349, 211],
    [330, 349, 211],
    [326, 341, 200],
    ...,
    [338, 360, 226],
    [339, 363, 229],
    [335, 356, 220]],

   [[329, 346, 216],
    [330, 347, 217],
    [329, 345, 215],
    ...,
    [334, 356, 230],
    [338, 364, 241],
    [331, 351, 222]], ...

Finally by performing 8-bit = 11-bit * 256 / 2048, the test data becomes

[[[41, 44, 26],
    [41, 44, 26],
    [41, 43, 25],
    ...,
    [42, 45, 28],
    [42, 45, 29],
    [42, 44, 28]],

   [[41, 43, 27],
    [41, 43, 27],
    [41, 43, 27],
    ...,
    [42, 44, 29],
    [42, 46, 30],
    [41, 44, 28]], ...

which obviously does not coincide with training data.

So is there any special color or maybe radiometric correction performed when extracting training set?

Thanks very much!

@wenhwu
Copy link
Owner

wenhwu commented Jan 18, 2020

Thank you for providing such detailed information, and maybe you found something interesting. If I understand correctly, the problem is that you found that the data distribution between the training set and the test set is too different.

For me, analyzing remote sensing images doesn't use NumPy because they're too big (actually because I'm too lazy). I generally use ENVI's quick stats for statistics(ENVI is a professional remote sensing image processing software). I've done tests before and found that the ENVI statistics are consistent with the NumPy.

ENVI quick stats_3

In ENVI, l2_n10_x95_y780.tif 's statistics are as follows:
ENVI quick stats

In ENVI, hanyang2002(the test set) is this:
hanyang2002

Just as you did, to hanyang2002, I converted 11 bits to 8 bits(only B-G-R), but I used the Export Layer to Tiff(this is a very useful feature to save the number of bands displayed and the stretching mode in ENVI). In my experience, the best stretching mode is Optimized Linear.
export layer to tiff

and the result image's statistical results is this:
hanyang2002_2

then I used numpy to read indices [780:780+150, 95:95+150, 0:3], which is:

[[[11 25 30]
  [11 25 30]
  [ 6 21 26]
  ...
  [18 32 38]
  [19 33 39]
  [15 29 35]]

 [[13 24 29]
  [14 24 30]
  [13 23 29]
  ...
  [19 29 34]
  [24 34 38]
  [16 26 31]]

 [[15 25 31]
  [13 23 29]
  [17 27 33]
  ...
  [23 33 37]
  [14 25 29]
  [18 28 32]]
 ...

But I guess maybe that's not the point, because [780:780+150, 95:95+150, 0:3] is just local information.

What's strange to me is these two things:

  • Almost all training sets ' NIR channel is 255.
  • I have inquired the dynamic range of IKONOS is 11 bits per pixel. However, the hanyang2002's NIR channel is 16-bit, while the hanyang2009's NIR channel is 11-bit.
    hanyang2009

I have already opened an issue in MtS-WH-Dataset, maybe you can take a look. If I made any mistakes, please correct me.

@Y-F-Yang
Copy link
Author

Thanks for your detailed reply! It really makes the problem more clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants