How does the matlab's contourf work

2 visualizaciones (últimos 30 días)
Sparsh Garg
Sparsh Garg el 16 de Ag. de 2021
Comentada: Sparsh Garg el 16 de Ag. de 2021
So I am able to get the contour matrix from contourf.Now when I try to plot the points on the figure shown below,I end up getting pretty good results.
However,when I manipulate the matrix returned from contourf ,and then try plotting the points,the results are not accurate.Infact the points get shifted.
So,I am thinking that somehow the way I am plotting the matrix and the way Matlab's contourf plots it is different.
Any ideas on what can be done here to get accurate results.
Enclosed is the code block used to get the contour plots as well as the edge points obtained from the below link
Code block for generatnig contours using contourf
I=imread('V.jpg');
I=I(:,:,1);
figure(2)
level=[160,160];
[M,h]=contourf(I,level);
clabel(M,h);
set(gca, 'YDir','reverse')
Code block used to manipulate the Matrix M(more specifically we want to ignore the columns which show us how many points are there for a particular level set).
level_set=load('updated_level_ptsV160.mat');
M=level_set.M;
%idx=find(M(1,:)==110);
%M(:,1)=missing;
%M(:,93)=missing;
%M(:,idx)=(missing);
%M(:,108:110)=missing;
%M(:,112:114)=missing;
plot(M(1,:),M(2,:));
set(gca, 'YDir','reverse')
%save('updated_level_ptsV110.mat','M');
*Please note that these manipulations are specific to contour level 110.I am enclosing the updated file after removing the values as mentinoned earlier.As well as the plot of what happens if I directly plot the contour matrix M.
And finally the result of plotting the points on the contour.
The mat-files for inspection are enclosed
For those interested in why I am plotting the points on the contour the goal is to find a solution to the below question posted by me
DLTR: Want to know why the plot from contourf and my plot are showing different results.Is it because of how matlab's contourf is designed?
  1 comentario
Sparsh Garg
Sparsh Garg el 16 de Ag. de 2021
it seems that i was working on 2 different images of the same letter,so that's why there was the issue.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by