4

I need to check elements of some cv::Mats while debugging my OpenCV C++ code.

Tried adding mymat.at<double>(0, 0) to watch but there are two problems:

  • Sometimes it doesn't work: Couldn't find method cv::Mat::at<double>
  • Even if it works, it is very hard to check elements one by one.

Currently, I write Mat contents to a file using cv::FileStorage but it is not a good solution also.

Is there any VSCode extension like Image Watch to show value of Mat elements while debugging?

AmirSina Mashayekh
  • 498
  • 1
  • 5
  • 21
  • VSCode supports Natvis (https://code.visualstudio.com/docs/cpp/natvis), if you use VC, you get full support for Natvis and a subset for g++/clang (that might be sufficient for your use case). You can check this Natvis for OpenCV for instance: https://github.com/cdcseacave/Visual-Studio-Visualizers/blob/master/OpenCV.natvis – Holt Aug 12 '22 at 15:13

1 Answers1

0

If you are currently using GDB to debug your application, you may wish to refer to this open source project,and it is not currently available as a plugin for vscode.

xing cui
  • 93
  • 10