lagadic / vision_visp

ViSP stack for ROS
http://wiki.ros.org/vision_visp
GNU General Public License v2.0
181 stars 88 forks source link

visp_auto_tracker looks for pattern in frame for 2 seconds #89

Closed Jakubach closed 5 years ago

Jakubach commented 5 years ago

Hello, when I try to detect data matrix codes I find an bug,

if you were trying to run this example: https://visp-doc.inria.fr/doxygen/visp-daily/tutorial-barcode-detector-live_8cpp-example.html you can see, that there is an line: bool status = detector->detect(I); whose definition you can find here: https://visp-doc.inria.fr/doxygen/visp-daily/vpDetectorDataMatrixCode_8cpp_source.html I used std::chrono to check, which function take so long time to run and I inspected that this is the line: reg = dmtxRegionFindNext(dec, 0);. If the second argument is 0, dmtx algorithm could look for pattern in a frame without any timeout. So putting there a value, ex. 50 fixed the problem - algorithm started working continously without lagging.

Now I try to work with ROS, but I can not make changes to "detect()" function (which also takes 2 or more seconds to run once).

vpDetectorDataMatrixCode.h looks like:

#ifndef __vpDetectorDataMatrixCode_h__
#define __vpDetectorDataMatrixCode_h__

#include <string>
#include <utility>
#include <vector>

#include <visp3/core/vpConfig.h>

#ifdef VISP_HAVE_DMTX
#include <visp3/core/vpImage.h>
#include <visp3/detection/vpDetectorBase.h>

class VISP_EXPORT vpDetectorDataMatrixCode : public vpDetectorBase
{
public:
  vpDetectorDataMatrixCode();
  virtual ~vpDetectorDataMatrixCode(){};
  bool detect(const vpImage<unsigned char> &I);

};

#endif
#endif

Here is a link for this file: https://github.com/lagadic/visp/blob/master/modules/detection/include/visp3/detection/vpDetectorDataMatrixCode.h

Also running catkin_make -DCMAKE_BUILD_TYPE=Release didn't help me.

fspindle commented 5 years ago

Sorry the delay. This is now fixed in visp master branch and will be integrated in ros-<distro>-visp after ViSP next release; maybe end of the year.

In the meantime, to use visp master branch