Debugging Imatest IT

Debugging a console-based application

Much of the diagnostic information produced by the Imatest library is output to STDOUT and STDERR streams.  In 4.0 and beyond, this occurs in a  by adding the following INI setting:


If you want to capture this output by your tester program and to save it to a log file, run your program like this:

testerprogram.exe > outputlog.txt 2>&1


Inspect the outputlog.txt should reveal details about what went wrong.  If you have any questions, send this file to Imatest Help Center. We should be able to determine the cause of the failure.  Also bundle your Imatest INI file, any JSON outputs that were produced, and if the failure is caused by a specific image please send us that image. 

Debugging a GUI-based application

In your calls to Imatest IT should be placed inside a try block ,with the catch block receiving a mwException object. can you then add a call to the print_stack_trace() member function of the mwException class. This will print the Matlab stack trace to cerr.  Note that there is only a print_stack_trace() for non-const mwException objects.   Example:


try {
     acquire_image(2, im_orig, vstr, source_id, vararginParam);
catch (mwException& e) {
     cout << “Run Error!” << endl;
     cerr << e.what() << endl;


GUI programs block the STDOUT and STDERR streams for the libraries you are calling. If cerr is not being output by your application, then the stream output must be captured. As part of our Operator Console Project, we have set up means of capturing these streams.  


See the following files for how to capture the streams: