[GRASS-user] Landsat classification with CORINE CLC color codes?

Hello,

My apologies if this question is already covered in this list...

44 CORINE CLC RGB color codes are mentioned for each of the 44 land use
classes at:
http://dataservice.eea.europa.eu/download.asp?id=14234&filetype=.csv

Can we classify a Landsat RGB image based on these rgb color codes in
GRASS GIS and how?

Cheers, Dimos

On Mon, Jan 19, 2009 at 7:42 AM, Dimos <dimos_anastasiou@yahoo.com> wrote:

Hello,

My apologies if this question is already covered in this list...

44 CORINE CLC RGB color codes are mentioned for each of the 44 land use
classes at:
http://dataservice.eea.europa.eu/download.asp?id=14234&filetype=.csv

Can we classify a Landsat RGB image based on these rgb color codes in
GRASS GIS and how?

In my opinion it doesn't make much sense to use the RGB colors here
since they are arbitrary (well, ok, ideally "close" to natural colors).

What you can do:
- download the related CORINE shape file(s)
- extract training areas
- run i.gensigset to generate statistics
- run i.smap to do the classification
- validate

Markus

On Mon, 2009-01-19 at 08:25 +0100, Markus Neteler wrote:

On Mon, Jan 19, 2009 at 7:42 AM, Dimos <dimos_anastasiou@yahoo.com> wrote:
> Hello,
>
> My apologies if this question is already covered in this list...
>
> 44 CORINE CLC RGB color codes are mentioned for each of the 44 land use
> classes at:
> http://dataservice.eea.europa.eu/download.asp?id=14234&filetype=.csv
>
> Can we classify a Landsat RGB image based on these rgb color codes in
> GRASS GIS and how?

In my opinion it doesn't make much sense to use the RGB colors here
since they are arbitrary (well, ok, ideally "close" to natural colors).

What you can do:
- download the related CORINE shape file(s)
- extract training areas
- run i.gensigset to generate statistics
- run i.smap to do the classification
- validate

Markus

Hi! Markus suggestion is one solution.

I just want to add that, if you take samples (=areas) from CORINE (as
they are), they can be a bit rough to classify a, let's say, 15m
pixel-resolution Landsat satellite image. In my humble opinion, there is
no way in this case to completely avoid some manual digitisation of
training samples, or edit the samples you will extract from CORINE.

Well, it depends also on what (e.g. which land cover classes) you want
to extract from Landsat.

There is, on the web, a nice step-by-step which uses COREIN + i.smap on
Landsat [1].

Dimo, if you could be a bit more precise... ?
Kind regards, Nikos

[1] http://www.custom-scenery.org/Building-Scener.331.0.html

Thanks for the great input!

I just want to create a high resolution land use map, based on an
already existing classification such as CORINE using Landsat data: I
will follow your instructions as below.

Regards, Dimos

On Mon, 2009-01-19 at 12:40 +0100, Nikos Alexandris wrote:

On Mon, 2009-01-19 at 08:25 +0100, Markus Neteler wrote:
> On Mon, Jan 19, 2009 at 7:42 AM, Dimos <dimos_anastasiou@yahoo.com> wrote:
> > Hello,
> >
> > My apologies if this question is already covered in this list...
> >
> > 44 CORINE CLC RGB color codes are mentioned for each of the 44 land use
> > classes at:
> > http://dataservice.eea.europa.eu/download.asp?id=14234&filetype=.csv
> >
> > Can we classify a Landsat RGB image based on these rgb color codes in
> > GRASS GIS and how?
>
> In my opinion it doesn't make much sense to use the RGB colors here
> since they are arbitrary (well, ok, ideally "close" to natural colors).
>
> What you can do:
> - download the related CORINE shape file(s)
> - extract training areas
> - run i.gensigset to generate statistics
> - run i.smap to do the classification
> - validate
>
> Markus

Hi! Markus suggestion is one solution.

I just want to add that, if you take samples (=areas) from CORINE (as
they are), they can be a bit rough to classify a, let's say, 15m
pixel-resolution Landsat satellite image. In my humble opinion, there is
no way in this case to completely avoid some manual digitisation of
training samples, or edit the samples you will extract from CORINE.

Well, it depends also on what (e.g. which land cover classes) you want
to extract from Landsat.

There is, on the web, a nice step-by-step which uses COREIN + i.smap on
Landsat [1].

Dimo, if you could be a bit more precise... ?
Kind regards, Nikos

