I have a floorplan image. Through opencv houghlines method I want to identify the walls in it. Since the size of the lines of walls is larger than the lines in objects in the image, I want to increase the size of the line to be searched.
Generally, the code identifies the lines in objects also even though the threshold value is increased.
I am new to this platform. Can somebody help me?
When I increase the threshold value some object lines are still there but some lines on the walls are missing.
Here is the result when I increase the threshold value
Here is the code:
import cv2
import numpy as np
img = cv2.imread("C:\\Users\\User\\Desktop\\tkinter_codes\\floorplans\\ROBIN\\Dataset_3roomsmall\\Cat1_1.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray,900,1000,apertureSize = 5)
cv2.imshow('edges', edges)
lines = cv2.HoughLinesP(edges,1,np.pi/180,100,minLineLength=100,maxLineGap=10)
for line in lines:
x1,y1,x2,y2 = line[0]
cv2.line(img,(x1,y1),(x2,y2),(0,255,0),2)
cv2.imshow('image', img)
k = cv2.waitKey(0)
cv2.destroyAllWindows()