Maximum of Frobenius norm of Hessian of matrix
Find Threads Using Maximum of Frobenius Norm of Image Hessian
Read and display an image that contains tubular threads of varying thicknesses.
I = imread('threads.png'); imshow(I)
Calculate the maximum of the Frobenius norm of the Hessian of the image, with tubular thickness set to seven pixels.
C = maxhessiannorm(I,7);
Create an enhanced version of the image highlighting threads seven pixels thick. Use a structure sensitivity threshold equal to half of the maximum of the Frobenius norm of the Hessian. In the image, threads show up dark against a light background, so specify the object polarity as
'dark'. Display the enhanced image.
J = fibermetric(I,7,'ObjectPolarity','dark','StructureSensitivity',0.5*C); imshow(J) title('Enhanced Tubular Structures 7 Pixels Thick')
Threshold the enhanced image to create a binary mask containing only the threads with the specified thickness.
BW = imbinarize(J);
Display the mask over the original image using the
labeloverlay function. The overlay has a blue tint where the mask is
true, meaning those threads have the specified thickness.
maskl = labeloverlay(I,BW); imshow(maskl) title('Detected Tubular Structures 7 Pixels Thick')
I — Image with elongated or tubular structures
2-D grayscale image
Image with elongated or tubular structures, specified as 2-D grayscale image.
thickness — Thickness of tubular structures
4 (default) | positive integer
Thickness of tubular structures in pixels, specified as a positive integer.
maxhessiannormis a helper function to
fibermetric, which changed default behavior in R2018b. If you want to reproduce the prior default behavior, then specify
Introduced in R2018b