![]() ![]() # Multiply the foreground with the alpha matteįoreground = cv2.multiply(alpha, foreground) # Normalize the alpha mask to keep intensity between 0 and 1 # Apply a slight blur to the mask to soften edges Th, alpha = cv2.threshold(np.array(rgb),0,255, cv2.THRESH_BINARY) # Create a binary mask of the RGB output map using the threshold value 0 # Create a background array to hold white pixelsīackground = 255 * np.ones_like(rgb).astype(np.uint8) # and resize image to match shape of R-band in RGB output mapįoreground = cv2.cvtColor(foreground, cv2.COLOR_BGR2RGB)įoreground = cv2.resize(foreground,(r.shape,r.shape)) # Change the color of foreground image to RGB ![]() Let’s look at the code that we add in this function ![]() This source parameter is a path to the input image which we’ll be working with this time instead of the RGB output like before.
0 Comments
Leave a Reply. |