How do I calculate the radius of this culvert from the image hyberbola?
3 views (last 30 days)
Show older comments
Hi everyone,
I took a GPR (Ground-Penetrating Radar) B-scan of a roadway section with a round-shaped steel culvert in it.
I am trying to use MATLAB to detect the curve and/or calculate the approximate radius from the image, the actual diameter is 15 inches.
I tried using " imfindcircles" to do it, tried different ways such as increasing the intensity, turning to grayscale, binarizing it (in order to use objectpolarity option), as well as changing the [rmin , rmax] values, but that doesnt seem to work. The figure file, and the raw image texi file are also attached.
I_scan11 = imread("Scan11_color.png");
%imshow(I_scan11);
I_scan11_gray = im2gray(I_scan11);
imshow(I_scan11_gray)
I_scan11_gray1 = imadjust(I_scan11_gray);
imshow(I_scan11_gray1);
%imhist(I_scan11_gray)
%I_scan11_BW = I_scan11_gray > 210;
I_scan11_BW = imbinarize(I_scan11_gray);
imshow(I_scan11_BW);
%
% SE = strel("disk",14); % 20
% I_scan11_BW1 = imdilate(I_scan11_BW,SE);
% %I_scan11_BW1 = imclose(I_scan11_BW,SE);
% %I_scan11_BW1 = bwareaopen(I_scan11_BW1,5);
% imshow(I_scan11_BW1);
[center, radius] = imfindcircles(I_scan11_BW,[400,1120],"Sensitivity",0.99,"ObjectPolarity","dark")
viscircles(center,radius);
% hold on;
% plot(center(:,1),center(:,2),'yx','LineWidth',2);
% hold off;
The following code generates the image as seen above: (exclusive for GPR)
load MECHANICAL_LAB_EXP_05_11_21_022_P_1A.txt; % Image text file derived from the device
Bscan = MECHANICAL_LAB_EXP_05_11_21_022_P_1A; % This is scan 11-1.
clear MECHANICAL_LAB_EXP_05_11_21_022_P_1A;
% Apparent/input dielectric constant = 6.0, subsurface material is
% non-magnetic ( magnetic permeability = 1)
[a, b] = size(Bscan); % a = cross-range (rx), b = range(r) (rx,r) = (a,b)
dr = (9 * 12) / (b-1); % Range resolution, in inches % Penetration depth is 9 ft
d = 4.11 * 12; % GPR cart rolling distance, in inches % the rolling distance is 4.11 ft
drx = d / (a - 1); % Cross-range resolution, in inches
r = (0:b-1) * dr; % Range, in inches
rx = (0:a-1) * drx; % Cross-range, in inches
figure;
imagesc(rx, r, Bscan'); colormap jet; colorbar; caxis([-2.5e6,3e6]);
xlabel('Cross-range, {\it r_x} (in)'); ylabel('Range, {\it r} (in)');
title(scan_title);
xlim([d-33 d]); ylim([0,22]);
set(gcf, "Position", [744 757 560 420]);
set(gca, 'fontsize', 12);
Please help me! Thanks!
2 Comments
DGM
on 1 Mar 2022
Edited: DGM
on 1 Mar 2022
I'm not sure I understand what I'm looking at. If the projection of a circular object is a hyperbola, then trying to work off of the curvature might not be as easy as trying to find the asymptotes and minimum range. I don't know if that's appropriate for the available data though. I can't really tell if the image shows a part of a circle or part of a hyperbola.
Accepted Answer
William Rose
on 1 Mar 2022
@DGM, this is an inteesting and non-trivial problem. Here are suggesitons, based on my experience using the image processing tools in Labview to determine vl=blood vessel radius from ultrasound images. I have not used the Matlab image processing tools, so my suggesitons are not detailed.
Use the values from the b&w image. Let the user set a depth below which to analyze. Set all array values at shallower depths to zero to avoid getting confused later by the high reflactance values near the surface. In the image you provided, a dpeth of 15" or 16" might be a reasonable depth setting, since the top of the pipe seems to be just below 16". THen you find the depth coordinate for each "column" of the array which is maximum for that column. This is the vertical coordinate of the hyperbola, for that x coordinate. One you have done all that, you have one depth for every x-coordinate. The yu use least squares to find the coefficients of hte hyperbola that give the best fit to the x,y set of points. Then you convert the hyperbola coefficients to a radius.
Good luck.
8 Comments
More Answers (1)
Image Analyst
on 1 Mar 2022
Do you just want to find the peak/ridge line of the curved thing at the bottom of the grayscale image? I could probably find that and then to get the radius of curvature at any point, you just have to fit the data of the ridgeline (x,y) coordinates into a circle fitting function. Of course the radius of curvature changes as you move along the ridgeline so that's why you have to specify both the center location and the window width to get the radius of curvature just within that window.
Like @William Rose asked, please attach your actual data (not a pseudocolored image) in a .mat file with the paperclip icon.
17 Comments
William Rose
on 2 Mar 2022
Script finds peak points in the B-mode scan region of interest.
Script finds the hyperbola that gives the best fit to the peak points in the region of interest.
Script estimates the pipe radius and location that would produce the best fit hyperbola.
Script makes three plots, including the plot below.
See Also
Categories
Find more on Green in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!