depth

Depth as distance to camera plane in GLSL

亡梦爱人 提交于 2019-11-27 01:42:01
问题 I have a pair of GLSL shaders that give me the depth map of the objects in my scene. What I get now is the distance from each pixel to the camera. What I need is to get the distance from the pixel to the camera plane. Let me illustrate with a little drawing * |--* / | / | C-----* C-----* \ | \ | * |--* The 3 asterisks are pixels and the C is the camera. The lines from the asterisks are the "depth". In the first case, I get the distance from the pixel to the camera. In the second, I wish to

Python: maximum recursion depth exceeded while calling a Python object

旧城冷巷雨未停 提交于 2019-11-26 22:47:40
问题 I've built a crawler that had to run on about 5M pages (by increasing the url ID) and then parses the pages which contain the info' I need. after using an algorithm which run on the urls (200K) and saved the good and bad results I found that the I'm wasting a lot of time. I could see that there are a a few returning subtrahends which I can use to check the next valid url. you can see the subtrahends quite fast (a little ex' of the few first "good IDs") - 510000011 # +8 510000029 # +18

平衡二叉树-python

谁都会走 提交于 2019-11-26 19:27:39
思路:平衡二叉树的左右子树的深度相差不能超过1, 因此可以利用上一题求二叉树的深度的函数,对左右子树求最大深度,如果深度小于1,那么就是平衡二叉树了 # -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def IsBalanced_Solution(self, pRoot): # write code here if not pRoot: return True if abs(self.max_depth(pRoot.left) - self.max_depth(pRoot.right)) > 1: return False return self.IsBalanced_Solution(pRoot.left) and self.IsBalanced_Solution(pRoot.right) def max_depth(self, pRoot): if not pRoot: return 0 return max(self.max_depth(pRoot.left), self.max_depth(pRoot.right)) + 1 来源: https://www

Unexpected ConvertTo-Json results? Answer: it has a default -Depth of 2

一曲冷凌霜 提交于 2019-11-26 19:11:41
Why do I get unexpected ConvertTo-Json results? And why does a round-trip ( $Json | ConvertFrom-Json | ConvertTo-Json ) fail? Meta issue Stackoverflow has a good mechanism to prevent duplicate questions but as far as I can see there is no mechanism to prevent questions that have a duplicate cause . Take this question as a an example: almost every week a new question comes in with the same cause, yet it is often difficult to define it as a duplicate because the question itself is just a slightly different. Nevertheless, I wouldn't be surprised if this question/answer itself ends up as a

OpenCV: How to visualize a depth image

亡梦爱人 提交于 2019-11-26 18:59:39
问题 I am using a dataset in which it has images where each pixel is a 16 bit unsigned int storing the depth value of that pixel in mm. I am trying to visualize this as a greyscale depth image by doing the following: cv::Mat depthImage; depthImage = cv::imread("coffee_mug_1_1_1_depthcrop.png", CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR ); // Read the file depthImage.convertTo(depthImage, CV_32F); // convert the image data to float type namedWindow("window"); float max = 0; for(int i = 0; i <

Kinect raw depth to distance in meters

∥☆過路亽.° 提交于 2019-11-26 14:39:29
问题 I am trying to convert Kinect depth map to distance in meters. The problem is that for depthmap value '1080' and around it, distance is too large because the term in denominator becomes very close to '0'. and for values above '1090', distance is negative. if (depthValue < 2047) { depthM = 1.0 / (depthValue*-0.0030711016 + 3.3309495161); } 回答1: The correct answer is actually a comment on your question. The number given is actually a distance in millimetres. To get this number, you either need

Three.js / WebGL - transparent planes hiding other planes behind them

北城余情 提交于 2019-11-26 12:41:46
问题 When you have two planes in Three.js / WebGL and one or both of them are transparent, sometimes the plane behind will be hidden by the transparent plane above. Why is this? 回答1: This is not a bug, it's just how OpenGL (and, hence, WebGL) works. Transparent surfaces don't play well with the z-buffer, and as such must be manually sorted and rendered back-to-front. Three JS is attempting to do this for you (which is why the problem goes away when you set the X value > 0) but cannot robustly

LeetCode 104. Maximum Depth of Binary Tree

谁说胖子不能爱 提交于 2019-11-26 11:59:25
用递归的办法 思路1,从下往上累加 int maxDepth(TreeNode* root) { if(!root) return 0; return max(maxDepth(root->left), maxDepth(root->right))+1; } 思路2,从上往下累加 void helper(TreeNode* p, int dep, int& depth){ if(!p) return; depth=max(depth,dep+1); helper(p->left, dep+1, depth); helper(p->right, dep+1, depth); } int maxDepth(TreeNode* root) { int depth=0; helper(root, 0,depth); return depth; } 来源: https://www.cnblogs.com/leetcoder/p/11318876.html

Python: Maximum recursion depth exceeded

筅森魡賤 提交于 2019-11-26 10:27:42
I have the following recursion code, at each node I call sql query to get the nodes belong to the parent node. here is the error: Exception RuntimeError: 'maximum recursion depth exceeded' in <bound method DictCursor.__del__ of <MySQLdb.cursors.DictCursor object at 0x879768c>> ignored RuntimeError: maximum recursion depth exceeded while calling a Python object Exception AttributeError: "'DictCursor' object has no attribute 'connection'" in <bound method DictCursor.__del__ of <MySQLdb.cursors.DictCursor object at 0x879776c>> ignored Method that I call to get sql results: def returnCategoryQuery

二叉树的最小深度

我们两清 提交于 2019-11-26 10:16:32
给定一个二叉树,找出其最小深度。 最小深度是从根节点到最近叶子节点的最短路径上的节点数量。 说明: 叶子节点是指没有子节点的节点。 示例: 给定二叉树 [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 返回它的最小深度 2. class Solution { public int minDepth(TreeNode root) { if (root == null) { return 0; } if ((root.left == null) && (root.right == null)) { return 1; } int min_depth = Integer.MAX_VALUE; if (root.left != null) { min_depth = Math.min(minDepth(root.left), min_depth); } if (root.right != null) { min_depth = Math.min(minDepth(root.right), min_depth); } return min_depth + 1; } } 来源: https://blog.csdn.net/xiamaocheng/article/details/98779702