get values proportional to most occurence

1 visualización (últimos 30 días)
Jack
Jack el 29 de Mzo. de 2011
here is my code
%Display the transform axes(handles.axes14); imshow(imadjust(mat2gray(H)),[],'XData',theta,'YData',rho,... 'InitialMagnification','fit'); xlabel('\theta (degrees)'), ylabel('\rho'); axis on, axis normal, hold on; x=theta(P(:,2)); [occ,ent]=hist(x,unique(x));
this will give me 1000 peaks as i chose 1000 for peaks
now i want to only filter out values which have an occurence more than 10 for a certain value of theta. i am quite new to matlab.
so that these are the values that are plotted on the matrix and not all the peaks are plotted on the matrix.
if you understand what i am trying to explain
y = rho(P(:,1)); plot(x,y,'s','color','red');
  1 comentario
Gautam Vallabha
Gautam Vallabha el 29 de Mzo. de 2011
Please don't include extraneous material in your question (such as the IMSHOW and PLOT statements).
I assume your question is that you have:
[occ,ent] = hist(x, unique(x));
and you want to only extract those values of ENT where OCC > 10.

Iniciar sesión para comentar.

Respuesta aceptada

Gautam Vallabha
Gautam Vallabha el 29 de Mzo. de 2011
You can use the FIND command to identify indices that match a criterion. For example:
x = ceil(rand(1,5000)*100); % make some sample data
[occ,ent] = hist(x,unique(x)); % get the counts
Find indices where occurrences are greater than 10
indices = find(occ > 10);
Extract the associated entries
filteredOccurreces = occ(indices);
filteredEntries = ent(indices);

Más respuestas (1)

Jack
Jack el 30 de Mzo. de 2011
Thanks
i already figured it out. i used the same command you said i got it from this site so i used that to get values which occured the most. i joined occ and ent on each column for same variable so row 1 will show entry and the number of occurance. i then look for most occurance and get the corresponding column number of the entry. place the values in a new variable.
then i place x and y in 2 row variable so i can look for the theta value in x and get the corresponding y value then separate the x and y variable and then plot it on the matrix.

Categorías

Más información sobre Image Processing Toolbox 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!

Translated by