mask by image resizes the image to size of mask image

26 views
Skip to first unread message

Girish Kumar

unread,
Jan 4, 2017, 8:08:37 AM1/4/17
to RSGISLib Support
Dear all,

        I want to mask out waterbodies from NDVI image. The mask function does the masking, but the resultant image has been resized to the size of mask image. I want to retian the size of output image as same as the size of input image, since the size of mask image is smaller.

With warm regards
Girish

Daniel Clewley

unread,
Jan 4, 2017, 3:41:46 PM1/4/17
to Girish Kumar, RSGISLib Support
Hi Girish,

You can’t do this using the mask function within RSGISLib as most of the functions apply only to the overlapping area of input images.

One way of getting round this it to pad the mask image so it is the same extent as your image using the resampleImage2Match function ( http://rsgislib.org/rsgislib_imageutils.html#rsgislib.imageutils.resampleImage2Match

Another option is to do this in RIOS by setting the bounds to the input image rather than the mask using:

    controls.setReferenceImage(input_image)
    controls.setFootprintType("BOUNDS_FROM_RERERENCE")


Thanks,

Dan


--
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.

Pete Bunting [pfb]

unread,
Jan 4, 2017, 6:34:44 PM1/4/17
to Dan Clewley, Girish Kumar, RSGISLib Support
Hi Girish,

As Dan said you’re best bet is to pan the mask you want to apply. If the mask is a different projection and/or pixel size to your image then the command Dan suggests would work well.

If they are already on the same pixel grid then I would use rsgislib.imageutils.createCopyImage to create an image the same size of the image you want to mask and then use rsgislib.imageutils.includeImages to add your mask to the new image.

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”
--------------------------------------------------------------------
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,
Jan 10, 2017, 1:33:25 AM1/10/17
to RSGISLib Support, giris...@gmail.com
Dear Dan,

           Thank you for the suggestion. I have tried it and it is working fine.

Girish Kumar

unread,
Jan 10, 2017, 1:35:16 AM1/10/17
to RSGISLib Support, daniel....@gmail.com, giris...@gmail.com, p...@aber.ac.uk
Dear Pete,

    Thank you for giving the suggestion. I have tried the suggestion by Dan and it is working fine. 
Reply all
Reply to author
Forward
0 new messages