count number of pixels having certain value

16 views
Skip to first unread message

Girish Kumar

unread,
Feb 23, 2017, 3:47:34 AM2/23/17
to RSGISLib Support
Dear all,

          How to get the number of pixels having specific value in an image. I have made a binary image from NDVI by thresholding it. Now want to calculate the area. It can be done if I get the number of pixels having value 1.Kindly give your suggestion.

With Warm Regards
Girish

Pete Bunting [pfb]

unread,
Feb 23, 2017, 5:26:42 AM2/23/17
to Girish Kumar, RSGISLib Support
Hi Girish,

The histogram of the image is the easiest way. For the example you give I would use rsgislib.rastergis.populateStats and then read the histogram from the RAT. However, you can also use rsgislib.imagecalc.getHistogram which returns a list.

Best wishes,

Pete

****************************************************
* Dr Pete Bunting
* Reader in Remote Sensing
* Earth Observation and Ecosystem Dynamics Group
* Department of Geography and Earth Sciences
* Aberystwyth University
* Aberystwyth
* Ceredigion
* SY23 3DB
* UK
*
* Ph: +44 (0) 1970 622615
* Mob: +44 (0) 7917 842743
* Email: p...@aber.ac.uk
* ORCID: http://orcid.org/0000-0002-7435-0148
****************************************************
"Please consider the environment before printing this email or any documents attached”
> --
> You received this message because you are subscribed to the Google Groups "RSGISLib Support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rsgislib-suppo...@googlegroups.com.
> To post to this group, send email to rsgislib...@googlegroups.com.
> Visit this group at https://groups.google.com/group/rsgislib-support.
> For more options, visit https://groups.google.com/d/optout.



--------------------------------------------------------------------
Un o’r 4 prifysgol uchaf yn y DU a’r orau yng Nghymru am fodlonrwydd myfyrwyr.
(Arolwg Cenedlaethol y Myfyrwyr 2016)
www.aber.ac.uk

Top 4 UK university and best in Wales for student satisfaction
(National Student Survey 2016)
www.aber.ac.uk

Girish Kumar

unread,
Feb 23, 2017, 8:19:29 AM2/23/17
to Pete Bunting [pfb], RSGISLib Support
Hi Pete,

   Thank You for your quick response. I will try it.



With Warm Regards
T P Girish Kumar

> To unsubscribe from this group and stop receiving emails from it, send an email to rsgislib-support+unsubscribe@googlegroups.com.
> To post to this group, send email to rsgislib-support@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages