本文整理汇总了C++中ofShortPixels::getPixels方法的典型用法代码示例。如果您正苦于以下问题:C++ ofShortPixels::getPixels方法的具体用法?C++ ofShortPixels::getPixels怎么用?C++ ofShortPixels::getPixels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofShortPixels
的用法示例。
在下文中一共展示了ofShortPixels::getPixels方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateDepthImage
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();
}
示例2: drawPointcloud
void ofxRGBDCaptureGui::drawPointcloud(ofShortPixels& pix, bool fullscreen){
glEnable(GL_DEPTH_TEST);
ofMesh mesh;
ofRectangle rect = fullscreen ? ofRectangle(0,0, ofGetWidth(), ofGetHeight()) : previewRect;
//glEnable(GL_POINT_SMOOTH);
//glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB); // allows per-point size
glPointSize(2);
for(int y = 0; y < 480; y++){
for(int x = 0; x < 640; x++){
//0.104200 ref dist 120.000000
double ref_pix_size = 0.104200;
double ref_distance = 120.000000;
double wz = pix.getPixels()[y*640+x];
double factor = 2 * ref_pix_size * wz / ref_distance;
double wx = (double)(x - 640/2) * factor;
double wy = (double)(y - 480/2) * factor;
mesh.addVertex(ofVec3f(wx,-wy,-wz));
}
}
cam.begin(rect);
mesh.drawVertices();
cam.end();
glDisable(GL_DEPTH_TEST);
}
示例3: readToPixels
//----------------------------------------------------------
void ofTexture::readToPixels(ofShortPixels & pixels){
#ifndef TARGET_OPENGLES
pixels.allocate(texData.width,texData.height,ofGetImageTypeFromGLType(texData.glTypeInternal));
bind();
glGetTexImage(texData.textureTarget,0,ofGetGlFormat(pixels),GL_UNSIGNED_SHORT,pixels.getPixels());
unbind();
#endif
}
示例4: readToPixels
void ofFbo::readToPixels(ofShortPixels & pixels, int attachmentPoint){
if(!bIsAllocated) return;
#ifndef TARGET_OPENGLES
getTextureReference(attachmentPoint).readToPixels(pixels);
#else
pixels.allocate(settings.width,settings.height,ofGetImageTypeFromGLType(settings.internalformat));
bind();
int format = ofGetGLFormatFromInternal(settings.internalformat);
glReadPixels(0,0,settings.width, settings.height, format, GL_UNSIGNED_SHORT, pixels.getPixels());
unbind();
#endif
}
示例5:
void ofxDepthImageCompressor::convertTo8BitImage(ofShortPixels& pix, ofImage& image){
convertTo8BitImage(pix.getPixels(), image);
}
示例6: readCompressedPng
void ofxDepthImageCompressor::readCompressedPng(string filename, ofShortPixels& pix){
if(!pix.isAllocated()){
pix.allocate(640, 480, 1);
}
readCompressedPng(filename, pix.getPixels());
}
示例7: loadData
//----------------------------------------------------------
void ofTexture::loadData(const ofShortPixels & pix, int glFormat){
ofSetPixelStorei(pix.getWidth(),pix.getBytesPerChannel(),ofGetNumChannelsFromGLFormat(glFormat));
loadData(pix.getPixels(), pix.getWidth(), pix.getHeight(), glFormat, ofGetGlType(pix));
}
示例8: addImage
bool ofxDepthImageRecorder::addImage(ofShortPixels& image){
return addImage(image.getPixels());
}
示例9: loadData
//----------------------------------------------------------
void ofTexture::loadData(const ofShortPixels & pix){
loadData(pix.getPixels(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix));
}