imagecalc.calcMultiImgBand Stas example

28 views
Skip to first unread message

Konstantinos Sideris

unread,
Jul 5, 2019, 11:15:10 AM7/5/19
to rsgislib...@googlegroups.com
Hello

I am trying to compile a script with imagecalc.calcMultiImgBandStats.
Is there an example oh how you can script it?
I have tried several times creating an example for calculating the algorithm for some images but I get the error _imagecalc.error: Could not open image 0

Hers what I have written so far:


import rsgislib
from rsgislib import imagecalc
inputImages = '/home/2005/'
outputImage = '/home/Outputs/Result.kea'
summaryStatOption = rsgislib.SUMTYPE_MEDIAN
gdalFormat = 'KEA'
datatype = rsgislib.TYPE_32FLOAT
imagecalc.calcMultiImgBandStats(inputImages,outputImage,summaryStatOption,
                                                       gdalFormat,datatype)

Daniel Clewley

unread,
Jul 8, 2019, 1:03:15 PM7/8/19
to Konstantinos Sideris, RSGISLib Support
Hi,

You need to provide a list of images to the function, not a directory. You can use glob to list all the files in a directory matching ‘*.kea’, this should work.
For example:

import glob
import rsgislib
from rsgislib import imagecalc
inputImages = glob.glob('/home/2005/*kea’)

outputImage = '/home/Outputs/Result.kea'
summaryStatOption = rsgislib.SUMTYPE_MEDIAN
gdalFormat = 'KEA'
datatype = rsgislib.TYPE_32FLOAT
imagecalc.calcMultiImgBandStats(inputImages,outputImage,summaryStatOption,
                                                       gdalFormat,datatype)

Thanks,

Dan

On 5 Jul 2019, at 16:15, Konstantinos Sideris <iron...@gmail.com> wrote:

Hello

I am trying to compile a script with imagecalc.calcMultiImgBandStats.
Is there an example oh how you can script it?
I have tried several times creating an example for calculating the algorithm for some images but I get the error _imagecalc.error: Could not open image 0

Hers what I have written so far:


mport rsgislib
from rsgislib import imagecalc
inputImages = '/home/2005/'
outputImage = '/home/Outputs/Result.kea'
summaryStatOption = rsgislib.SUMTYPE_MEDIAN
gdalFormat = 'KEA'
datatype = rsgislib.TYPE_32FLOAT
imagecalc.calcMultiImgBandStats(inputImages,outputImage,summaryStatOption,
                                                       gdalFormat,datatype)

--
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.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rsgislib-support/1b6eb796-9797-4a85-961a-012343500777%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages