Hi everyone,
I’m working on a project involving geological fractures. My ground truth data is in the form of shapefiles (vector format), which I convert to raster images. The usual approach is to colorize the pixels that overlap with the fracture lines.
DATA:
However, I’m exploring a different idea: creating a buffer around the fractures where pixel values increase as they approach the fracture line and then decrease outward (like a normal distribution around the line).
What I am trying to do:
I have two main questions:
- Is there a better way to implement this?
- Is it worth doing, or are there better alternatives for this kind of problem?
I’ve been experimenting with morphological operations, and here’s the code I used to generate the attached figure:
import numpy as np
from skimage import morphology as mp
from skimage import io
from skimage.util import img_as_ubyte, dtype_limits
import matplotlib.pyplot as plt
# Load the image
image_path = 'OG1_23_74.png'
mask_path = 'gtOG1_23_74.png'
img = io.imread(image_path)
msk = io.imread(mask_path)[:, :, 0] # Load and take the first channel
msk = msk.astype(np.uint8)
# Apply morphological operations
dil_msk = mp.dilation(msk, mp.square(9))
dil_msk_1 = mp.dilation(msk, mp.square(9)) ^ msk
dil_msk_2 = mp.dilation(msk, mp.square(19)) ^ dil_msk_1 ^ msk
dil_msk_3 = mp.dilation(msk, mp.square(29)) ^ dil_msk_2 ^ dil_msk_1 ^ msk
# Create composite output with weighted contributions
out = msk + dil_msk_1 / 5 + dil_msk_2 / 9 + dil_msk_3 / 19
I’d appreciate any insights or suggestions!
Thanks,