Answers for "cv2 color_bgr2rgb"

8

bgr to rgb opencv

img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
Posted by: Guest on June-20-2020
3

cv2 convert to rgb

im_rgb = cv2.cvtColor(im_cv, cv2.COLOR_BGR2RGB)
Posted by: Guest on July-17-2020
0

how to use cv2.COLOR_BGR2GRAY

def main():
	imagePath = "img.jpg"
	
	img = cv2.imread(imagePath)
	gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
	
	generate_histogram(gray)
	
	cv2.imwrite("before.jpg", gray)

	gray = cv2.equalizeHist(gray)
	
	generate_histogram(gray)
	
	cv2.imwrite("after.jpg",gray)
	
	return 0
Posted by: Guest on October-06-2021

Browse Popular Code Answers by Language