1

I want to modify the shape returned from shape_predictor in dlib python, code as follows:

      sp = dlib.shape_predictor(predictor_path)
      dets = detector(img, 1)
      for k, d in enumerate(dets):
          shape = sp(img, d)
      for par in range(68):
          (shape.part(par)).x = int(10)
          (shape.part(par)).y = int(10)

but it returned an error:

"Attributes: cannot set the attributes."

the return value from shape_predictor function is an full_object_detection, and the code in c++ as follows:

full_object_detection(
        const rectangle& rect_,
        const std::vector<point>& parts_
    ) : rect(rect_), parts(parts_) {}

I modify the code in c++, drop the const in function shape_predictor function. Is there another method to modify the returned shape value?

Rhapsody
  • 77
  • 1
  • 5

0 Answers0