Borrar filtros
Borrar filtros

Change color of specific bits Imagesc(), Image()

6 visualizaciones (últimos 30 días)
Rishi Balasubramanian
Rishi Balasubramanian el 26 de Mzo. de 2022
Comentada: Walter Roberson el 7 de Abr. de 2022
Hi,
I have a binary matrix, where my algorithm runs through to find inconsistencies and flip the respective bits as it goess row by row. I want to be able to show those specific bit changes in a different color to visually demonstrate the process. Is it possible?
Edit - I may have missed out a key point. I use imagesc() to show the entire array. In that figure, I want the bit change to be shown. Currently I am playing with casting a bit sized rectangle on the flip coordinates
  1 comentario
Rishi Balasubramanian
Rishi Balasubramanian el 26 de Mzo. de 2022
For those bit flips, i flip it using the ~ operator, so I will be having the coordinates of the specific bit flips to begin with.

Iniciar sesión para comentar.

Respuestas (2)

Walter Roberson
Walter Roberson el 26 de Mzo. de 2022
  1 comentario
Rishi Balasubramanian
Rishi Balasubramanian el 27 de Mzo. de 2022
I may have missed out a key point. I use imagesc() to show the entire array. In that figure, I want the bit change to be shown. Currently I am playing with casting a bit sized rectangle on the flip coordinates

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 27 de Mzo. de 2022
I see you've added tags about images. So, see my attached demo about viewing bit planes. If you flipped a bit, you could have another logical matrix that keeps track of what pixels got their bits flipped, and then use imoverlay to display the flipped bits in color over the original.
rgbImage = imoverlay(originalMatrix, matrixOfFlippedBits, 'r');
imshow(rgbImage);
title('Flipped bits in red');
  7 comentarios
Rishi Balasubramanian
Rishi Balasubramanian el 7 de Abr. de 2022
Well, for the time being, I am using the rectangle function to create an oversized rectangle (3 bits width) with the location for bit flips and colored it red and increased the thickness to make it look like a really ugly red blop on the approximate error locations.
That's what I could muster. This is not for the users, but for my own reference for debugging. Just wanted to see approximately where the flips are happening instead of stopping the code and getting into the array in the workspace every now and then.
Now that I have you here, I have another question pposted regarding communications toolbox - https://www.mathworks.com/matlabcentral/answers/1690395-bch-encoder-error-locations?s_tid=srchtitle
Think you could also help with this?
Walter Roberson
Walter Roberson el 7 de Abr. de 2022
You have indicated that you have up to 10^9 rows. You are trying to represent those rows visually. I have pointed out that your display has only a small fraction of that resolution.
You could assign each bit to be a "summary" of a range of rows. For example you might decide:
  • first color: no errors in this range, values were majority 0
  • second color: no errors in this range, values were majority 1
  • third color: errors have occurred in this range, the majority of them flipped 0 to 1
  • fourth color: errors have occurred in this range, the majority of them flipped 1 to 0
You do not need to keep track of all of the bits in a block: you could keep track of the number of 0's and 1's and 0-1 errors and 1-0 errors.
You could even animate, keeping statistics over a range of time; decrement by totals counters by the stored numbers from N states ago to "reverse" the effect of that previous state.

Iniciar sesión para comentar.

Categorías

Más información sobre Red 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