擅长:python、mysql、java
<p>绘制的轮廓将不着色,因为您正在单通道图像上绘制它们。下面是如何画彩色的。(假设<code>frame</code>是<code>BGR</code>。如果原始<code>frame</code>是灰度的,则使用<code>cvtColor</code>将下面代码中的<code>frame_copy</code>转换为<code>BGR</code>)。你知道吗</p>
<pre><code>_, frame = cap.read()
frame_copy = np.copy(frame)
.
.
.
cv2.drawContours(frame_copy, contours, -1, (255,0,0), 3)
cv2.imshow('window',frame_copy)
</code></pre>