|
TNTmips Downloads Menu

|
regress.sml
# regress.sml
# Computes coefficents of miltilinear regression equations on a set of rasters.
clear(); # clear the console
raster Rr, Rg, Rb;
class MATRIX h1;
h1 = CreateMatrix(3,4); # holds the results
# get three input rasters to do multiregression on
GetInputRaster(Rr); # get red input raster
if ( RastType(Rr) <> "8-bit unsigned" ) {
PopupMessage( "Only 8 bit unsigned types are supported." );
CloseRaster(Rr); # close it
}
GetInputRaster(Rg); # get green input raster
if ( RastType(Rg) <> "8-bit unsigned" ) {
PopupMessage( "Only 8 bit unsigned types are supported." );
CloseRaster(Rg); # close it
}
GetInputRaster(Rb); # get blue input raster
if ( RastType(Rb) <> "8-bit unsigned" ) {
PopupMessage( "Only 8 bit unsigned types are supported." );
CloseRaster(Rb); # close it
}
# do the multiregression - result in h1
MultiRegression(h1, Rr, Rg, Rb);
printf( "%s\n", "Multi-Regression Output" );
numeric r, c, a;
for r = 0 to 2 {
for c = 0 to 3 {
a = GetMatrixItem( h1, r, c );
printf( "%8.4f ", a );
}
printf( "\n" );
}
CloseRaster(Rr); # do clean up
CloseRaster(Rg);
CloseRaster(Rb);
DestroyMatrix(h1);
©MicroImages, Inc. 2013 Published in the United States of America
11th Floor - Sharp Tower, 206 South 13th Street, Lincoln NE 68508-2010 USA
Business & Sales: (402)477-9554 Support: (402)477-9562 Fax: (402)477-9559
Business info@microimages.com
Support support@microimages.com
Web webmaster@microimages.com
| |