Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

filtering undesired pixels

I m working on road detection, After following an approach I have results as shown in the image below. I want to filter out the non road pixels, I removed the vegetation using NDVI so now I m left with road pixels and ground pixels. Can someone please suggest me the possible ways to filter-out the ground pixels? image description

filtering undesired pixels

I m working on road detection, After I am following an approach I have results as mention in this paper, which is based on the concept of reference circles from a distance transformed image. This approach is good to identify road pixels but along with that it also detects non road pixel as shown in the yellow circles in an image below. I want to filter out the non road pixels, get rid of these regions. I removed the vegetation using NDVI so now I m left with road pixels and but I am not sure how to get rid of ground pixels. Can someone please suggest me the possible ways to filter-out the get rid of ground pixels? image descriptionpixels or how to segment out the road region?

image = cv2.imread(r"C:\Users\x\Desktop\sampleImg\aoi.tif")
gray = cv2.cvtColor(rgb_img, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)

# Apply canny
canny_img = auto_canny(blurred)
invert_canny = 255 - canny_img

#Distance transformed image
dst_trans= cv2.distanceTransform(invrt_canny, cv2.DIST_L2, 3)

#Reference Circles
image_max= ndi.maximum_filter(dst_trans, (3,3), mode='constant')
comp= cv2.compare(dist_trans, image_max, cv2.CMP_EQ)
peaks= cv2.multiply(dist_trans, comp, 1/255.0, dtype=cv2.CV_8UC1)

#removing vegetaion
ndvi_map[ndvi_map > 0] = 0
ndvi_im= np.array(ndvi_map*255, dtype=np.uint8)
msk_peaks= cv2.bitwise_and(peaks,peaks, mask=ndvi_im)

#Hough transfomation
lines = cv2.HoughLinesP(image=peaks,rho=1,theta=np.pi/180, threshold=10,lines=np.array([]), minLineLength=5,maxLineGap=3)
a,b,c = lines.shape
for i in range(a):
    cv2.line(image, (lines[i][0][0], lines[i][0][1]), (lines[i][0][2], lines[i][0][3]), (255, 0, 0), 2, cv2.LINE_AA)

orignal image original image based on Reference cirlces based on reference circles hough transformation Hough transformed

filtering undesired pixels

I m working on road detection, I am following an approach as mention in this paper, which is based on the concept of reference circles from a distance transformed image. This approach is good to identify road pixels but along with that it also detects non road pixel as shown in yellow circles in an image below. I want to get rid of these regions. I removed the vegetation using NDVI but I am not sure how to get rid of ground pixels. Can someone please suggest me the possible ways to get rid of ground pixels or how to segment out the road region?

image = cv2.imread(r"C:\Users\x\Desktop\sampleImg\aoi.tif")
gray = cv2.cvtColor(rgb_img, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)

# Apply canny
canny_img = auto_canny(blurred)
invert_canny = 255 - canny_img

#Distance transformed image
dst_trans= cv2.distanceTransform(invrt_canny, cv2.DIST_L2, 3)

#Reference Circles
image_max= ndi.maximum_filter(dst_trans, (3,3), mode='constant')
comp= cv2.compare(dist_trans, image_max, cv2.CMP_EQ)
peaks= cv2.multiply(dist_trans, comp, 1/255.0, dtype=cv2.CV_8UC1)

#removing vegetaion
ndvi_map[ndvi_map > 0] = 0
ndvi_im= np.array(ndvi_map*255, dtype=np.uint8)
msk_peaks= cv2.bitwise_and(peaks,peaks, mask=ndvi_im)

#Hough transfomation
lines = cv2.HoughLinesP(image=peaks,rho=1,theta=np.pi/180, threshold=10,lines=np.array([]), minLineLength=5,maxLineGap=3)
a,b,c = lines.shape
for i in range(a):
    cv2.line(image, (lines[i][0][0], lines[i][0][1]), (lines[i][0][2], lines[i][0][3]), (255, 0, 0), 2, cv2.LINE_AA)

orignal image original image based on Reference cirlces based on reference circles hough transformation Hough transformed

filtering undesired pixelsImage Segmentation

I m working on road detection, I am following an approach as mention in this paper, which is based on the concept of reference circles from a distance transformed image. This approach is good to identify road pixels but along with that it also detects non road pixel as shown in yellow circles in an image below. I want to get rid of these regions. I removed the vegetation using NDVI but I am not sure how to get rid of ground pixels. Can someone please suggest me the possible ways to get rid of ground pixels or how to segment out the road region?

image = cv2.imread(r"C:\Users\x\Desktop\sampleImg\aoi.tif")
gray = cv2.cvtColor(rgb_img, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)

# Apply canny
canny_img = auto_canny(blurred)
invert_canny = 255 - canny_img

#Distance transformed image
dst_trans= cv2.distanceTransform(invrt_canny, cv2.DIST_L2, 3)

#Reference Circles
image_max= ndi.maximum_filter(dst_trans, (3,3), mode='constant')
comp= cv2.compare(dist_trans, image_max, cv2.CMP_EQ)
peaks= cv2.multiply(dist_trans, comp, 1/255.0, dtype=cv2.CV_8UC1)

#removing vegetaion
ndvi_map[ndvi_map > 0] = 0
ndvi_im= np.array(ndvi_map*255, dtype=np.uint8)
msk_peaks= cv2.bitwise_and(peaks,peaks, mask=ndvi_im)

#Hough transfomation
lines = cv2.HoughLinesP(image=peaks,rho=1,theta=np.pi/180, threshold=10,lines=np.array([]), minLineLength=5,maxLineGap=3)
a,b,c = lines.shape
for i in range(a):
    cv2.line(image, (lines[i][0][0], lines[i][0][1]), (lines[i][0][2], lines[i][0][3]), (255, 0, 0), 2, cv2.LINE_AA)

orignal image original image based on Reference cirlces based on reference circles hough transformation Hough transformed