Filter löschen
Filter löschen

plotting an matrix on top of an image

15 Ansichten (letzte 30 Tage)
talayeh tavangar
talayeh tavangar am 5 Mai 2020
Kommentiert: S. Walter am 11 Mai 2020
I have an image and I devided it into 10 to 10 matriz and then allocate specific number to each elements. Now, I want to plot the matrix beside or the top of my image, So I can see the number for each elements. can you help me with that?
  3 Kommentare
talayeh tavangar
talayeh tavangar am 5 Mai 2020
my image is a 600*800 matrix I take an average to make it 10*10 and then allocate specific number to each element
talayeh tavangar
talayeh tavangar am 5 Mai 2020
now I want to show the matrix on the top of my original image

Melden Sie sich an, um zu kommentieren.

Antworten (1)

S. Walter
S. Walter am 5 Mai 2020
Bearbeitet: S. Walter am 5 Mai 2020
You can plot your image , set your hold to on (https://www.mathworks.com/help/matlab/ref/hold.html) and then plot your 10 x 10 matrix.
% Using the example on https://www.mathworks.com/help/matlab/ref/image.html
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
% Plot C with scaled mapping
image(C,'CDataMapping','scaled')
% Make a 10x10 matrix
[x,y] = meshgrid(linspace(0.5,4.5,10),linspace(0.5,3.5,10));
% Set the hold to on
hold on
% plot the 10x10 matrix
plot(x,y,'r.')
This should give you the following image:
  9 Kommentare
talayeh tavangar
talayeh tavangar am 11 Mai 2020
V is a 10 in 10 matrix. When I put v instead of x and y the final picture does not show any thing
S. Walter
S. Walter am 11 Mai 2020
When you take the code I supplied above, does the same problem happen? Do you still show nothing?
Can you confirm that your "v" matrix isn't outside the image boundaries?

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by