public static void regionsColor( GrayS32 pixelToRegion ,
									 FastQueue<float[]> segmentColor ,
									 Bitmap output , byte[] storage ) {
		if( storage == null )
			storage = declareStorage(output,null);

		int indexOut = 0;
		for( int y = 0; y < pixelToRegion.height; y++ ) {
			for( int x = 0; x < pixelToRegion.width; x++ ) {
				int index = pixelToRegion.unsafe_get(x,y);
				float []cv = segmentColor.get(index);

				int r,g,b;

				if( cv.length == 3 ) {
					r = (int)cv[0];
					g = (int)cv[1];
					b = (int)cv[2];
				} else {
					r = g = b = (int)cv[0];
				}

				storage[indexOut++] = (byte)r;
				storage[indexOut++] = (byte)g;
				storage[indexOut++] = (byte)b;
				storage[indexOut++] = (byte)0xFF;
			}
		}

		output.copyPixelsFromBuffer(ByteBuffer.wrap(storage));
	}
public static void regionsColor ( GrayS32 pixelToRegion , FastQueue < float [ ] > segmentColor , Bitmap output , byte [ ] storage ) { if ( storage == null ) storage = declareStorage ( output , null ) ; int indexOut = 0 ; for ( int y = 0 ; y < pixelToRegion . height ; y ++ ) { for ( int x = 0 ; x < pixelToRegion . width ; x ++ ) { int index = pixelToRegion . unsafe_get ( x , y ) ; float [ ] cv = segmentColor . get ( index ) ; int r , g , b ; if ( cv . length == 3 ) { r = ( int ) cv [ 0 ] ; g = ( int ) cv [ 1 ] ; b = ( int ) cv [ 2 ] ; } else { r = g = b = ( int ) cv [ 0 ] ; } storage [ indexOut ++ ] = ( byte ) r ; storage [ indexOut ++ ] = ( byte ) g ; storage [ indexOut ++ ] = ( byte ) b ; storage [ indexOut ++ ] = ( byte ) 0xFF ; } } output . copyPixelsFromBuffer ( ByteBuffer . wrap ( storage ) ) ; }
Draws each region using the provided color
@param pixelToRegion Conversion from pixel to region
@param segmentColor Color of each region
@param output Where the output is written to
@param storage Optional working buffer for Bitmap image. Can be null.