public void calcBwRatio(RegionInfo r) {
		int idx = 0;
		int blk = 0;
		int wht = 0;
		boolean inRegion = false;
		
		for (int row = r.minY; row <= r.maxY; row++) {
			inRegion = false;
			for (int col = r.minX; col <= r.maxX; col++) {
				idx = row*this.width + col;
				//System.out.println(r.marker + ":" + (this.pixels[idx*3] & 0xff));
				if ((this.pixels[idx*3] & 0xff) == r.marker) {
					inRegion = true;
					wht++;
				}
				else {
					if ((this.pixels[idx*3] & 0xff) > 0 && (this.pixels[idx*3] & 0xff) != r.marker) {
						inRegion = false;
					}
					if (inRegion && (this.pixels[idx*3] & 0xff) == 0) {
						blk++;
					}
				}
			}
		}
		r.bpRatio = (wht + blk > 0 ? (float)blk / (float)(wht + blk) : -1);
	}