I am trying to do some preprocessing on this image by creating a mask to separate the foreground from the background.
The problem is when I use thresholding, it masks some of the background and im could not find any solution to improve this.
As it can be seen the darker sections of the background are being masked off which is not desireable.
Here is the code I used to produce this.
img_path="./combined.png"
combined_img=cv2.imread(img_path)
gray = cv2.cvtColor(combined_img, cv2.COLOR_BGR2GRAY)
_, binary = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)
plt.imshow(combined_img)
plt.show()
plt.imshow(binary, cmap='gray')
plt.show()
Any advice on potential algorithms or resources to look into would be greatly appreciated.