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

4 ビュー (過去 30 日間)
Rishi Balasubramanian
Rishi Balasubramanian 2022 年 3 月 26 日
コメント済み: Walter Roberson 2022 年 4 月 7 日
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 件のコメント
Rishi Balasubramanian
Rishi Balasubramanian 2022 年 3 月 26 日
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.

サインインしてコメントする。

回答 (2 件)

Walter Roberson
Walter Roberson 2022 年 3 月 26 日
  1 件のコメント
Rishi Balasubramanian
Rishi Balasubramanian 2022 年 3 月 27 日
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

サインインしてコメントする。


Image Analyst
Image Analyst 2022 年 3 月 27 日
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 件のコメント
Rishi Balasubramanian
Rishi Balasubramanian 2022 年 4 月 7 日
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 2022 年 4 月 7 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by