-2

I have a set of scripts that use some dependencies, such as caffe(used for deep learning). The script detects an object and draws a rectangle alongside it(it's used in a car simulator) My question is this, what is the best method to use the script in C++? I can manually convert all the code to C++ and just use it as a separate module or I can make a separate module that loads the script using a C++ wrapper on the python API and just call the python command in the wrapper and let the funny business run somewhere else(pretty much embed the python in C++). What's the most efficient method regarding time input-reward outcome?

Grumbel
  • 6,585
  • 6
  • 39
  • 50
  • Why not just use Cython in the meantime? – SerialDev Oct 06 '16 at 12:39
  • Fully depends on the circumstances. If it's an experimental setting probably you should use the script as is. For production either convert to C++ or take a look at Cython or Swig. – Jacques de Hooge Oct 06 '16 at 12:39
  • Possible duplicate of [Convert Python program to C/C++ code?](https://stackoverflow.com/q/4650243/608639) – jww Nov 21 '19 at 13:37

1 Answers1

1

I suggest that you edit your Python script to make it return the rectangle's 4 points instead of drawing the rectangle around the detected object. Then use the way described in the accepted answer of this question to get the 4 points of the rectangle from the Python script and draw them in C++. Hope this helps!

Community
  • 1
  • 1
Mo Abdul-Hameed
  • 6,030
  • 2
  • 23
  • 36