Get roof color from raster

2071
11
Jump to solution
03-12-2017 12:13 AM
PeterVersteeg
Occasional Contributor II

Good day,

I have a color orthophoto raster (RGB) with 10cm resolution (cel size) and I have a polygon feature with all the houses.

What I like to do is find the average color of a roof and get the value in the table of my house polygon.

I tried this with zonal statistics as table but then I get a 1 band raster so not with any RGB values.

Can anyone think of a way to do this.

Thank you,

Greetings Peter

0 Kudos
1 Solution

Accepted Solutions
PeterVersteeg
Occasional Contributor II

Ok I got it now. The major thing I was doing wrong is select my raster with the drop down menu (so only the image). So the tool was run on the 1st band. When you want to select band 2 or 3 you have to go to the raster folder and double click your raster then you can select your bands.

in the tool it looks like this:

D:\Your folder\your raster\Band_1

In the image you will see the tools I used. Really nice that I know this now and that it works but the end result is not what I want . This is because there are too many shadows and so the end result is most

of the time a grey color (see picture).

View solution in original post

11 Replies
DanPatterson_Retired
MVP Emeritus

Short of doing it one band at a time, I presume that you have ruled out using Cell statistics which requires point locations rather than zones

PeterVersteeg
Occasional Contributor II

Thank you Dan this gave me samething to try. But diong it 1 band at the time gives me a grey rgb value in the end. Cel statistics works with multiple raster i cannot see it works with points. Parhaps you mean "get cel value". To be honest i do not know how to get the x, y of the pixels i want.

Greetings

0 Kudos
DanPatterson_Retired
MVP Emeritus

the values of each band will be in the range of 0-255, so I am not sure what you mean their grey values?  Cell values, yes.  You would have to create point layer to extract those values using the points

0 Kudos
curtvprice
MVP Esteemed Contributor

Dan you are right on.

Peter, most spatial analyst tools only operate on one band at a time, if you pass one of these tools a multi-band raster it will simply pick the first band and process that.  The best approach if you need a mean R, G, and B value would be to run Zonal Statistics As Table on each band in turn, and combine the results using the Join FIeld tool.

Cell Statistics gives you the average value pixel by pixel through a stack of bands, I don't think that's what you want.

What is the purpose of your mean value? Maybe what you really want is the Create Signatures tool, which does full statistics for each of your zones that can be analyzed using some of the other tools in the Multivariate toolbox.

PeterVersteeg
Occasional Contributor II

Thank you for the explanation. I did try that yesterday but I am doing samenhang wrong. I got my red value but even if I set only my green I stil get the red value from the tool. I am not at my computer but going to look if I must set my 1st band as green what the result wil by. 

I am making LOD2 models and give it same texture with a cityengine rule. But did not like the result. I think if the models roofs have the "right" color this wil inprove mutch. 

So Abdullah Anter is right I need the most common color within the polygon.

I then wil compaire it with the roof texture color and pick the best. This last part will by a python script I think but first problems first.

Greetings peter

PeterVersteeg
Occasional Contributor II

My first approach was using the classification tools and I think I will stil do to get a "cleaner" raster. But I need that RGB code in my building feature so I can link that table field to my cityengine rule. 

0 Kudos
DanPatterson_Retired
MVP Emeritus

That will remove the obvious shadow effect... which is nice, or doesn't that natural look translate well to CityEngine?

0 Kudos
PeterVersteeg
Occasional Contributor II

In my opinion good textures look better then a orthophoto. This project is for VBS3 a simulator were you are very close the object/world (walking/driving on ground) even a 10cm orthophoto is then very pixelated

0 Kudos
AbdullahAnter
Occasional Contributor III

Really,you need the average color or the most common color?

maybe the average color is not exit in your raster.