图像处理代码的调试

发布于 2024-12-01 11:30:07 字数 737 浏览 2 评论 0原文

C++ 中的图像处理/计算机视觉/计算机图形应用程序可以进行哪些调试?您用什么来跟踪方法的错误/部分结果?

到目前为止我发现的只是一种在线调试工具和一种离线调试工具:

  1. bmd: Attaches to正在运行的进程,使您能够以图像形式查看内存块
  2. imdebug:启用printf 风格的调试

两者都非常过时,并且不是我所期望的。

对于离线调试来说,似乎有用的是某种类型的图像日志记录,比如说一组命令,使您能够将图像与文本一起编写(可能以 HTML 的形式,可能是分层的),简单在编译时和运行时都关闭,并且它可以得到最不显眼的效果。

输出可能如下所示(来自我们简单工具的输出):
http://tsh.plankton.tk/htmldebug/d8egf100-RF -SVM-RBF_AC-LINEAR_DB.html

您知道一些朝这个方向发展的代码吗?

如果有任何提示,我将不胜感激。

What kind of debugging is available for image processing/computer vision/computer graphics applications in C++? What do you use to track errors/partial results of your method?

What I have found so far is just one tool for online and one for offline debugging:

  1. bmd: attaches to a running process and enables you to view a block of memory as an image
  2. imdebug: enables printf-style of debugging

Both are quite outdated and not really what I would expect.

What would seem useful for offline debugging would be some style of image logging, lets say a set of commands which enable you to write images together with text (probably in the form of HTML, maybe hierarchical), easy to switch off at both compile and run time, and the least obtrusive it can get.

The output could look like this (output from our simple tool):
http://tsh.plankton.tk/htmldebug/d8egf100-RF-SVM-RBF_AC-LINEAR_DB.html

Are you aware of some code that goes in this direction?

I would be grateful for any hints.

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

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

发布评论

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

