How To Plot Graphics With The Colors Of Each Pixel In The Image?
I'm working on image color recognition, so I'm converting the RGB image to Lab because it's the closest color space to human vision. After that, I get each one of the Lab's 3 chann
Solution 1:
Here how to get the answer Alexander suggested to work in your case:
# only change to question's code is the ax.scatter() line:
ax.scatter(l_channel, a_channel, b_channel, marker='o',
facecolors=cv2.cvtColor(image, cv2.COLOR_BGR2RGB).reshape(-1,3)/255.)
Note: The facecolors
argument requires RGB, not OpenCV's BGR, and is picky about the shape and type of the color data, hence the reshape and division.
Here the result when the code is applied to this image:
Post a Comment for "How To Plot Graphics With The Colors Of Each Pixel In The Image?"