How to add scale bar on microscopy images?
35 views (last 30 days)
Show older comments
Peyman Obeidy
on 16 Mar 2015
Commented: Peyman Obeidy
on 6 May 2015
I have the following code for making movie out of my microscopy images. I would like to add a Scale Bar to it. How do I do that?
writerObj = VideoWriter([pName '20141209_Ch1_5_big.avi']);
open(writerObj)
for i=1:500
close
imcomp(CoreimgRed(:,:,i),correctNEWgreenImg(:,:,i),'y');
set(gcf,'Color',[1 1 1])
axis off
text(12,154,[num2str(i*0.2) 's'],'Color',[1 1 0.99],'FontSize',20)
frame = getframe;
writeVideo(writerObj,frame);
end
close(writerObj)
0 Comments
Accepted Answer
Image Analyst
on 17 Mar 2015
What does imcomp() do? That function should return an image that you can then write some color in there, like black or white or red. Then pass to imshow() and then call drawnow and write the frame out to your video.
thisImage = imcomp(........
thisImage(row1:row2, column1:column2, :) = [255, 0, 0]; % Write red bar into image.
imshow(thisImage);
drawnow;
You have to figure out what rows and columns correspond to 1 micron. Attached is my spatial calibration demo if you want the user to do it by manually specifying the length.
8 Comments
Image Analyst
on 5 May 2015
That will give a one pixel high line - might be hard to see. My code gives you control over the bar thickness.
More Answers (0)
See Also
Categories
Find more on Read, Write, and Modify Image in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!