Find contours for walls in floor plan images

Hi community,

I’ve implemented the following code to find contours on my image:
_, thres_image =cv2.threshold(imageGray,125,255,cv2.THRESH_BINARY)

contours, hierarchy = cv2.findContours(thres_image, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)

print(“Number of contours found = {}”.format(len(contours)))

print(“\nHierarchy : \n{}”.format(hierarchy))

cv2.drawContours(image, contours, -1, (0,255,0), 1);


the Isue I have is that it’s recongizing contours for everything and this involve room texts, furnitures, among other useless things. Do you recommend any other filter or some insights on how to identify contours of objects with rectangular shapes or filled regions?

All the best

there is no simple and good solution.

just train a neural network for segmentation, or an “autoencoder” (with skip connections, like a U-net or something) that modifies the input to your liking.