java - Multi-Band Image raster to RGB -
java - Multi-Band Image raster to RGB -
i have image dataset multiband dataset of arff format. looks this:
8.3000000e+001 9.3000000e+001 9.6000000e+001 7.5000000e+001 1.0000000e+000 8.3000000e+001 9.3000000e+001 9.6000000e+001 7.5000000e+001 1.0000000e+000 8.3000000e+001 9.3000000e+001 9.6000000e+001 7.5000000e+001 1.0000000e+000 8.3000000e+001 9.3000000e+001 9.6000000e+001 7.5000000e+001 1.0000000e+000 7.4000000e+001 8.4000000e+001 8.6000000e+001 7.1000000e+001 1.0000000e+000 7.4000000e+001 8.4000000e+001 8.6000000e+001 7.1000000e+001 1.0000000e+000 7.4000000e+001 8.4000000e+001 8.6000000e+001 7.1000000e+001 1.0000000e+000 7.4000000e+001 8.4000000e+001 8.6000000e+001 7.1000000e+001 1.0000000e+000
the first 4 attributes specify multiband values of pixel , lastly attribute specifies class label. possible convert rgb format? have java code classify image based on rgb values.
if right reply yes clarification how see it:
you got 4 bands intensities you need rgb color value it last number not related color in way ignore itwhat need know
if intensity linear or not , if nonlinear how convert linear scale you need know wavelength or rgb color each band usedhow convert
take each rgb of band , multiply linear intensity sum of them togethercolor_rgb = band0_rgb*band0_intensity+...+band3_rgb*band3_intensity
how usable rgb of band wavelength
obtain color of lite of wavelength rgb values of visible spectrum rescale color if add together bands same intensity you white colori using evenly distributed bands through visible spectrum multi spectral rendering , how in c++:
//--------------------------------------------------------------------------- //--- multi band rendering -------------------------------------------------- //--------------------------------------------------------------------------- const int _bands=10; // number of bands used double _band_rgb[_bands][3]; // rgb of each band white bias correction double _band_wavelength[_bands]; // wavelength of each band //--------------------------------------------------------------------------- void wavelength2rgb(double *rgb,double lambda) // rgb <0,1> <- lambda <400e-9,700e-9> [m] { double r=0.0,g=0.0,b=0.0,t; if ((lambda>=400.0e-9)&&(lambda<410.0e-9)) { t=(lambda-400.0e-9)/(410.0e-9-400.0e-9); r= +(0.33*t)-(0.20*t*t); } else if ((lambda>=410.0e-9)&&(lambda<475.0e-9)) { t=(lambda-410.0e-9)/(475.0e-9-410.0e-9); r=0.14 -(0.13*t*t); } else if ((lambda>=545.0e-9)&&(lambda<595.0e-9)) { t=(lambda-545.0e-9)/(595.0e-9-545.0e-9); r= +(1.98*t)-( t*t); } else if ((lambda>=595.0e-9)&&(lambda<650.0e-9)) { t=(lambda-595.0e-9)/(650.0e-9-595.0e-9); r=0.98+(0.06*t)-(0.40*t*t); } else if ((lambda>=650.0e-9)&&(lambda<700.0e-9)) { t=(lambda-650.0e-9)/(700.0e-9-650.0e-9); r=0.65-(0.84*t)+(0.20*t*t); } if ((lambda>=415.0e-9)&&(lambda<475.0e-9)) { t=(lambda-415.0e-9)/(475.0e-9-415.0e-9); g= +(0.80*t*t); } else if ((lambda>=475.0e-9)&&(lambda<590.0e-9)) { t=(lambda-475.0e-9)/(590.0e-9-475.0e-9); g=0.8 +(0.76*t)-(0.80*t*t); } else if ((lambda>=585.0e-9)&&(lambda<639.0e-9)) { t=(lambda-585.0e-9)/(639.0e-9-585.0e-9); g=0.84-(0.84*t) ; } if ((lambda>=400.0e-9)&&(lambda<475.0e-9)) { t=(lambda-400.0e-9)/(475.0e-9-400.0e-9); b= +(2.20*t)-(1.50*t*t); } else if ((lambda>=475.0e-9)&&(lambda<560.0e-9)) { t=(lambda-475.0e-9)/(560.0e-9-475.0e-9); b=0.7 -( t)+(0.30*t*t); } rgb[0]=r; rgb[1]=g; rgb[2]=b; } //--------------------------------------------------------------------------- double wavelength2int(double lambda) // white bias correction intensity <0,1+> <- lambda <400e-9,700e-9> [m] { // mine empirically deduced equation , works evenly distributed bands const double a0= 8.50/double(_swcolorwavelengths);// 3-5 bands low bias, >5 no visible bias nowadays const double a1=-27.37/double(_swcolorwavelengths); const double a2=+26.35/double(_swcolorwavelengths); double t=divide(lambda-400e-9,700e-9-400e-9); homecoming (a0)+(a1*t)+(a2*t*t); } //--------------------------------------------------------------------------- void init_multiband_colors() // init evenly distributed bands through visible spectrum range { double l,dl; int ix; l=405e-9; dl=695e-9; dl=divide(dl-l,_bands); l+=0.5*dl; (ix=_bands-1;ix>=0;ix--,l+=dl) // init colors , wavelengths (multispectral rendering) { _band_wavelength[ix]=l; wavelength2rgb(_band_rgb[ix],l); _band_rgb[ix][0]*=wavelength2int(l); // white bias removal _band_rgb[ix][1]*=wavelength2int(l); _band_rgb[ix][2]*=wavelength2int(l); } } //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //---------------------------------------------------------------------------
this how looks like:
first line shows number , color of used bands second part of rendered image in white color using multi spectral rendering can see little white bias there. create formula close white can number of bands used(>=3)
. thought if have white noise (all frequencies same intensity) got white color. when add together bands colors used should have white color. empirically experimented scaling colors function of wavelength , came ... if bands not evenly distributed
then need integrate evenly distributed bands cover example:
set colors 100 bands divide them 4 bands groups integrate each grouping obtain band color scale integrated band colors mutual usable scale/=100
check white bias java image-processing rgb arff
Comments
Post a Comment