depth

二叉树节点间的最大距离问题

ぐ巨炮叔叔 提交于 2019-12-17 02:08:19
二叉树节点间的最大距离问题 求二叉树两节点间的最大距离(可能过根节点,也可能不过),LeetCode 543 思路 最大距离可能来自三种情况: 根节点左子树上的最大距离 根节点右子树上的最大距离 左孩子最大深度ldepth,到根节点,到右孩子最大深度rdepth 实现1 def max_distance ( self ) : def post_order ( node ) : if node is None : record [ 0 ] = 0 return 0 lmax = post_order ( node . left ) max_from_left = record [ 0 ] rmax = post_order ( node . right ) max_from_right = record [ 0 ] cur_max = max_from_left + max_from_right + 1 record [ 0 ] = max ( max_from_left , max_from_right ) + 1 return max ( max ( lmax , rmax ) , cur_max ) if not self . root : return 0 record = [ 0 ] return post_order ( self . root ) - 1 实现2 def

保存多张对应的映射图像(深度图像同理)和彩色图像

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 16:14:24
#include <opencv2\opencv.hpp> #include<iostream> #include <Windows.h> #include "NuiApi.h" #include<cv.h> #include <d3d11.h> #include<cv.h> #include<cxcore.h> #include<highgui.h> using namespace std; using namespace cv; //最远距离(mm) const int MAX_DISTANCE = 3500; //最近距离(mm) const int MIN_DISTANCE = 200; const LONG m_depthWidth = 640; const LONG m_depthHeight = 480; const LONG m_colorWidth = 640; const LONG m_colorHeight = 480; const LONG cBytesPerPixel = 4; //像素位数 //计算内存大小 int main() { //彩色图像 Mat image_rgb; //深度图像 Mat image_depth; int m=1; //创建一个MAT image_rgb.create(480,640,CV_8UC3); image_depth

基于kinect1的RGB和depth数据获取并对齐

旧城冷巷雨未停 提交于 2019-12-13 15:49:52
在vs2010项目中,需要设置属性管理器-属性-VC++目录 包含目录中加入 $(KINECTSDK10_DIR)\inc; 库目录中加入 $(KINECTSDK10_DIR)\lib\x86 KINECTSDK10_DIR为Kinect所安装的路径 在链接器中设置附加依赖项,填入Kinect10.lib 对应的.dll 文件复制到 C:\Windows\SysWOW64 #include <opencv2\opencv.hpp> #include<iostream> #include <Windows.h> #include "NuiApi.h" #include<cv.h> #include <d3d11.h> using namespace std; using namespace cv; //最远距离(mm) const int MAX_DISTANCE = 3500; //最近距离(mm) const int MIN_DISTANCE = 200; const LONG m_depthWidth = 640; const LONG m_depthHeight = 480; const LONG m_colorWidth = 640; const LONG m_colorHeight = 480; const LONG cBytesPerPixel = 4; int

finding maximum depth of chapter

大憨熊 提交于 2019-12-13 15:24:04
问题 everyone . In this case ,I want to conpute the maxximun depth of the chapter.For instance, a book without chapters has height 0 . A book only has chapters with no sections ,the height should be 1.The folowing is xml: <book title="D"> <author> <name>abc</name> </author> <chapter title="chapter1"> <section title="section1.1"/> <section title="section1.2"> <section title="section1.2.1"/> <section title="section1.2.2"/> </section> <section title="section1.3"> <section title="section1.3.1"/> <

opengl depth buffer slow when points have same depth

我只是一个虾纸丫 提交于 2019-12-13 15:09:20
问题 I'm making a 2d game involving drawing huge numbers of overlapping quads to the screen. What goes in front of what doesn't really matter. If I draw each of my quads with z values from 0 upwards and have glDepthFunc(GL_LESS) set I get quite a nice speed boost as you would expect. This is to avoid having to draw quads which are either totally hidden or partially hidden behind other quads. So I draw the quads using something like: float small = (float(1)/1000000); for (int iii = 0; iii < 100000;

How to find the depth of an unlimited depthed array [duplicate]

狂风中的少年 提交于 2019-12-13 09:46:25
问题 This question already has answers here : Is there a way to find out how “deep” a PHP array is? (18 answers) Closed 6 years ago . I am trying to find out the depth of a multi dimension array. The array is unlimited one (depth). I would like to find out the maximum depth of the array. Please see the array structure below Array ( [0] => Array ( [id] => 27 [cata_key] => 55437c82626479a7b8554532 [cata_name] => Road [app_key] => 3bb4f64af3d25034f0ae35bb [parentid] => 0 [subcategories] => Array ( [0

Trim the tree at the specified depth. In Prolog

微笑、不失礼 提交于 2019-12-13 08:21:58
问题 Arguments: arbitrary binary tree; necessary depth; result tree. Result: ?- pred(s(f(b(m,k),a),t(a,g)),2,X). X = s(f,t) yes ?- pred(s(f(b(m,k),a),t(a,g)),3,X). X = s(f(b,a),t(a,g)) yes ?- Can someone help me with it? 回答1: Let's rearrange your examples: ?- pred( s( f(b(m,k),a), t(a,g)), 3, X). X = s(f(b,a),t(a,g)) yes ?- pred( s( f(b(m,k),a), t(a,g)), 2, X). X = s(f,t) yes ?- pred( s( f(b(m,k),a), t(a,g)), 1, X). X = s yes ?- pred( s( f(b(m,k),a), t(a,g)), 0, X). no Now it's clear what needs to

parent-child depth will change in actionscript

烈酒焚心 提交于 2019-12-13 08:17:31
问题 Please have a look at this project, in this project I have two symbol, one of them create and add another symbol as child. Child symbol is drawn over parent as I expected. Parent symbol has two frames. When parent goes to second frame, child symbol drawn under parent. I mean depth order will change. Can somebody help me!!?? Sorry for poor language. Download link: https://drive.google.com/file/d/0B-KCX3wxRH-cOUk5YU1OUzNFN3M/view?usp=sharing 回答1: Yellow shape from the frame 1 move to the new

python multithread “maximum recursion depth exceed”

狂风中的少年 提交于 2019-12-12 11:23:37
问题 I use Python multithread to realize Quicksort. Quicksort is implement in a function. It is a recursive function. Each thread calls Quicksort to sort the array it has. Each thread has its own array that stores the numbers needs to be sorted. If the array size is smaller (<10,000). It runs ok. However, if the array size is larger, it shows the "maximum recursion depth exceed". So, I use setrecursionlimit () function to reset the recursion depth to 1500. But the program crash directly... The