使用 GPU 转换位图

发布于 2024-09-27 08:52:30 字数 438 浏览 9 评论 0原文

我不知道这是否是正确的论坛。无论如何,这是一个问题。在我们的一个应用程序中,我们显示医学图像,并在它们之上显示一些算法生成的位图。真实位图是16位灰度位图。由此,我们根据查找表生成颜色位图,例如,

(0-100)->green 
(100-200)->blue
(200>above)->red

显示器工作良好,并且可以很好地处理 256x256 的小图像。但是,当显示区域变大(例如 1024x1024)时,灰度到彩色位图的转换需要一段时间,并且交互不再平滑。最近我听到了很多关于通用 GPU 编程的内容。在我们的部署中,我们拥有高端(Nvidia QuadroFX)显卡。

我们的应用程序是使用 .Net/C# 构建的,如果需要,我也可以添加一点 C++/CLI。 现在我的问题是这个位图转换可以卸载到图形处理器吗?我应该在哪里寻找进一步的阅读材料?

I don't know whether this is the right forum. Anyway here is the question. In one of our application we display medical images and on top of them some algorithm generated bitmap. The real bitmap is a 16bit gray scale bitmap. From this we generate a color bitmap based on a look up table for eg

(0-100)->green 
(100-200)->blue
(200>above)->red

The display is working well and good with small images 256x256. But when the display area becomes big say 1024x1024 the gray scale to color bitmap conversion takes a while and the interactions are not smooth any more. In the recent times I have heard a lot about general purpose GPU programming. In our deployment we have high end (Nvidia QuadroFX) graphics card.

Our application is built using .Net/C# if requiured I can add little bit of C++/CLI too.
Now my question is can this bitmap conversion be offloaded to the graphics processor? Where should I look for further reading?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过期情话 2024-10-04 08:52:30

是的——并且由于您(显然)显示位图,因此您不需要走 GPGPU 路线(例如,OpenCL 或 CUDA)。你可以使用一个可编程着色器——如果我明白你在说什么,那么这将是一个非常简单的着色器。

至于如何编写着色器,它将(主要)取决于您如何完成其​​余的绘图。举一个明显的例子,如果您已经在使用 WPF 进行绘图,您可能需要使用 HLSL 着色器(WPF 相当直接地支持像素着色器)。

可能还值得注意的是,如果您必须支持较旧的硬件,那么即使没有可编程着色器,您实际上也可以在 GPU 上轻松管理这样的表查找。只要您只需要支持最新的硬件,着色器可能会更简单。

Yes -- and since you're (apparently) displaying the bitmap, you don't need to go the GPGPU route (e.g., OpenCL or CUDA). You can use a programmable shader for it -- and if I understand what you're saying, it'll be a pretty straightforward one at that.

As far as how to write the shader, it will depend (mostly) on how you're doing the rest of your drawing. Just for an obvious example, if you're already using WPF for your drawing, you'll probably want to use an HLSL shader (WPF supports pixel shaders fairly directly).

It's probably also worth noting that if you had to support older hardware, a table lookup like this is something you could actually manage pretty easily on the GPU, even without programmable shaders. As long as you only need to support recent hardware, a shader will probably be simpler though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文