Azzera filtri
Azzera filtri

Plotting a histogram against the width of a connected component (Using hist as plot)

1 visualizzazione (ultimi 30 giorni)
Hi.
I am to reproduce the work of a published paper. ( link ).
The concept of the paper is to plot the intensity of a grayscale image at a selected threshold against the width or area of the connected components.
I've been trying to figure out how to do this in Matlab. One of my implementations was to use the plot command and to plot the area of the connected components against the threshold level of the image. But it did not produce a similar result. Also my plot is the area against the threshold level. It should be area against the intensity.
Here is my attempt at it:
img = rgb2gray(imread('urdu.jpg'));
for k = 1:-0.01:0
bw_normal = im2bw(img, k);
bw = imcomplement(bw_normal);
[label,n] = bwlabel(bw);
stats = regionprops(label, 'Area');
plot([stats.Area],k);
axis([0 350 0 1.1])
hold on;
end
Here is what it produces:
According to the paper this is what it should look like:
As can be seen to the left are the intensity levels of the grayscale image (0 - 255). The only way I can see this happening is to combine histograms. But then again histograms can only be plotted against number of bins not any property of a connected component, and also I do not know how to add histograms like this.
Some insight would be appreciated.
Thank you

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by