depth

color depth reduction with opencv and LUT

狂风中的少年 提交于 2019-12-03 07:31:38
I'd like to perform a color reduction via color depth scaling. Like this example: the first image is CGA resolution, the second is EGA, the third is HAM. I'd like to do it with cv::LUT because i think it is the betterway to do it. I can do with greyscale with this code: Mat img = imread("test1.jpg", 0); uchar* p; Mat lookUpTable(1, 256, CV_8U); p = lookUpTable.data; for( int i = 0; i < 256; ++i) p[i] = 16 * (i/16) LUT(img, lookUpTable, reduced); original: color reduced: but if i try to do it with color I get strange result.. with this code: imgColor = imread("test1.jpg"); Mat reducedColor; int

树上三点间距离

这一生的挚爱 提交于 2019-12-03 07:29:21
P4281 [AHOI2008]紧急集合 / 聚会 这道题很卡常 但用一些优化 可过 问题 求一点到 三个不同点的距离最小 输出这个点 和这个距离 #define sum(a,b,c) (depth[a] + depth[b] + depth[c]) t,ab = lca(a,b),ac = lca(a,c),bc = lca(b,c); if(ab == ac) t = bc; if(ab == bc) t = ac; if(ac == bc) t = ab; printf("%d %d\n",t,sum(a,b,c) - sum(ab,ac,bc)); 感性理解下 倍增的一些优化 for(reg i = 1;i <= n;i++) lg[i] = lg[i - 1] + (1 << lg[i - 1] == i); inline int lca(int a,int b) { if(depth[a] < depth[b]) swap(a,b); while(depth[a] > depth[b]) a = fa[a][lg[depth[a] - depth[b]] - 1]; if(a == b) return a; for(reg i = lg[depth[a]];i >= 0;i--) if(fa[a][i] != fa[b][i]) a = fa[a][i],b = fa

What is the maximum depth of HTML documents in practice?

╄→尐↘猪︶ㄣ 提交于 2019-12-03 05:38:06
I want to allow embedding of HTML but avoid DoS due to deeply nested HTML documents that crash some browsers. I'd like to be able to accommodate 99.9% of documents, but reject those that nest too deeply. Two closely related question: What document depth limits are built into browsers? E.g. browser X fails to parse or does not build documents with depth > some limit. Are document depth statistics for documents available on the web? Is there a site with web statistics that explains that some percentage of real documents on the web have document depths less than some value. Document depth is

Pandas interpolate data with units

匿名 (未验证) 提交于 2019-12-03 03:10:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hi Everyone, I've been looking to Stackoverflow for couple of years, and it helped me a lot, so much that I never have to register before :) But today I'm stuck on a problem using Python with Pandas and Quantities (could be unum or pint as well). I try to do my best to make a clear post, but since it's my first one, I apologize if something is confusing and will try to correct any mistake you'll find :) I want to import data from a source and build a Pandas dataframe as follow: import pandas as pd import quantities as pq depth = [0.0,1.1,2.0

How to control depth on custom Spring Data Neo4j repository methods?

匿名 (未验证) 提交于 2019-12-03 03:10:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: For example, if I want to get list of users by name: class UserRepository extands GraphRepository<User> { List<User> findByName(String name); } then how to set loading depth to 2? I tried to find answer in the SDN 4.0.0.RC2 docs , but it isn't contains anything about this issue. 回答1: Derived finders do not yet support a depth. You'll have to write a custom query or use the loadAllByProperty method on the Neo4jTemplate if applicable. This should have been mentioned in the docs, we'll add it. 回答2: As of SDN 4.2.0-M1 , this feature has been

Tic Tac Toe and Minimax - Creating an imperfect AI on a microcontroller

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have created a Tic-Tac-Toe game on a microcontroller, including a perfect AI (perfect meaning that it doesn't lose). I did not use a minimax algorithm for that, just a little state machine with all possible and optimal moves. My problem now is that I wanted to implement different difficulties (Easy, Medium and Hard). The AI so far would be the hard one. So I've thought about how to do this the best way and ended up wanting to use the minimax algorithm but in a way that it calculates all the scores for all game positions so that I can also

How to print list using hierarchical data structure?

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I run this code: foreach ($tree as $node) { echo str_repeat(' ', $node->tree_depth * 4) . $node->id . PHP_EOL; } I get well formatted text like: Food Fruit Red Cherry Strawberry Cool Not cool Yellow Banana Meat Beef Pork But I want to create a list with <ul><li>... : I tried with: echo '<ul>'; $prev_depth = 0; foreach($table->fetchTree() as $row) { if ($row->tree_depth > $prev_depth) { echo '<li><ul>'; } else if ($row->tree_depth < $prev_depth) { echo '</li></ul>'; } echo '<li>' . $row->name . '</li>'; $prev_depth = $row->tree_depth; }

How to align RGB and Depth image from Kinect in Matlab

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to align RGB and Depth image from Kinect using Matlab. I am trying to do it using the algorithm from this page. Here is the code I have written so far depth = imread('depth_00500.png'); color = imread('rgb_00500.png'); rotationMat=[9.9984628826577793e-01 1.2635359098409581e-03 -1.7487233004436643e-02; -1.4779096108364480e-03 9.9992385683542895e-01 -1.2251380107679535e-02; 1.7470421412464927e-02 1.2275341476520762e-02 9.9977202419716948e-01 ]; translationMat=[1.9985242312092553e-02, -7.4423738761617583e-04, -1.0916736334336222e-02

Z-fighting solutions in depth test in OpenGL - how do they work?

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Description I've had major problems with Z-Fighting in OpenGL and I've spent quite some time finding solutions for this problem. Some of the ones I've found and I understand and didn't like: Moving polygons away from each other ( like glPolygonOffset in OpenGL ) Dividing the scene according to Z coordinate and drawing parts of the scene with separate clean z-buffers. The ones I don't understand: Using Projection Matrix https://software.intel.com/en-us/articles/alternatives-to-using-z-bias-to-fix-z-fighting-issues Using "Logarithmic Depth

Create depth buffer histogram texture with GLSL

匿名 (未验证) 提交于 2019-12-03 02:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using the depth buffer of the current context to influence a texture I am displaying. The texture is 1 dimensional and in grayscale. From left to right represents from near to far. The more pixels are at a certain depth the brighter the texture is at that point with black being no pixels are at that depth and white being all pixels are at that depth. Now I have a solution that does glReadPixels() on the depth-buffer, analyzes it on the CPU and then writes it back to the texture. Naturally this is a real bottleneck in the application. I'm