how to sort histogram generated count and corresponding gray value.. pls help
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ARJUN K P
am 18 Mai 2015
Kommentiert: Image Analyst
am 20 Mai 2015
m=imread('ll.bmp');
[count,gray]=imhist(m);
the answer is:
i want to sort the count and corresponding gray value..
and delete the zero count values answer like this..
0 Kommentare
Akzeptierte Antwort
ARJUN K P
am 20 Mai 2015
Bearbeitet: ARJUN K P
am 20 Mai 2015
1 Kommentar
Image Analyst
am 20 Mai 2015
It does the same thing that I did but combined the counts and gray level arrays into a single 2D array (which we didn't know you wanted to do).
Weitere Antworten (2)
Image Analyst
am 18 Mai 2015
Don't use gray as a variable name - it's the name of a built in function that creates a colormap, and you just blew it away.
I don't know why you need to, but to get rid of array elements with zero counts
[count, grayLevels]=imhist(m);
rowsToDelete = count == 0;
count(rowsToDelete) = [];
grayLevels(rowsToDelete) = [];
5 Kommentare
Image Analyst
am 18 Mai 2015
To sort in reverse order, simply use fliplr()
count = fliplr(count)
grayLevels = fliplr(grayLevels);
Image Analyst
am 19 Mai 2015
% Sort count in descending order.
[sortedCounts, sortIndexes] = sort(count, 'descend');
% Sort grayLevels the same way.
grayLevels = grayLevels(sortIndexes);
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!