Geographisches Institut der Humboldt-Universität zu Berlin Abteilung Geomatik imageMath a calculator for evaluating mathematical expressions with images, bands and spectral profiles Andreas Rabe andreas.rabe@geo.hu-berlin.de 22. Oktober 2012 Geographisches Institut der Humboldt-Universität zu Berlin Overview • imageMath evaluates mathematical expressions • arguments can be scalar numbers, images, bands or profiles • IDL based application for EnMAP-Box or ENVI 2 Geographisches Institut der Humboldt-Universität zu Berlin Understanding Operators • imageMath supports all IDL operators • extends the common operator logic to images 3 Geographisches Institut der Humboldt-Universität zu Berlin Understanding Operators What is a sensible operator logic? number + number = number 1+2=3 Geographisches Institut der Humboldt-Universität zu Berlin Understanding Operators What is a sensible operator logic? image + image = image • operator is applied component-wise Geographisches Institut der Humboldt-Universität zu Berlin Understanding Operators What is a sensible operator logic? image + band + number = image + + replicate along missing dimensions + + • missing dimensions are replicated • operator is applied component-wise Geographisches Institut der Humboldt-Universität zu Berlin Understanding Operators What is a sensible operator logic? Rules for argument pairs: image+image: image+band: image+profile: image+number: no replication needed replicate band along image's spectral dimension replication profile along image's spatial dimension replicate number along image's spatial and spectral dimension band+band: band+profile: band+number: no replication needed replicate band along profile's spectral dimension and replicate profile along band's spatial dimension replicate number along band's spatial dimension profile+profile: profile+number: no replication needed replicate number along profile's spectral dimension number+number: no replication needed Geographisches Institut der Humboldt-Universität zu Berlin Understanding Data Types • imageMath supports all IDL data types • casting functions and data type postfixes casting functions and postfixes 1. = 1. versus float(1) = 1. 1b = 1b versus byte(1) = 1b integer and floating-point division 1/2 = 0 versus 1./2. = 0.5 overflows and underflows -1b = 255b (underflow) 10^5 = -31072 (overflow) 0-1b = -1 (no underflow, implicite type casting) If your calculated images are all black, or appear to be randomly generated, it is most likely an issue of data types. Geographisches Institut der Humboldt-Universität zu Berlin Understanding Functions • imageMath functions can be arbitrary complex • from simple type casting functions like byte() or float() • to whole processing chains Set of predefined functions: Geographisches Institut der Humboldt-Universität zu Berlin Understanding Functions Image in Image out Trigonometric and Miscellaneous Math functions take an input image, calculate something for each component and return a result image of same size. Geographisches Institut der Humboldt-Universität zu Berlin Understanding Functions Image in Band out Profile Statistics functions take an input image, calculate a profile-wise statistic for each profile, and return a result band of same spatial size. Geographisches Institut der Humboldt-Universität zu Berlin Understanding Functions Image in Profile out Band Statistics functions take an input image, calculate a band-wise statistic for each band, and return a result profile of same spectral size. Geographisches Institut der Humboldt-Universität zu Berlin Understanding Functions Image in Number out Band Statistics functions take an input image, calculate an image-wise statistic, and return a scalar number. Geographisches Institut der Humboldt-Universität zu Berlin Usage Examples Masking an Image image*mask Geographisches Institut der Humboldt-Universität zu Berlin Usage Examples Extracting Class-Specific Regions image*(class eq 1) Geographisches Institut der Humboldt-Universität zu Berlin Usage Examples Scale Image Profiles between -10 and 10 float(image-spectralMinimum(image)) / spectralSpan(image) *20-10 Geographisches Institut der Humboldt-Universität zu Berlin Usage Examples Scale Image Bands between -10 and 10 float(image-spatialMinimum(image)) /spatialSpan(image) *20-10' Geographisches Institut der Humboldt-Universität zu Berlin Usage Examples Spectral Similarity (root mean squared error) sqrt(spectralMean((image-profile)^2.)) Geographisches Institut der Humboldt-Universität zu Berlin Thank you very much for your attention. Any questions? 19