Filter löschen
Filter löschen

Threshold ranges to BW image

7 Ansichten (letzte 30 Tage)
Syed Islam
Syed Islam am 21 Jul. 2013
Kommentiert: Ahmed am 21 Nov. 2014
Hi,
I have a black and white image, and I am wanting to apply three different thresholds of 105-168, 170-200, and 120-140 to calculate the surface area coverage of three different sections within the image.
Could you please tell me how I could achieve this, in terms of the code or a link where I cold read up on this?
Thanks in advance
Syed

Akzeptierte Antwort

Image Analyst
Image Analyst am 21 Jul. 2013
Try this:
binaryImage1 = grayImage >= 105 & grayImage <= 168;
binaryImage2 = grayImage >= 170 & grayImage <= 200;
binaryImage3 = grayImage >= 120 & grayImage <= 140;
areaFraction1 = sum(binaryImage1(:)) / numel(grayImage);
areaFraction2 = sum(binaryImage2(:)) / numel(grayImage);
areaFraction3 = sum(binaryImage3(:)) / numel(grayImage);
  5 Kommentare
Image Analyst
Image Analyst am 21 Nov. 2014
The 224 subplot (lower right) looks like a binary image so the histogram will have only bins for 0 and 1. You can use imhist(). Not sure why you want it though.
Ahmed
Ahmed am 21 Nov. 2014
oh, gosh. u r right. i'm not sure also. tq!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox 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!

Translated by