I have 75 photos of a "light section", and I thresholded the pictures.
Now, I want to make those thresholds smoother and thinner because I will use them to calculate a point cloud. I don't know how to make them thinner, smoother, and more accurate. I am new at this topic, therefore I will be grateful if you help me.
Here is the code for thresholds:
import cv2
import numpy as np
import os
from os import path
count = len(os.listdir(r'C:\Users\MERYEM\Desktop\scan\Chosen'))
print(count)
path = r'C:\Users\MERYEM\Desktop\scan\Chosen'
new_path = r'C:\Users\MERYEM\Desktop\scan\threshold_images'
for i in range(1,count+1) :
image = cv2.imread(str(path)+"\{0}.jpg".format(i))
grayscaled = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
retval2, threshold2 = cv2.threshold(grayscaled,58,255,cv2.THRESH_BINARY)
result=cv2.imwrite(str(new_path)+"\{0}.jpg".format(i), threshold2)
if result==True:
print("File saved successfully")
else:
print("Error in saving file")
cv2.waitKey(0)
cv2.destroyAllWindows()