필터 지우기
필터 지우기

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

조회 수: 7 (최근 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 CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by