[英]Count image similarity on GPU [OpenGL/OcclusionQuery]
OpenGL. OpenGL。 Let's say I've drawn one image and then the second one using XOR.
假设我已经绘制了一张图像,然后使用 XOR 绘制了第二张图像。 Now I've got black buffer with non-black pixels somewhere, I've read that I can use shaders to count black [ rgb(0,0,0) ] pixels ON GPU?
现在我在某处有一个带有非黑色像素的黑色缓冲区,我读到我可以使用着色器来计算 GPU 上的黑色 [ rgb(0,0,0) ] 像素?
I've also read that it has to do something with OcclusionQuery.我还读到它必须对 OcclusionQuery 做一些事情。 http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt
http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt
Is it possible and how?有可能吗? [any programming language]
[任何编程语言]
If you've got other idea on how to find similarity via OpenGL/GPU - that would be great too.如果您对如何通过 OpenGL/GPU 找到相似性有其他想法 - 那也很棒。
I'm not sure how you do the XOR bit (at least it should be slow; I don't think any of current GPUs accelerate that), but here's my idea:我不确定你是如何做 XOR 位的(至少它应该很慢;我认为当前的任何 GPU 都没有加速),但这是我的想法:
At first I though of a more complex approach that involves depth buffer, but then realized that just killing pixels should be enough.起初我想到了一种更复杂的方法,涉及深度缓冲,但后来意识到仅仅杀死像素就足够了。 Here's my original though (but the above one is simpler and more efficient):
这是我的原版(但上面的更简单,更有效):
Of course all this requires GPU with occlusion query support.当然,这一切都需要具有遮挡查询支持的 GPU。 Most GPUs since 2002 or so do support that, with exception of some low-end ones (in particular, Intel 915 (aka GMA 900) and Intel 945 (aka GMA 950)).
自 2002 年左右以来,大多数 GPU 都支持这一点,但一些低端 GPU(特别是 Intel 915(又名 GMA 900)和 Intel 945(又名 GMA 950))除外。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.