[postgis-tickets] [PostGIS] #2597: [raster] St_Grayscale

PostGIS trac at osgeo.org
Wed Dec 27 09:10:51 PST 2017


#2597: [raster] St_Grayscale
--------------------------+-----------------------------
  Reporter:  nclay        |      Owner:  dustymugs
      Type:  enhancement  |     Status:  new
  Priority:  medium       |  Milestone:  PostGIS Fund Me
 Component:  raster       |    Version:  trunk
Resolution:               |   Keywords:
--------------------------+-----------------------------

Old description:

> Returns a single band gray-scale representation of a RGB or HSV raster.
> ST_Grayscale(raster img, pixeltype default 32BF )

New description:

 Returns a single band 8BUI representation of a RGB raster.

--

Comment (by dustymugs):

 This can be written as a set of MapAlgebra callback functions (one per
 particular algorithm) and a ST_Grayscale user (wrapper) function.

 Basic implementation should just use the following:

 {{{
 Y = 0.2989 * R + 0.5870 * G + 0.1140 * B
 }}}

 Map Algebra callback function

 {{{
 ST_Grayscale4ma(double precision[][][] value, integer[][] pos, text[]
 VARIADIC userargs)
 }}}

 User function

 {{{
 ST_Grayscale(raster rast, integer redband=1, integer blueband=2, integer
 greenband=3)
 }}}

 Bands provided should be preprocessed before grayscaling to make sure
 input pixel types are 8BUI (via ST_Reclass if necessary)

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/2597#comment:3>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list