More

# How to group individual groups of pixels into a single class

I have a raster image with certain pixel groups of equal area. Each group represents a single house. I want all the pixels near a group of houses to have the same pixel value, i.e., I want to name that area "residential area". How can I do this? I want something like this done: this image should change to:

Computing the density of houses and thresholding that will give you flexibility to achieve a reproducible solution to your liking.

The flexibility comes about through varying two parameters: the extent ("radius" or "width") of the density kernel and the threshold value.

The density can be computed through convolution with a Gaussian kernel (a "Gaussian blur" in image-processing parlance) or even through repeated focal means (using circular neighborhoods). The thresholding is a simple comparison operation ("less than" or "greater than") to select regions of highest density.

The numeric headings in the figure are the width of the Gaussian kernel in pixels. (The image itself is approximately 750 by 500 pixels.) The dark areas are the regions selected via a suitable threshold. In this case it appears that widths between 20 and 50 or so will give a result conforming to that sketched in the question. Larger widths can cause the regions to merge while smaller widths may keep them separated.

A nice feature of this approach is its interpretability: the regions can be characterized as those areas where the housing density exceeds so-and-so many houses per unit area (square kilometer or square mile, for instance). That makes it more than a mere cartographic tool and enables its use within quantitative analyses.

The figures were produced with Mathematica 9, but the process in a raster GIS such as Spatial Analyst or GRASS will be similar. It can even (easily) be done with most image processing software.

``````(* Recreate the original housing indicator grid *) i = Import["http://i.stack.imgur.com/xWbby.png">Using focal statistics will give you the desired results.Lets say the house pixels have a value of 1 and others have a value of 0. Use the focal statistic with the MAXIMUM statistic type with a neighborhood of your liking. The resulting raster will be a residential area of your neighborhood.I would imagine that the most efficient way would be to 1) convert your "house" values to a point feature class, 2) create a grouping attribute using a minimum distance criteria with the near tool, 3) loop through each group to generate minimum convex polygons using the Minimum Bounding Geometry tool. You can then convert the combined minimum convex polygons back to a raster.I recently had a similar problem where I needed to recognize clusters of items. I ended up using a hierarchical clustering algorithm provided by the clusterfck library. Demo here.To apply this to your problem, you'd first traverse the image and make a list of points fitting your criteria.For drawing the boundaries, you could use any of several techniques: you could compute a convex hull or perhaps use Voronoi cells.I'm not sure if these algorithms are implemented in the language you're using, but it's not too difficult to do.

var s1= document.location.host;

``````
``` ```
``` Previous Article Next Article ```
``` (adsbygoogle = window.adsbygoogle || []).push({}); Contact Us (adsbygoogle = window.adsbygoogle || []).push({}); (adsbygoogle = window.adsbygoogle || []).push({}); Popular Posts Filling field according to value of another field with ArcPy? Dynamically drawing a polygon around another shapefile, ArcGIS 10.2 GeoXT .ssf files Setting X/Y shadow offset values to 1 and -1 in advanced text window using ArcPy? How to update extent via sql (st_geometry) from ArcGIS for Desktop? How to down load modis burned area extraction product (adsbygoogle = window.adsbygoogle || []).push({}); (adsbygoogle = window.adsbygoogle || []).push({}); ```
``` ```
``` ```
``` Menu   Home   Oil & Gas   Teaching Plate Tectonics   Gold   Oil and Gas   Earthquakes   Minerals   Volcanoes   Plate Tectonics   Maps   Astronomy, Satellite, Space   Metals   Gemstones   World Records   Geologic Hazards   General Geology   Rock Tumblers   Rocks   Records   Geology Articles   Geology Dictionary   Oceanography   Landslides   More   Fossils Contact Us   geologyidea.com   Contact Us Copyrights © geologyidea.com How to group individual groups of pixels into a single class... (function(m,e,t,r,i,k,a){ m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)}; m[i].l=1*new Date(); k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a) })(window, document,"script","//mc.yandex.ru/metrika/tag.js", "ym"); ym(86578477, "init", {accurateTrackBounce:true, trackLinks:true, webvisor:true, clickmap:true, params: {__ym: {isFromApi: "yesIsFromApi"}}}); new Image().src = "//counter.yadro.ru/hit?r" + escape(document.referrer) + ((typeof(screen)=="undefined")?"" : ";s"+screen.width+"*"+screen.height+"*" + (screen.colorDepth?screen.colorDepth:screen.pixelDepth)) + ";u"+escape(document.URL) + ";" +Math.random(); (function(){window['__CF\$cv\$params']={r:'6b9136c64c307f9a',m:'cwnsPhA4S1ZbnBPYjC7S2sVpyKXQXG2aK9VRX7VefpM-1638748616-0-Adf4DBTYwSxXWHJa8lLyqMCRFJywt3WabVGKzVWiy2LUfyH8DRcmP+6Olq+Jz9+9CQKl/AMKONhm6OO35sSIW3P4CCSjPAVwEI/ccG7dubW13dtonR9jpK2PgXO4d+6CVk2cIGHx1IQGg50sfHL6p/H55SSJOmBVZd2FvKYzs3AqynvkCblvOLgmdP7Bc8n6SY7OK89bEfaSJeZ2jRwJtFQ=',s:[0x248c7864e0,0xfe33433aba],u:'/cdn-cgi/challenge-platform/h/g'}})(); ```