I have a such task: in image find for each pore (or blob) perimeter of contour. So, each contour I have to consider polygon (approximation) with some step value (distance between points) (for example min step is 20 um).
For getting edges I prefer Canny algorithm.
using Images, ImageMorphology, ImageEdgeDetection, Contour, Clustering,
PolygonOps, ImageView, ImageSegmentation, TestImages, IndirectArrays,
LinearAlgebra, FileIO, ImageFeatures
using ImageEdgeDetection: Percentile
# Load image (may be binary or grayscale)
function load_image()
img = testimage("blobs")
imgg = Gray.(img);
return imgg
end
# Apply morphological operations -- detect edges
function preprocess_image(img,scale)
img = erode(dilate(img)) # Opening to remove noise
alg = Canny(spatial_scale=scale, high=Percentile(80), low=Percentile(20))
edges = detect_edges(img, alg)
return img, edges
end
img = load_image()
img1, edges = preprocess_image(img,0.85)
mosaicview(img1,Float64.(edges); nrow=1)
My question is: how to get points from every edge (respective each segmented object in image) and approximate using Richard's interpolation, or another polygonal approximation with custom step?
I am using Julia v 1.10. Contour.jl
some functions are deprecated...