Sunday, October 2, 2022
HomeMatlabDiscover all the best pixel values utilizing ismember » Steve on Picture...

Discover all the best pixel values utilizing ismember » Steve on Picture Processing with MATLAB


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
I obtained the concept from some instance code written by Picture Processing Toolbox author Megan Mancuso. Megan says she obtained the concept to make use of ismember this fashion from Ahmed’s reply on MATLAB Solutions.

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!

Previous articleReact v18.0 – React Weblog
Next articleCSS :has
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments