Introduction to OpenCV image

Time:2021-3-4

Introduction to image processing

An image is made up of pixels

Image classification: binary image, gray image, RGB image

Channel order in opencv: B, G, R

Read pixel

Return value = image (position parameter)

Gray image, return gray value

BGR image, the return value is the value of B, G, R

# eg:
p = img[88, 142]
print(p)

Returns the pixel in row 88, column 142

BGR image, the return value is the value of B, G, R

# eg:
blue = img[78, 125, 0]
print(blue)
green = img[78, 125, 1]
print(green)
red = img(78, 125, 2)
print(red)

When accessing, you can specify the name of the channel

p = img[78,125]
print(p)

Returns the value of three channels

Modify pixels

img[88, 99] = 255

This work adoptsCC agreementReprint must indicate the author and the link of this article

Hacking

Recommended Today

[Q & A share the second bullet] MySQL search engine, after watching the tyrannical interviewer!

Hello, I’m younger brother. A few days ago, I shared the second interview question, the interview site of search engine in MySQL. This question is the interview at normal temperature. After reading it, I’m sure you will gain something in terms of database engine If you haven’t read my first share, you can refer to […]