[1] http://www.custom-scenery.org/Building-Scener.331.0.html

Dimos wrote:

> > 44 CORINE CLC RGB color codes are mentioned for each of the 44
> > land use classes at:

  http://dataservice.eea.europa.eu/download.asp?id=14234&filetype=.csv

> >
> > Can we classify a Landsat RGB image based on these rgb color codes
> > in GRASS GIS and how?

Markus:

> In my opinion it doesn't make much sense to use the RGB colors here
> since they are arbitrary (well, ok, ideally "close" to natural colors).

I am trying to understand; there are 256^3 RGB possibilities (@ 8bits per
channel) and CORINE have selected 44 of those possibilities to give labels
to? Your chances of hitting those exactly are rather low. I suppose these
are meant to be 3D spectral peaks somehow with the land-use category doing
like a 3D form of a nearest-neighbor thiessen polygon.

It seems a rather lossy and sensitive approach, ie it would be better to
base it on all 7 bands & include some method to remove time of day/luminance
issues. e.g. specify color normalization step first [eg i.landsat.rgb],
or convert LANDSAT r,g,b pseudo-visual bands to HIS and classify on that
(I'm guessing that hue would be less sensitive to sun angle).

Nikos:

In my humble opinion, there is no way in this case to completely avoid
some manual digitisation of training samples, or edit the samples you
will extract from CORINE.

....

There is, on the web, a nice step-by-step which uses COREIN + i.smap on
Landsat [1].

....

[1] http://www.custom-scenery.org/Building-Scener.331.0.html

interesting.

Hamish

On Mon, 2009-01-19 at 13:30 -0800, Hamish wrote:

Dimos wrote:
> > > 44 CORINE CLC RGB color codes are mentioned for each of the 44
> > > land use classes at:
  http://dataservice.eea.europa.eu/download.asp?id=14234&filetype=.csv
> > >
> > > Can we classify a Landsat RGB image based on these rgb color
codes
> > > in GRASS GIS and how?

Markus:
> > In my opinion it doesn't make much sense to use the RGB colors
here
> > since they are arbitrary (well, ok, ideally "close" to natural
colors).

I am trying to understand; there are 256^3 RGB possibilities (@ 8bits
per
channel) and CORINE have selected 44 of those possibilities to give
labels
to? Your chances of hitting those exactly are rather low. I suppose
these
are meant to be 3D spectral peaks somehow with the land-use category
doing
like a 3D form of a nearest-neighbor thiessen polygon.

It seems a rather lossy and sensitive approach, ie it would be better
to
base it on all 7 bands & include some method to remove time of
day/luminance
issues. e.g. specify color normalization step first [eg
i.landsat.rgb],
or convert LANDSAT r,g,b pseudo-visual bands to HIS and classify on
that
(I'm guessing that hue would be less sensitive to sun angle).

Hmmm??

Maybe I am talking nonsense but, I think, the designers must have tried
to create a color scheme that, not only is connected in a way to natural
colors, but also that makes the land cover classes easy to discriminate
visually and the whole thing a *nice* looking map. Or maybe not... (?).

By the way, below are the official rgb combinations for use with
"\usepackage{colortbl}" (LaTeX).

Kind regards, Nikos

\definecolor{111}{rgb}{0.8984,0,0.3008}
\definecolor{112}{rgb}{0.9961,0,0}
\definecolor{121}{rgb}{0.7969,0.3008,0.9453}
\definecolor{122}{rgb}{0.7969,0,0}
\definecolor{123}{rgb}{0.8984,0.7969,0.7969}
\definecolor{124}{rgb}{0.8984,0.7969,0.8984}
\definecolor{131}{rgb}{0.6484,0,0.7969}
\definecolor{132}{rgb}{0.6484,0.3008,0}
\definecolor{133}{rgb}{0.9961,0.3008,0.9961}
\definecolor{141}{rgb}{0.9961,0.6484,0.9961}
\definecolor{142}{rgb}{0.9961,0.8984,0.9961}
\definecolor{211}{rgb}{0.9961,0.9961,0.6563}
\definecolor{212}{rgb}{0.9961,0.9961,0}
\definecolor{213}{rgb}{0.8984,0.8984,0}
\definecolor{221}{rgb}{0.8984,0.5,0}
\definecolor{222}{rgb}{0.9453,0.6484,0.3008}
\definecolor{223}{rgb}{0.8984,0.6484,0}
\definecolor{231}{rgb}{0.8984,0.8984,0.3008}
\definecolor{241}{rgb}{0.9961,0.8984,0.6484}
\definecolor{242}{rgb}{0.9961,0.8984,0.3008}
\definecolor{243}{rgb}{0.8984,0.7969,0.3008}
\definecolor{244}{rgb}{0.9453,0.7969,0.6484}
\definecolor{311}{rgb}{0.5,0.9961,0}
\definecolor{312}{rgb}{0,0.6484,0}
\definecolor{313}{rgb}{0.3008,0.9961,0}
\definecolor{321}{rgb}{0.7969,0.9453,0.3008}
\definecolor{322}{rgb}{0.6484,0.9961,0.5}
\definecolor{323}{rgb}{0.6484,0.8984,0.3008}
\definecolor{324}{rgb}{0.6484,0.9453,0}
\definecolor{331}{rgb}{0.8984,0.8984,0.8984}
\definecolor{332}{rgb}{0.7969,0.7969,0.7969}
\definecolor{333}{rgb}{0.7969,0.9961,0.7969}
\definecolor{334}{rgb}{0,0,0}
\definecolor{335}{rgb}{0.6484,0.8984,0.7969}
\definecolor{411}{rgb}{0.6484,0.6484,0.9961}
\definecolor{412}{rgb}{0.3008,0.3008,0.9961}
\definecolor{421}{rgb}{0.7969,0.7969,0.9961}
\definecolor{422}{rgb}{0.8984,0.8984,0.9961}
\definecolor{423}{rgb}{0.6484,0.6484,0.8984}
\definecolor{511}{rgb}{0,0.7969,0.9453}
\definecolor{512}{rgb}{0.5,0.9453,0.8984}
\definecolor{521}{rgb}{0,0.9961,0.6484}
\definecolor{522}{rgb}{0.6484,0.9961,0.8984}
\definecolor{523}{rgb}{0.8984,0.9453,0.9961}

> Dimos wrote:
> > > > 44 CORINE CLC RGB color codes are mentioned for each of the 44
> > > > land use classes at:
http://dataservice.eea.europa.eu/download.asp?id=14234&filetype=.csv
> > > >
> > > > Can we classify a Landsat RGB image based on these rgb color
> > > > codes in GRASS GIS and how?
>
> Markus:
> > > In my opinion it doesn't make much sense to use the RGB colors
> > > here since they are arbitrary (well, ok, ideally "close" to
> > > natural colors).

Hamish:

> I am trying to understand; there are 256^3 RGB possibilities (@ 8bits
> per channel) and CORINE have selected 44 of those possibilities to
> give labels to? Your chances of hitting those exactly are rather
> low. I suppose these are meant to be 3D spectral peaks somehow with
> the land-use category doing like a 3D form of a nearest-neighbor
> thiessen polygon.
>
> It seems a rather lossy and sensitive approach, ie it would be better
> to base it on all 7 bands & include some method to remove time of
> day/luminance issues. e.g. specify color normalization step first
> [eg i.landsat.rgb], or convert LANDSAT r,g,b pseudo-visual bands to
> HIS and classify on that (I'm guessing that hue would be less
> sensitive to sun angle).

Nikos:

Hmmm??

Maybe I am talking nonsense but, I think, the designers must have tried
to create a color scheme that, not only is connected in a way to natural
colors, but also that makes the land cover classes easy to discriminate
visually and the whole thing a *nice* looking map. Or maybe not... (?).

so we are looking at this backwards?

I answered from the perspective of taking LANDSAT imagery and classifying
it into those 44 categories based on imagery ground color. But perhaps
those colors are meant for people who have categorical data layer (44 cats)
and want to display it in a consistent & pretty way. In that case all that
needs to be done is to reformat the CSV file to pass to r.colors.

In the other direction, if you have a land-use map given in those colors
and which you wish to attach cat numbers/labels to them, & then use them
as training areas for classifying other LANDSAT imagery, that is another
task.

By the way, below are the official rgb combinations for use
with "\usepackage{colortbl}" (LaTeX).

how does that relate?

Hamish

On Mon, 2009-01-19 at 15:17 -0800, Hamish wrote:

> > Dimos wrote:
> > > > > 44 CORINE CLC RGB color codes are mentioned for each of the 44
> > > > > land use classes at:
> http://dataservice.eea.europa.eu/download.asp?id=14234&filetype=.csv
> > > > >
> > > > > Can we classify a Landsat RGB image based on these rgb color
> > > > > codes in GRASS GIS and how?
> >
> > Markus:
> > > > In my opinion it doesn't make much sense to use the RGB colors
> > > > here since they are arbitrary (well, ok, ideally "close" to
> > > > natural colors).

Hamish:
> > I am trying to understand; there are 256^3 RGB possibilities (@ 8bits
> > per channel) and CORINE have selected 44 of those possibilities to
> > give labels to? Your chances of hitting those exactly are rather
> > low. I suppose these are meant to be 3D spectral peaks somehow with
> > the land-use category doing like a 3D form of a nearest-neighbor
> > thiessen polygon.
> >
> > It seems a rather lossy and sensitive approach, ie it would be better
> > to base it on all 7 bands & include some method to remove time of
> > day/luminance issues. e.g. specify color normalization step first
> > [eg i.landsat.rgb], or convert LANDSAT r,g,b pseudo-visual bands to
> > HIS and classify on that (I'm guessing that hue would be less
> > sensitive to sun angle).

Nikos:
> Hmmm??
>
> Maybe I am talking nonsense but, I think, the designers must have tried
> to create a color scheme that, not only is connected in a way to natural
> colors, but also that makes the land cover classes easy to discriminate
> visually and the whole thing a *nice* looking map. Or maybe not... (?).

so we are looking at this backwards?

I answered from the perspective of taking LANDSAT imagery and classifying
it into those 44 categories based on imagery ground color. But perhaps
those colors are meant for people who have categorical data layer (44 cats)
and want to display it in a consistent & pretty way.

As I said, maybe I am completely wrong, but it's my guess that the RGB
combinations provided by EEA are not directly related to radiometric
values.

In that case all that
needs to be done is to reformat the CSV file to pass to r.colors.

There are already raster versions of the CORINE land cover map. Check
EEA's website. And the grassrgb are also here [*] :slight_smile:

In the other direction, if you have a land-use map given in those colors
and which you wish to attach cat numbers/labels to them, & then use them
as training areas for classifying other LANDSAT imagery, that is another
task.

That's what I thought initially.

> By the way, below are the official rgb combinations for use
> with "\usepackage{colortbl}" (LaTeX).

Ehhmm... Hamish, would you advise to divide the 0-255 values by 255 or
by 256 to transform them to values ranging from 0 ~ 1 ? Or it doesn't
really matter? (The values I posted in the previous post, are divided by
256).

how does that relate?

Hamish

[*] That's here for copy-paste :slight_smile:
----------------------------------
111 230:000:077
112 255:000:000
121 204:077:242
122 204:000:000
123 230:204:204
124 230:204:230
131 166:000:204
132 166:077:000
133 255:077:255
141 255:166:255
142 255:230:255
211 255:255:168
212 255:255:000
213 230:230:000
221 230:128:000
222 242:166:077
223 230:166:000
231 230:230:077
241 255:230:166
242 255:230:077
243 230:204:077
244 242:204:166
311 128:255:000
312 000:166:000
313 077:255:000
321 204:242:077
322 166:255:128
323 166:230:077
324 166:242:000
331 230:230:230
332 204:204:204
333 204:255:204
334 000:000:000
335 166:230:204
411 166:166:255
412 077:077:255
421 204:204:255
422 230:230:255
423 166:166:230
511 000:204:242
512 128:242:230
521 000:255:166
522 166:255:230
523 230:242:255

Nikos:

would you advise to divide the 0-255 values by 255 or
by 256 to transform them to values ranging from 0 ~ 1 ? Or
it doesn't really matter? (The values I posted in the previous post,
are divided by 256).

255.

there are 2^8 = 256 possibilities. So range could be 0-255 or 1-256.
If you use 0-255 then 0/255=0.0 and 255/255 is 1.0 and life is easy.

Hamish

On Mon, 2009-01-19 at 16:45 -0800, Hamish wrote:

there are 2^8 = 256 possibilities. So range could be 0-255 or 1-256.
If you use 0-255 then 0/255=0.0 and 255/255 is 1.0 and life is easy.
Hamish

Hehehe... actually I did divide by 255 in the beginning, but then, I
thought of playing around with sed, cut, tr and just a bit with bc. And
I thought of 256. Nonsense but it's a good command-line training I
think :slight_smile:
---------------------------------------------
Take the set of 44 rows and 2 columns, e.g.

111,"255,154,211"
112,"012,234,123"
113,"122,233,133"
[...]

and transform it to grassrgb and LaTeX format.
----------------------------------------------