I'm currently overlaying a thermal camera on a normal rgb camera, the thermal camera outputs an image in grey scale.
I'm converting to rgb using a colormap to add colour to the image, then overlaying it to the normal rgb camera. This is working fine
thermal = cv2.applyColorMap(thermal, cv2.COLORMAP_HOT)
alpha =0.5
blended_portion = cv.addWeighted(foreground, alpha, background[:foreground_height,:foreground_width,:], 1 - alpha, 0, background)
background[:foreground_height,:foreground_width,:] = blended_portion
cv.imshow('composited image', background)
However this code applies that 0.5 opacity to the entire image, is there any way possible where i only decrease the opacity at a certain threshold? so for example if its cold then its just 0 opacity but when its hot the opacity is 100?