how to put a ruler in an image?

34 views (last 30 days)
I have an image with a resolution of (556 * 292) pixel. The height of image is 108 mm. how to put a ruler on image so that the expected output file will look like image shown (image is manualy edited). first one is input image and second one is expected output image.
Spray 1.png
spray 2.jpg

Accepted Answer

Hiro Yoshino
Hiro Yoshino on 2 Dec 2019
What command did you use to show the image?
Try imshow(), and set the xdata or ydata properties to meet what you want.
  2 Comments
Balram Sahu
Balram Sahu on 2 Dec 2019
thank you
problem is solved
Akhilesh Joshi
Akhilesh Joshi on 4 Feb 2021
If we want origin at other positions ? in my case i want origin in third quadrant.

Sign in to comment.

More Answers (2)

KALYAN ACHARJYA
KALYAN ACHARJYA on 2 Dec 2019
Edited: KALYAN ACHARJYA on 2 Dec 2019
im=imread('Spray1.png');
imagesc(im);
ylim([0 100]);
set(gca,'XTick',[])
78.png
More: All ticks 0,10,20.....100
im=imread('Spray1.png');
imagesc(im);
ylim([0 100]);
yticks([0 10 20 30 40 50 60 70 80 90 100])
set(gca,'XTick',[])
98.png
Hope it Helps!
  3 Comments
KALYAN ACHARJYA
KALYAN ACHARJYA on 2 Dec 2019
Edited: KALYAN ACHARJYA on 2 Dec 2019
These are not pixel values
Balram Sahu
Balram Sahu on 2 Dec 2019
thank you sir,
problem is solved

Sign in to comment.


Balram Sahu
Balram Sahu on 2 Dec 2019
im=imread('spray.png');
imshow(im,'XData', [0 36.39],'YData',[0 108] )
set(gca,'XTick',[])
axis on

Community Treasure Hunt

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

Start Hunting!