[英]Is that possible to adjust the brightness to be more darkest in the image using opencv in python?
You can change the brightness of the whole picture but I'm not sure how to make a part of it.您可以更改整个图片的亮度,但我不确定如何制作它的一部分。 I think this link helps you.
我认为这个链接可以帮助你。
Here is the solution for first step and result.这是第一步和结果的解决方案。
import cv2
img=cv2.imread("/ur/source/image/bright.png")
height, width, channels = img.shape
thresh = [100,100,100]
white = [255,255,255]
white_counter = 0
for x in range(0,width):
for y in range(0,height):
channels_xy = img[y,x]
if all(channels_xy >= thresh):
white_counter += 1
if(white_counter>55):
for k in range(0,height):
img[k,x] = white
white_counter = 0
cv2.imshow('Result',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Result:结果:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.