0

I'm looking for a command in Matlab that does not display an image with the colors, but the value for the pixel.

for example: in pixel (1,1) is black and is 0. I just wanted to represent the value 0 in a figure. In addition, the image is in DICOM format.

With impixelregion only returns a figure and not a matrix.

The following code did not work:

a=imread('a1.png');
figure
I=imshow(a,[])
%b=num2str(a(500,500)) %gibt wert zurück
[Z,S]=size(a)
for i=1:Z
  for j=1:S
    text(i,j,num2str(a(i,j)),'FontSize',2);
  end
end

enter image description here

I would be grateful for your help :)

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
  • 3
    Wouldn't opening the image, `I` in the workspace window suffice? It'll be quite difficult to fit all the image's intensity values in a figure if it's fairly large. – MichaelTr7 Mar 14 '21 at 00:51
  • Just leave the semicolon off the end of the `imread` line and you'll get all the values you could want. – beaker Mar 14 '21 at 15:59
  • Guessing this may be an XY problem where seeing all the values at once isn't actually the goal. Data tips would let you inspect an individual pixel and its value as you click on it - to turn on for images shown with `imshow` use *Tools > Data Tips* or use the toolbar shortcut. – Will Mar 14 '21 at 17:06

0 Answers0