0

I am trying to use a threshold to highlight certain pixels in the image and save their coordination in a matrix so that I can highlight the pixels of the same coordination in a different image. How could I do that?

March2020
  • 13
  • 4
  • 1
    It makes a difference if you are processing RGB images or gray-scale images. I recommend that you include your code that thresholds (or rather a simplified version, that we can run ourselves) so we can see the details of your situation. See [mre]. – Cris Luengo Apr 18 '20 at 16:37
  • Images are matrices in MATLAB (of type uint8). Apply the threshold and keep the resulting matrix (which is a binary 2D or 3D matrix of the same size as the original image). Just plot this over the other image but make sure that you adjust the alpha channel;) – max Apr 18 '20 at 16:45

1 Answers1

1

the pixels in a selected image can be uniquely identified as a set of indices stored as a 1D vector. as long as your 2nd image has the same dimension, you can manipulate the pixels using the same index vector.

see example below

im1=peaks;
threshold=0;
im2=-im1;

idx=find(im1>threshold);
mask=zeros(size(im2));
mask(idx)=1;
imagesc(im2.*mask);
figure;
imagesc(im2);
hold on;
contour(mask);
FangQ
  • 1,444
  • 10
  • 18