How to detect a particular contour in a matlab plot?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Walter Roberson
el 1 de Jun. de 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 comentarios
Walter Roberson
el 9 de Jun. de 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"
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!