How to detect a particular contour in a matlab plot?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm trying to extract a particular outline from a matlab pcolor plot (generated from a Matrix named 'M' which is uploaded here as well) as shown in this image. Original Plot
However I would like to extract the contour only, as shown here. (The yellow color line is the one which I would like to extract and is highlighted here for illustration purpose) Required Plot
But I'm getting the result as the following. ( I don't require any other bits/clutter apart from the curve) Obtained Plot
[~, threshold] = edge(M, 'sobel');
fudgeFactor = 0.6;
BWs = edge(M,'sobel', threshold * fudgeFactor);
se90 = strel('line',6,70);
se0 = strel('line',3,90);
BWsdil = imdilate(BWs, [se90 se0]);
BWnobord = imclearborder(BWsdil,18);
seD = strel('cube',3);
BWfinal = imerode(BWnobord,seD);
BWfinal = imerode(BWfinal,seD);
pcolor(BWfinal);colormap(jet); shading interp;colorbar;
How to obtain only the contour as required? Do I have to use any edge detection filters or do I have to perform smoothing prior to applying any filters? Thanks for any pointers or suggestions to accomplish this.
0 Kommentare
Antworten (1)
Walter Roberson
am 1 Jun. 2017
If you already know the [x y] path, then you could consider improfile() . Or just call interp2 directly, similar to https://www.mathworks.com/matlabcentral/answers/342101-how-do-you-get-an-arbitrary-1-dimensional-line-scan-from-a-2d-matrix#comment_457886
2 Kommentare
Walter Roberson
am 9 Jun. 2017
It sounds to me as if you need something like envelope detection
https://www.mathworks.com/help/signal/ref/envelope.html and https://www.mathworks.com/help/signal/ug/envelope-extraction-using-the-analytic-signal.html
However as you are working in 2D then perhaps what you should use is boundary() (requires R2014b or later; if you are using an earlier release look in the File Exchange for "active contours"
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!