zbuffer

Reading .exr files in OpenCV

醉酒当歌 提交于 2021-01-04 04:18:30
问题 I have generated some depth maps using blender and have saved z-buffer values(32 bits) in OpenEXR format. Is there any way to access values from a .exr file (pixel by pixel depth info) using OpenCV 2.4.13 and python 2.7? There is no example anywhere to be found. All I can see in documentation that this file format is supported. But trying to read such a file results in error. new=cv2.imread("D:\\Test1\\0001.exr") cv2.imshow('exr',new) print new[0,0] Error: print new[0,0] TypeError: 'NoneType'

Reading .exr files in OpenCV

北城以北 提交于 2021-01-04 04:15:28
问题 I have generated some depth maps using blender and have saved z-buffer values(32 bits) in OpenEXR format. Is there any way to access values from a .exr file (pixel by pixel depth info) using OpenCV 2.4.13 and python 2.7? There is no example anywhere to be found. All I can see in documentation that this file format is supported. But trying to read such a file results in error. new=cv2.imread("D:\\Test1\\0001.exr") cv2.imshow('exr',new) print new[0,0] Error: print new[0,0] TypeError: 'NoneType'

What are good reasons to enable 2D projection with cocos2d-iphone?

﹥>﹥吖頭↗ 提交于 2019-12-30 09:58:12
问题 In cocos2d-iphone the default projection type is "3D" projection. But you can also set the projection to "2D" like so: [[CCDirector sharedDirector] setProjection:CCDirectorProjection2D]; Behind the scenes the 3D projection uses perspective projection whereas 2D projection is the OpenGL orthographic projection. The technical details about these two projection modes can be reviewed here, that's not what I'm interested in. What are the benefits and drawbacks of 2D projection for cocos2d users?

How to write to zbuffer only with three.js

老子叫甜甜 提交于 2019-12-24 13:45:03
问题 I'm trying to use thee.js to only update the zbuffer (I'm using preserveDrawingBuffer to create a trace effect). However I can't find any way to only write to the zbuffer with the standard materials, so far I've tried: setting the material's visible to false, which stops the object rendering. setting the material's opacity to 0.0, which means nothing gets rendered. Is there a 'standard' way of doing this, or do I need to use a custom fragment shader? 回答1: You can render to the depth buffer

Using OpenGL in Matlab to get depth buffer

半世苍凉 提交于 2019-12-17 15:38:34
问题 Ive asked a similar question before and didnt manage to find a direct answer. Could someone provide sample code for extracting the depth buffer of the rendering of an object into a figure in Matlab? So lets say I load an obj file or even just a simple surf call, render it and now want to get to its depth buffer then what code will do that for me using both Matlab and OpenGL. I.e. how do I set this up and then access the actual data? I essentially want to be able to use Matlabs powerful

in three.js, alpha channel works inconsistently

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 18:32:03
问题 I'm building a "paper cutout" world in three.js. All my models are simple "planes," and I texture them with PNGs that have alpha channels to trim the plane to a more pleasing shape. The strange thing: the transparency appears and disappears unpredictably, based on the position of the plane and the position of the camera. Symptom 1: if the plane is partially below the ground plane, transparency works, but if I move it above the ground plane the transparent area fills with white. Symptom 2:

MATLAB: blurry titles

人走茶凉 提交于 2019-12-08 14:02:18
问题 When the size of a plotted sparsity matrix is increased, the title (if typeset by TeX) is anomalously blurred. What is the basis of this effect and how can it be avoided? Example: spy(magic(2)); title('Text','interpreter','latex','FontSize',20); spy(magic(200)); title('Text','interpreter','latex','FontSize',20); 回答1: Related to (and actually the same issue as in) How to prevent LATEX-labels in MATLAB GUI to become blurry? The solution applies. After inputting: spy(magic(200)); title('Text',

Logarithmic depth buffer linearization

你。 提交于 2019-12-07 15:04:25
问题 How to linearize logarithmic depth buffer? visualization of linear depth buffer in fragment shader float n = 1.0; // camera z near float f = 27000000.0; // camera z far float z = texture( DepthTex, TexCoord ).x; float d = (2.0 * n) / (f + n - z * (f - n)); FragColor=vec4(d,d,d,1); sphere vertex shader vec4 ClipCoords(vec3 position,mat4 matrix) { vec4 clip = matrix * vec4(position,1.0f); clip.z =((2.0f * log(1.0f * clip.z + 1.0f) / log(1.0f * 27000000.0f + 1.0f)) - 1.0f) * clip.w; return clip;

Why is openGL glDepthFunc() not working?

纵然是瞬间 提交于 2019-12-07 09:33:37
问题 im playing with openGL and im trying to get rid of blue marked triangles. I use for it this code: glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glEnable(GL_CULL_FACE); And yes I use glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); in my main loop. I've read the problem can be projection matrix. I use these values: ProjectionMatrix = glm::perspective(45.5f, 4.0f / 3.0f, 0.1f, 100.0f); I was trying to change the near and far value but its still the same. I was also trying change parameter

How to get Z values from Z Buffer

ε祈祈猫儿з 提交于 2019-12-07 08:04:31
问题 I'm having problems with drawing in OpenGL and I need to see exactly what values are being placed in the depth buffer. Can anyone tell me how to retrieve these values? Thanks Chris 回答1: Use glReadPixels with format = GL_DEPTH_COMPONENT, for example: float depth; glReadPixels(0, 0, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth); Will get the depth of pixel (0, 0). 来源: https://stackoverflow.com/questions/4499999/how-to-get-z-values-from-z-buffer