I am new to image processing, and this is the task at hand.
I have a mask image of shape 500x500x1 that contains polygons.
These polygons (=vector data: common term in remote sensing and GIS) are labeled, and will be used as my target later on to classify crops. This vector data has been rasterized (another remote sensing and GIS term) and resulted in the 500x500x1 mask. As you can see the borders of all polygons are noisy (contains pixels of different colors==> different classes) although each polygon should correspond to one class (one color). I am guessing that something went wrong during the rasterization process; I tried to erode the borders using simple morphological operations:
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (2, 2)) erosion = cv2.erode(lulc_mask, kernel, iterations = 3)
However, this resulted in reducing the area inside the polygons and not the border.
Each time I increase the size of the kernel I basically erode the data from within the polygon, but the border remains the same. Any idea on how to solve this?