generate functionThu, 23 Mar 2023

I want a python program with a dialgo window that captures an image from the webcam. I also want that in that dialgo window there is a colour selector that uses the selected colour to apply a mask for the selected colour. I want all this with opencv

import cv2 import numpy as np def nothing(x): pass # Create a black image, a window img = np.zeros((300,512,3), np.uint8) cv2.namedWindow('image') # create trackbars for color change cv2.createTrackbar('R','image',0,255,nothing) cv2.createTrackbar('G','image',0,255,nothing) cv2.createTrackbar('B','image',0,255,nothing) cap = cv2.VideoCapture(0) while(True): # get current positions of four trackbars r = cv2.getTrackbarPos('R','image') g = cv2.getTrackbarPos('G','image') b = cv2.getTrackbarPos('B','image') # Read the frame ret, frame = if ret: # Flip the image frame = cv2.flip(frame,1) # Convert BGR

Questions about programming?Chat with your personal AI assistant