MATLAB ::在MATLAB的图像(矩阵)上绘制数字 [英] MATLAB:: Drawing a number on a image (Matrix) on MATLAB

查看:942
本文介绍了MATLAB ::在MATLAB的图像(矩阵)上绘制数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用matlab来对图像进行修改. 我已经在Matlab上加载了图片. (图像可能具有不同的分辨率) 将图像转换为灰度,然后将图像的矩阵转换为两倍.

I'm using matlab in order to perform modifications on an image. I have loaded an image on Matlab. (the image may be in different resolutions) Converted the image to gray scale then converted the image's matrix to double.

我在图像上画了网格线 (我已经将代码发布到了如何在堆栈上的某处通过流实现该功能).

I have drawn grid lines on the image (I have posted the code how to do that somewhere here on stack over flow).

我的问题是,由于在X轴和Y轴上束起图像,因此可能会有1000个正方形.

My problem is that I may have upon the 1000 squares as a result from girding the image on the X axis and the Y axis.

我想为该图像中的正方形编号.

I'd like to numbering the squares in that image.

在Matlab上可以绘制数字吗? 我很高兴收到有关此的任何信息(除了是一只可单击的猴子,并且在paint haha​​上写0到1000.).

Is there an option of drawing numbers on Matlab ? I'd be glad to receive any information about that (except from being a clicking monkey and writing 0 till 1000 on paint haha... ).

欢呼

推荐答案

下面是一个代码示例,用于在网格中间的图像上放置文本标签:

Here is a code example to put text labels on an image in the middle of grids:

x = imread('cameraman.tif');
image(x)
axis image
grid on
%# grid domains
xg = 0:50:200;
yg = 0:50:200;
%# label coordinates
[xlbl, ylbl] = meshgrid(xg+25, yg+25);
%# create cell arrays of number labels
lbl = strtrim(cellstr(num2str((1:numel(xlbl))')));
text(xlbl(:), ylbl(:), lbl(:),'color','w',...
    'HorizontalAlignment','center','VerticalAlignment','middle');

这篇关于MATLAB ::在MATLAB的图像(矩阵)上绘制数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