Reclassify an RGB raster

2805
3
07-25-2019 12:36 AM
NicolasHand
New Contributor

Hi,

I have a georeferenced RGB raster that I am trying to digitise (see attachment 1). I have had success vectorising the contours using arcscan, however this is a time consuming process and it is still missing some of the detail contained within the colourfil grid. It is this additional detail I am essentially hoping to capture in a methodology that is easily repeatable across many input maps.

To try and break the task in to steps, I think I need to:

1) Sample the numbered breaks on the colour bar provided on the map (at bottom left of attachment, ranging from 2216 to 5452)

2) Interpolate the known sample numbers to account for the colours in between

3) Reclassify the RGB image using the calibration above

I have had some partial success by using the training sample manager, carefully selecting sample colours next to the colour bar labels resulting in 13 points and then using 'Maximum Likelihood Classification'. However these labeled points also correspond with the black contour breaks and so I'm not getting many reclassified points..

So, assuming my rough idea of methodology is along the right lines, I need to work out how to take more samples along the RGB colour bar, calibrate the known values and then interpolate in between to then be able to apply the Maximum Likelihood Classification.

Has anyone attempted this before? Or perhaps have any ideas on my proposed work flow or how to achieve what I'm attempting to do?

Many thanks in advance for any feedback you may have.

0 Kudos
3 Replies
NicolasHand
New Contributor

I have made some progress addressing the first two steps. Using 'pixel inspector' I have extracted the RGB values for each pixel along the colour bar. I have then interpolated the numbered breaks using excel and produced a simple ascii table with each 'value','R','G','B' relationship.

So now I just need to work out stage 3. From what I can gather so far, 'classify raster' needs this mapping to be within a 'classifier definition file' or .ecd in JSON format. I'm starting to wonder if I'm going to need to write a python script to do this?

0 Kudos
NicolasHand
New Contributor

I've come back to needing to try and find a solution to this. Some time has passed and now with a fresh perspective - and also now using Pro, I've come up with a new approach. However I'm still getting stuck around the same place as my previous posts back in '19..

My new approach is to draw a line along the longest stretch of the raster that is most representative of the colour range. I then use a 'densify' to create a vertex at each 10m. From there I run 'vertices to points' and 'Extract multiple values to points' - one value for each R G & B band of the raster. So that effectively then gives me a table of RGB values which I then copy in to excel to calculate the corresponding value. For example R0 G10 B55 = 1000m and so on for 260 combinations.

From there, I have written a Python script to produce a .ecd file that follows a 'donor' .ecd I produced as best I can.. And I then run 'classify raster' using this .ecd. However the error I'm now coming up against is:

'ERROR 160086: The domain field type does not match that of the field it is being assigned to.'

I can only think that there is an incorrect data type e.g. text instead of short somewhere.. but can't work out where Pro might be picking these up from as there's no data type specified in the .ecd file or the classify tool that I can see.

 

And sometimes I'm getting:

ERROR 160095: Domain instances cannot be assigned to a workspace if already in use by another workspace.

0 Kudos
NicolasHand
New Contributor

I am now also experimenting with a different approach using 'Principle components analysis'. This tool appears to do what I want by producing unique values for each RGB combination. These resulting unique numbers can then be reclassified to represent the 'true' values (e.g. depth, height in meters). The hurdle I'm facing now is the onerous task of reclassifying over 350 unique values..

0 Kudos