depth

What is the average asymptotic depth of a simple unbalanced search tree?

*爱你&永不变心* 提交于 2019-12-06 03:16:06
For a balanced search tree, it is O(log(N)) for all cases. For unbalanced search trees, the worst case is O(N), e.g., insert 1, 2, 3, 4,.. and best case complexity is when it is balanced, e.g., insert 6, 4, 8, 3, 5 7. How do we define the average case complexity for unbalanced search tree? The average height of Binary Trees is Theta(sqrt(n)). This has been shown (or referenced, not very sure) in the following paper: http://www.dtc.umn.edu/~odlyzko/doc/arch/extreme.heights.pdf . But perhaps you are more interested in the average depth of a random node and this is Theta(log n), as can be seen

How to get the position (x,y) from a Kinect depth array?

你离开我真会死。 提交于 2019-12-05 22:12:32
While working with the kinect I found out, that the bitmap and its depth information are unreliable and for some reason much more disturbed than the data from the actual byte array. I realised this when I tried get the min and max by accessing the bitmap like this for (var y = 0; y < height; y++) { var heightOffset = y * width; for (var x = 0; x < width; x++) { var index = ((width - x - 1) + heightOffset) * 4; var distance = GetDistance(depth[depthIndex], depth[depthIndex + 1]); But on the other hand I achieved much better results when I directly accessed the depth byte array (as a

Why is openGL glDepthFunc() not working?

不羁的心 提交于 2019-12-05 19:05:41
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 of glDepthFunc but it also didnt help me. So, any ideas?? Thanks a lot This is perfectly valid behavior

How to copy depth buffer to a texture on the GPU?

ε祈祈猫儿з 提交于 2019-12-05 18:21:22
问题 I want to get the current depth buffer to a texture, to access it in a shader. For various reasons I can't do a separate depth pass, but would need to copy the already-rendered depth. glReadPixels would involve the CPU and potentially kill performance, and as far as I know glBlitFramebuffer can't blit depth-to-color, only depth-to-depth. How to do this on the GPU? 回答1: The modern way of doing this would be to use a FBO. Attach a color and depth texture to it, render, then disable the FBO and

How to write to the OpenGL Depth Buffer

馋奶兔 提交于 2019-12-05 12:22:10
I'm trying to implement an old-school technique where a rendered background image AND preset depth information is used to occlude other objects in the scene. So for instance if you have a picture of a room with some wires hanging from the ceiling in the foreground, these are given a shallow depth value in the depthmap, and when rendered correctly, allows the character to walk "behind" the wires but in front of other objects in the room. So far I've tried creating a depth texture using: glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, Image.GetWidth(), Image.GetHeight(), 0, GL_DEPTH_COMPONENT

Recording/playback Kinect with Matlab - upside down and in black/white rather than gray scale

老子叫甜甜 提交于 2019-12-05 09:27:13
问题 I am trying to write a program to record and playback both colour and depth streams from a xbox kinect to ease testing image processing programs. Currently I have the bulk done and the colour stream works fine. I am however having trouble with the depth stream. Currently, the depth stream is playing back upside down and only in black and white. I have 3 thoughts as to why this may be the case: 1) The conversion to 8-bit from 11-bit 2) the Motion JPEG 2000 format (never used this before) 3)

Android: Save Bitmap object as a bmp (1bpp) file format

落花浮王杯 提交于 2019-12-05 03:57:00
问题 Based on this question asked by @ben75: Android : save a Bitmap to bmp file format My question now is: How can I have a BMP image with the depth of 1 bit per pixel (Black & White)? 回答1: Answering my own question... After some tough search all over the web I realized I had to create 2 things: a bitmap black and white - and did that using the approach of making all 0's for colors below 128 and 255's for the rest, like this (this is C# code, as I'm using Xamarin to code my app): private void

OpenGL - don't write depth if alpha

孤人 提交于 2019-12-04 19:13:05
What I'm want to do in OpenGL using C++ and GLSL: When texture has alpha (texture.a! = 1.0;) then this pixel is not written to the depth buffer. (for color buffer it is written) Write depth occurs only when a pixel texture.a == 1.0; Discarding in shader is not a solution - then this pixel is not written to color buffer. Any ideas? @UPDATE: Example: I've got some UI images rendered by OpenGL. Some of them have alpha in corners. In scene rendering I have "depth prepass" to save some pixels by not calculating light on them. I want to also get UI images to that prepass - but only completely opaque

求树的深度

旧城冷巷雨未停 提交于 2019-12-04 16:34:33
#include<iostream> using namespace std; typedef struct BiNode{ char data; struct BiNode *lchild,*rchild; }BiTNode,*BiTree; void CreateBiTree(BiTree &T){ char ch; cin >> ch; if(ch=='#') T=NULL; else{ T=new BiTNode; T->data=ch; CreateBiTree(T->lchild); CreateBiTree(T->rchild); } } int Depth(BiTree T){ int m,n; if(T==NULL) retue 0; else{ m=Depth(T->lchild); n=Depth(T->rchild); if(m>n) return(m+1); else{ return (n+1); } } } void main(){ BiTree tree; cout<<"please input:\n"; CreateBiTree(tree); cout<<"deepth is:"<<Depth(tree)<<endl; } 来源: https://www.cnblogs.com/ygjzs/p/11874585.html

iterative closest point library

回眸只為那壹抹淺笑 提交于 2019-12-04 15:13:13
is there any c++/c open source implementation? i got two point clouds and would like to match them.. any ideas? Give LibICP a shot, although I personally have not used it so far. http://www.cvlibs.net/software/libicp.html EDIT: I tried it by myself, not a great experience -- the library is short of documentation and example code. Also, I didn't receive much help from the authors too. I wrote a article about accelerated line search on ddj.com some time ago. I dont exactly understand what you want to do but the approach shown there divides the whole area into "quadrants" of a given search width.