Exemplo n.º 1
0
void ofxRGBDCaptureGui::updateDepthImage(ofShortPixels& pixels){
    
    if(!pixels.isAllocated()){
        return;
    }
    
    int max_depth = depthImageProvider->maxDepth();    
    if(max_depth == 0){
    	max_depth = 5000;
    }
//    cout << "updating depth image with max depth of " << max_depth << " render: " << (currentRenderMode == RenderRainbow ? "rainbow" : "b&w") <<  endl;
    if(currentRenderMode == RenderRainbow){
        for(int i = 0; i < 640*480; i++){
            int lookup = pixels.getPixels()[i] / (max_depth / 256);
            //int lookup = ofMap( depthPixels.getPixels()[i], 0, max_depth, 0, 255, true);
            depthImage.getPixels()[(i*3)+0] = LUTR[lookup];
            depthImage.getPixels()[(i*3)+1] = LUTG[lookup];
            depthImage.getPixels()[(i*3)+2] = LUTB[lookup];
        }
    }
    else{
        recorder.compressorRef().convertTo8BitImage(pixels, depthImage);
    }
    
    depthImage.update();
	
}
void ofxDepthImageCompressor::readCompressedPng(string filename, ofShortPixels& pix){
	if(!pix.isAllocated()){
		pix.allocate(640, 480, 1);
	}
	readCompressedPng(filename, pix.getPixels());
}