Important: Please read the Qt Code of Conduct -

OpenCV Mat debugging helper

  • Hello, I did some searching on the forum and couldn't find a solution for this. I'm trying to figure out how to setup qt-creator to be able to visualize cv::Mat structures from OpenCV. I looked at the source for the debugger helper and I saw one for QImage that looked promising. Before I tried to cargo cult that thing though I thought I would ask here if anyone has already done this (yet managed to evade Google) or has some tips. If it's helpful here is a nice SO question on converting between Mat & QImage. -- actually even a link to better documentation for debugging helpers would be great. As far as I can tell there is one page of very high level description on Qt's site and 2 blog posts about it. As an example something I saw in the source but can't find any trace of anywhere is there seems to be facilities for using gnuplot (putPlotData in debugger)

    Oh as one more avenue, I did find a few gdb python visualizers for cv::Mat but every one of them deadlocked GDB when I tried it (they called out to Python's matplotlib).

    Thanks for any pointers!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Is this page what you found and read on the matter ?

  • @SGaist Yes, it's pretty sparse. In particular it doesn't address the image case at all.

    [EDIT: I complained about not being able to get even QImage helper to work, but resolved this by installing the qt4 libraries with debug info]

    Further googling led me to this post: but this person also failed. It seems like it should be possible it's just that nobody who has attempted has understood how debugging helpers work (myself included).

  • Hi,

    So the issue with the debug visualizer that I was working on was the fact that QT never recognized the "Displayed" flag. :/
    If we can figure out why QT never even recognizes the flag then I can probably finish that visualizer.

    For now this is my solution:

  • Hi,

    If my cv::Mat variable is a 2 dimension matrix of a small size (<10*10), is it possible to show its elements in "locals and expressions" window? Is it easy or lots of work needed? Or there has already been some tools?

    Thanks a lot.