Skip to content
Advertisement

Color is not responsive when Drawig a Circle function inside a loop

I would like to draw circles in a loop. I want each circle to have a different color, but when I do this, I only get one color.

I tried the code on colab 4.1.2

JavaScript

cv2

Advertisement

Answer

You need to create mat as uint8 type:

JavaScript

matplotlib conversion is:

  • NumPy arrays of type float applies pixel range [0, 1].
  • NumPy arrays of type uint8 applies pixel range [0, 255].

You are using plt.imshow(mat), when type of mat is float.
All values above or equal 1.0, are at maximum intensity (equivalent to 255 in uint8).
RGB triplet at maximum intensity applies white color.


Complete code:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement