简体   繁体   中英

How to program such that debugging is easy?

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM