Borrar filtros
Borrar filtros

How to change level

4 visualizaciones (últimos 30 días)
Gytis Raudonius
Gytis Raudonius el 17 de Oct. de 2015
Comentada: Walter Roberson el 20 de Oct. de 2015
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);

Respuestas (2)

Walter Roberson
Walter Roberson el 18 de Oct. de 2015
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
Gytis Raudonius el 18 de Oct. de 2015
Editada: Walter Roberson el 19 de Oct. de 2015
I little change code:
CC = bwconncomp(BW1, 8);
S = regionprops(CC, 'Area');
L = labelmatrix(CC);
P = 1500;
BW2 = ismember(L, find([S.Area] >= P));
imshow(BW2);
But, i dont have ideas how i can change P value. Sometimes need that P lower than 1500, sometimes great. I try to do with if - function, but i got errors.
  3 comentarios
Gytis Raudonius
Gytis Raudonius el 19 de Oct. de 2015
Yes i think about bwareafilt, but it dont work wiht diferent pictures because pictures resoliution changes. So i think i need to P get lower for 100, and chaking objects if, object aceptable area goes to other function if no, p more lowering.
Walter Roberson
Walter Roberson el 20 de Oct. de 2015
bwareafilt() has options for selecting how many objects you want to have output.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by