vurthebest.blogg.se

Stone photo resizer
Stone photo resizer







stone photo resizer

You can also tweak the parameters using OpenCV trackbars using the code below: import cv2 Imgs = Ĭontours = cv2.findContours(process(img), cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)Ĭv2.drawContours(img, contours, -1, (0, 255, 0), 1) Return cv2.erode(img_dilate, None, iterations=2) Img_dilate = cv2.dilate(img_canny, None, iterations=2) _, thresh = cv2.threshold(img_gray, 103, 255, cv2.THRESH_BINARY) Img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) Here is how you can use the Canny edge detector to detect the rocks in your images: import cv2 I know that the thresholds can be tuned for better results here.īut, what I am looking here for the any better approach or solution can work in this heavy environment for detection small particles like stones. # erode and diluation to smoothen the edegesįinal_mask = cv2.erode(imagemask, np.ones((3, 3), dtype=np.uint8))įinal_mask = cv2.dilate(imagemask, np.ones((5, 5), dtype=np.uint8))Ĭontours = cv2.findContours(final_py(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) Imagemask = cv2.inRange(hsv, lower_bound, upper_bound) #masking the image using inRange() function Hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV) The code which I tried for contour based detection is as below image = cv2.imread(os.path.join(img_path, img_name2)) Also, I am looking into ENet Architecture for semantic segmentation based deep learning approach. The approach which I tried is threshold based filtering and detecting cv2.contours. I need to identify the visible stones only. I have samples images of stones present in the images.









Stone photo resizer