简体   繁体   中英

Computer Vision Three Layer RGB

I found this:

red = np.uint8([[[0,0,255]]])
hsv_red = cv2.cvtColor(red,cv2.COLOR_BGR2HSV)
print(hsv_red)

in tutorial openCV Chaning Colospace. I dont understand with np.uint8([[[0,0,255]]]) . Can you explain why use [] three times?

Look at the dimensions:

np.uint8([[[0,0,255]]]).shape
# (1, 1, 3)

np.uint8([0,0,255]).shape
# (3,)

It makes sense in the context of images since a color image is a matrix of (nxmx 3) . Then (1 x 1 x 3) is a point.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM