Hello I'm ansking about this topic again, but in another way. I'm currently working in a project in that I have to do a vein detector using IR images, to achieve a better segmentation with my teacher I have to make a mask where in that mask only consider the arm area, everything else doesn't matter. We want to isolate the arm area an in that area do the processing, to do theresholding, erosion, etc. A good example to explain the idea is this video that I found on youtube. EXAMPLE VIDEO Currently, the results are expressed in this image.
import matplotlib.pyplot as plt
import matplotlib.image as img
import numpy as np
import cv2
#IM=img.imread("img01.jpg")
#nF,nC=IM.shape #Obtiene el tamaño de la imagen
camera = cv2.VideoCapture(1)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output3.avi',fourcc, 20.0, (640,480))
cv2.namedWindow('Ventana1')
while cv2.waitKey(1)==-1:
retval, img = camera.read()
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
#Def. ROI
nf,nc=gray.shape
nf3=round(nf/3)
gray = gray[nf3:2*nf3,:]
CAP1 = gray.copy()
#Ecualización
clahe = cv2.createCLAHE(clipLimit=20.0, tileGridSize=(8,8))
gray= clahe.apply(gray)
CAP2 = gray.copy()
#Filtro Mediana
gray = cv2.medianBlur(gray,5)
CAP3 = gray.copy()
#Binarización
ret,gray = cv2.threshold(CAP2,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
CAP4 = 255-gray.copy()
#Muestra por pantalla
cv2.imshow('Ventana1',CAP3)
out.write(np.concatenate((CAP1,CAP2,CAP3,CAP4),axis=0))
cv2.imshow('Ventana2',np.concatenate((CAP1,CAP2,CAP3,CAP4),axis=0))
#CIERRA
cv2.destroyAllWindows()
camera.release()
I hope you can help me. Thank you