Find the columns where a certain number is repeated consecutively

1 visualización (últimos 30 días)
I have a matrix of ones and zeros of an Image (690 x 1100)
I need to find the columns where at least 50 zeros are repeated.
Can someone help me?

Respuesta aceptada

Jonas
Jonas el 18 de Abr. de 2021
quick and dirty small example
a=[ 1 1 1 0 1;...
0 1 1 0 1;...
0 0 1 1 1;...
0 1 1 1 1];
nrOfMinZerosPerCol=2;
colsWithRepetitions=~all(conv2(a,ones(nrOfMinZerosPerCol,1),'valid'),1);
  1 comentario
Yaisel Córdova Chávez
Yaisel Córdova Chávez el 21 de Abr. de 2021
Editada: Yaisel Córdova Chávez el 21 de Abr. de 2021
Thank you very much for your answer Jonas. I had found a way with two for, but this is faster and more efficient.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by