如何编程使调试容易? [英] How to program such that debugging is easy?

查看:89
本文介绍了如何编程使调试容易?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试基于图像处理开发一些非常复杂的应用程序.我广泛使用openCV.但是,随着程序复杂性的增加,我发现调试程序非常困难.仅出于调试目的,我还必须在Matlab中开发相同的算法.这样做的主要原因是,即使matlab代码中有任何错误,即使代码停止运行或崩溃,变量的值也会保留.由于存在这些值,因此我可以使用不同的可视化工具对其进行分析.像画图一样;将其显示为图像.有什么可以用C实现的方式或功能,使我们可以处理相同的行为.

I am trying to develop some very complex applications based on Image processing. I use openCV extensively. However as the complexity of my programs are increasing I am finding it very difficult to debug my programs. Just for debugging I have to develop the same algorithm in Matlab alongside. The main reason for this is that even if there is any error in the matlab code the values of the variables are retained even when the code stops running or when it crashes. Since the values are there I can use different visualization tools to analyse it; like plotting it; showing it as an image. Is there any way or feature which we can implement in C such that we can approach the same kind of behavior.

推荐答案

要调试视觉算法,我强烈建议您将算法划分为不同的视觉步骤.通过将c程序构建为插件.然后将控制器部分编程为matlab脚本而不是c.这样,您就可以将每个视觉步骤以图像的形式查看.

To debug vision algorithms, I highly recommend to divide your algorithm to different vision steps. Interface each step as a function to a vision environment like matlab, by building your c-program as a plugin. Then program the controller part as a matlab script instead of c. This allows you to view each vision step as an image.

您似乎无法使用我发布的插件方法附加Visual Studio插件,请参见注释.

You can't seem to attach the visual studio plugin using the plugin method I posted, see comment.

这篇关于如何编程使调试容易?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