At this time’s publish reveals the way to use ismember to conveniently find the entire highest pixel values in a picture. For instance, within the following Hough remodel picture, what are the 20 highest values, and the place are all of the pixels which have these values?
![hough-transform-image.png](https://blogs.mathworks.com/steve/files/find_all_highest_pixels_1.png)
This is the place the Hough remodel picture above comes from.
A = imread(“gantrycrane.png”);
imshow(A)
bw = edge(rgb2gray(A),“canny”);
imshow(bw)
imshow(H,[],XData=T,YData=R)
axis on
Now let’s kind to determine the best 20 values of H.
sorted_H_values = kind(H(:),“descend”);
highest_H_values = sorted_H_values(1:20)
Lastly, I will use ismember to compute a binary picture exhibiting all the weather of H which have a type of 20 highest values. (And I will use xlim and ylim to zoom in in order that we will see a number of of these parts clearly.)
mask_20_highest_values = ismember(H,highest_H_values);
imshow(mask_20_highest_values,XData=T,YData=R)
ylim([141 452])
Any element-wise logical perform, similar to ismember, can be utilized on this technique to produce a binary picture. So add this to your bag of MATLAB tips!