Ask Your Question

Revision history [back]

How to draw contour lines between every colour?

I have a Numpy array that contains values between 0 and 255. How can I get contour lines between every color and not just 0 and non-zero?

My situation is the following

image description

It should be more like

image description

In theory I could loop over the array and setting everything to zero except single color and find contours for that, but that would be incredible tedious and I was hoping there was a more elegant solution.

How to draw contour lines between every colour?

I have a Numpy array that contains values between 0 and 255. How can I get contour lines between every color and not just 0 and non-zero?

My situation is the following

image description

It should be more like

image description

In theory I could loop over the array and setting everything to zero except single color and find contours for that, but that would be incredible tedious and I was hoping there was a more elegant solution.