Reputation: 1867
I am using HED (https://www.pyimagesearch.com/2019/03/04/holistically-nested-edge-detection-with-opencv-and-deep-learning/) to transform the following image Input:
Image1
to this image:
Image2
However the output of HED still contains many areas where the blur is present like the travellers trousers and on backpack also on the mountains. In order to remove the additional blur. I tried using canny edge detector on image 2 above here are the results:
edges = cv2.Canny(hed,100,200)
Image3
However the output is completely different in image 3. What I want is a revised version of image 2 but with the blurred areas removed. How can I do this ?
Upvotes: 0
Views: 2568
Reputation: 53081
I do not know if this is what you want. But you can threshold only values above some gray level to white leaving the darker values unchanged in Python/OpenCV as follows:
Input:
import cv2
# read image as grayscale
img = cv2.imread('hiker_edges.jpg',0)
# threshold to white only values above 127
img_thresh = img
img_thresh[ img > 127 ] = 255
# view result
cv2.imshow("threshold", img_thresh)
cv2.waitKey(0)
cv2.destroyAllWindows()
# save result
cv2.imwrite("hiker_edges_white_threshold.jpg", img_thresh)
Result:
Upvotes: 2