How to change level
Ältere Kommentare anzeigen
Hi, everyone have prolem on [rogramin, so i working on ANPR and my problem is when i binary image removing object i get dark screen so i think i need change treshold level but i dont now how, so maybe sameone can help me thanx. Code add below.
..........................................
warning off
img = imread('5.jpg');
img = rgb2gray(img);
imshow(img);
level = 0.55;
BW = im2bw(img,level);
imshow(BW);
BW1 = imclearborder(BW);
imshow(BW1);
CC = bwconncomp(BW1, 8);
S = regionprops(CC, 'Area');
L = labelmatrix(CC);
BW2 = ismember(L, find([S.Area] >= 1500));
imshow(BW2);
Antworten (2)
Walter Roberson
am 18 Okt. 2015
0 Stimmen
When you remove objects that have positive values, then because you replace them with 0, the average brightness over the whole image reduces. The only way to avoid that would be to not remove any objects.
If you are removing more areas than you wish to have removed, then reduce the 1500 to some other value.
Gytis Raudonius
am 18 Okt. 2015
Bearbeitet: Walter Roberson
am 19 Okt. 2015
3 Kommentare
Walter Roberson
am 19 Okt. 2015
P = input('What size to threshold at?');
Have you considered using bwareafilt() ?
Gytis Raudonius
am 19 Okt. 2015
Walter Roberson
am 20 Okt. 2015
bwareafilt() has options for selecting how many objects you want to have output.
Kategorien
Mehr zu Data Import and Analysis finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!