Curve fitting for 2d Array
26 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have to find slope by using curve fitting in this figure. There are 7 wavefronts in this image. What method should I apply? I have tried different techniques like I manually selected 2 points and find slope but that is not appropriate way. I have to utilize all the data points and fit curve to all 7 wavefronts. Sample image is attached here
0 件のコメント
回答 (2 件)
yanqi liu
2022 年 2 月 16 日
yes,sir,may be choose the target line by color and fit them,such as
im = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/896015/image.png');
jm = rgb2hsv(im);
v = mat2gray(jm(:,:,3));
bw = ~im2bw(v,0.9);
bw2 = imopen(bw, strel('line', 20, 0));
bw3 = logical(bw-bw2);
bw3 = imopen(imclose(bw3, strel('disk', 5)), strel('square', 3));
bw3 = bwareafilt(bw3, 2);
[r,c] = find(bw3);
p = polyfit(c,r,3);
xc = linspace(min(c),max(c));
yc = polyval(p,xc);
figure; imshow(im)
hold on; plot(xc,yc,'r--','LineWidth',2);
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!