评论(4

吻安 2024-12-08 11:30:07

从光线追踪的角度来看,也许其中一些视觉方法对您也有用(我的计划之一是写一篇关于此类技术的简短论文):

  1. 表面法线可视化。帮助寻找表面不连续性。 (没有方便的图像,外观非常让人想起法线贴图)

    color <- rgb(normal.x+0.5、normal.y+0.5、normal.z+0.5)

  2. < strong>距离可视化。有助于发现表面不连续性以及查找最近点时的错误。 (图像取自我的废弃光线追踪器)

    颜色 <- (intersection.z-min)/范围,...

    在此处输入图像描述

  3. 边界体积遍历可视化。帮助可视化边界体积层次结构或其他层次结构,并帮助查看遍历热点,例如代码分析器(例如Kd树)。 (http://ompf.org/forum 的 tbp 创造了术语Kd-vision).

    在此处输入图像描述
    在此处输入图像描述

    color <- number_of_traversal_steps/f

  4. 边界框可视化(图像来自 picogen 左右,几年前)。帮助验证分区。

    在此处输入图像描述

    color <- const

  5. 立体声。 也许对您的情况有用至于真实的立体外观。我必须承认我从未使用过它进行调试,但当我想到这一点时,它在实现新型 3d 基元和树时可能非常有用(图像来自gladius,这是统一实时和非实时光线的尝试追踪)

    在此处输入图像描述

    您只需渲染位置稍有偏移的两个图像,重点关注某个点

  6. 命中或未命中可视化。可能有助于查找 epsilon 错误。 (图像取自metatrace)

    http://th01.deviantart.net/fs70/PRE/f/2010/309/b/0/debugging_a_c___in_s_anity_by_phresnel -d327c6w.png

    如果(命中)颜色= const_a;
    else color = const_b

  7. 几种技术的混合。

    1. 线性插值:lerp(debug_a, debug_b)
    2. 隔行扫描:if(y%2==0) debug_a else debug_b
    3. 任何想法的组合,例如边界框可视化的色调,但应用了实际的场景交叉和照明

您可能会在 http://phresnel.org , http://phresnel.deviantart.com , http://picogen.deviantart.com ,也许http://greenhybrid.deviantart.com (旧帐户)。

Coming from a ray tracing perspective, maybe some of those visual methods are also useful to you (it is one of my plans to write a short paper about such techniques):

  1. Surface Normal Visualization. Helps to find surface discontinuities. (no image handy, the look is very much reminiscent of normal maps)

    color <- rgb (normal.x+0.5, normal.y+0.5, normal.z+0.5)

  2. Distance Visualization. Helps to find surface discontinuities and errors in finding a nearest point. (image taken from an abandoned ray tracer of mine)

    color <- (intersection.z-min)/range, ...

    enter image description here

  3. Bounding Volume Traversal Visualization. Helps visualizing a bounding volume hierarchy or other hierarchical structures, and helps to see the traversal hotspots, like a code profiler (e.g. Kd-trees). (tbp of http://ompf.org/forum coined the term Kd-vision).

    enter image description here
    enter image description here

    color <- number_of_traversal_steps/f

  4. Bounding Box Visualization (image from picogen or so, some years ago). Helps to verify the partitioning.

    enter image description here

    color <- const

  5. Stereo. Maybe useful in your case as for the real stereographic appearance. I must admit I never used this for debugging, but when I think about it, it could prove really useful when implementing new types of 3d-primitives and -trees (image from gladius, which was an attempt to unify realtime and non-realtime ray tracing)

    enter image description here

    You just render two images with slightly shifted position, focusing on some point

  6. Hit-or-not visualization. May help to find epsilon errors. (image taken from metatrace)

    http://th01.deviantart.net/fs70/PRE/f/2010/309/b/0/debugging_a_c___in_s_anity_by_phresnel-d327c6w.png

    if (hit) color = const_a;
    else color = const_b

  7. Some hybrid of several techniques.

    1. Linear interpolation: lerp(debug_a, debug_b)
    2. Interlacing: if(y%2==0) debug_a else debug_b
    3. Any combination of ideas, for example the color-tone from Bounding Box Visualization, but with actual scene-intersection and lighting applied

You may find some more glitches and debugging imagery on http://phresnel.org , http://phresnel.deviantart.com , http://picogen.deviantart.com , and maybe http://greenhybrid.deviantart.com (an old account).

终难愈 2024-12-08 11:30:07

一般来说,我更喜欢将当前处理的图像的字节数组转储为原始数据三元组,并运行 Imagemagick 以使用数字(例如 img01.png)从中创建 png。这样我就可以很容易地跟踪算法。 Imagemagick 使用系统调用从程序中的函数运行。这使得在不使用任何图像格式的外部库的情况下进行调试成为可能。

如果您使用 Qt,另一种选择是使用 QImage 并不时使用 img.save("img01.png"),就像使用 printf 进行调试一样。

Generally, I prefer to dump bytearray of currently processed image as raw data triplets and run Imagemagick to create png from it with number e.g img01.png. In this way i can trace the algorithms very easy. Imagemagick is run from the function in the program using system call. This make possible do debug without using any external libs for image formats.

Another option, if you are using Qt is to work with QImage and use img.save("img01.png") from time to time like a printf is used for debugging.

相权↑美人 2024-12-08 11:30:07

与您正在寻找的内容相比,它有点原始,但我已经使用标准日志记录和编写图像文件完成了您在OP中建议的操作。通常,日志记录和信号导出过程以及分段存在于单元测试中。

信号被赋予标识符(通常是输入文件名),该标识符可以被扩充(通常是进程名称或阶段)。

对于处理器的开发来说,还是相当方便的。

为消息添加 html 很简单。在这种情况下,您可以轻松生成可查看的 html 输出 - 您不需要生成任何 html,只需使用 html 模板文件,然后插入消息。

如果您没有得到好的推荐,我会自己做(因为我已经针对多种信号类型做过多次)。

it's a bit primitive compared to what you are looking for, but i have done what you suggested in your OP using standard logging and by writing image files. typically, the logging and signal export processes and staging exist in unit tests.

signals are given identifiers (often input filename), which may be augmented (often process name or stage).

for development of processors, it's quite handy.

adding html for messages would be simple. in that context, you could produce viewable html output easily - you would not need to generate any html, just use html template files and then insert the messages.

i would just do it myself (as i've done multiple times already for multiple signal types) if you get no good referrals.

萝莉病 2024-12-08 11:30:07

在 Qt Creator 中,您可以在普通 C++ 调试器中单步执行代码时观看图像修改,请参见 http://labs.qt.nokia.com/2010/04/22/peek-and-poke-vol-3/

In Qt Creator you can watch image modification while stepping through the code in the normal C++ debugger, see e.g. http://labs.qt.nokia.com/2010/04/22/peek-and-poke-vol-3/

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