Was ist das Format für PTs in OpenCV -Polylines?Python

Python-Programme
Guest
 Was ist das Format für PTs in OpenCV -Polylines?

Post by Guest »

Ich versuche, Polygone mit CV.Polyline zu zeichnen. Ich erhalte diesen Bizzar -Fehler dabei. Hier ist die Ausgabe < /p>

Points: [[[232 237]]

[[259 247]]
.
.
.
[[214 365]]

[[211 360]]

[[217 321]]

[[224 306]]

[[224 295]]

[[221 263]]

[[221 257]]], type:, shape:(19, 1, 2)

---------------------------------------------------------------------------
error Traceback (most recent call last)
Cell In[4], line 32
28 color = colors[label]
30 print(f" Points: {pts}, type:{type(pts)}, shape:{pts.shape}")
---> 32 cv2.polylines(image, [pts],isClosed=True, color= color, thickness=2)
34 overlay = image.copy()
35 cv2.polylines(overlay, [pts], isClosed=True,color=color, thickness=-1)

error: OpenCV(4.11.0) :-1: error: (-5:Bad argument) in function 'polylines'
> Overload resolution failed:
> - Can't parse 'pts'. Sequence item with index 0 has a wrong type
> - Can't parse 'pts'. Sequence item with index 0 has a wrong type
< /code>
Ich habe mich mit der Dokumentation befasst und versucht, ChatGPT zu verwenden, um die Probleme zu diagnostizieren, aber ich kann dies nicht tun. Um ehrlich zu sein, ich untersetzt nicht, was daran falsch ist. Ich habe versucht, die vorherige Version zu verwenden, d. H. Ver 4.10 statt 4.11, aber ich erhalte immer noch den gleichen Fehler.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post