无论如何,在MATLAB中有没有加粗的imagesc某些区域? [英] Is there anyway to bold certain regions of imagesc in MATLAB?

查看:294
本文介绍了无论如何,在MATLAB中有没有加粗的imagesc某些区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下纯图像示例是从imagesc(rand(10,10))派生的.

The following matrix was derived from imagesc(rand(10,10)) as a pure example.

我想知道MATLAB中是否可以为某些元素提供粗体黑色边框?我在MS Paint中做了一个糟糕的例子,只是为了阐明这一点.

I was wondering if there was a way in MATLAB to give a bold black border to certain elements? I did a poor example in MS paint just to get the point across.

推荐答案

在我看来,另一种更好的选择是使用patch,例如:

An alternative that is better in my view, is to use patch, for example:

imagesc(rand(10,10)), hold on

vert = 0.5+[0 0; 1 0; 1 1; 0 1]; % x and y vertex coordinates
fac = [1 2 3 4];              % vertices to connect to make square

patch('Faces',fac,'Vertices',vert,'FaceColor','none','LineWidth',2)

vert2 = 0.5+[5 6; 5 8; 9 8; 9 5; 7 5; 7 6]; % x and y vertex coordinates
fac2 = [1 2 3 4 5 6 ];  % vertices to connect to make the other closed polygon

patch('Faces',fac2,'Vertices',vert2,'FaceColor','none','LineWidth',2)

请注意,我在顶点坐标上加上0.5的原因是,在imagesc中,分箱以整数值为中心,ans则分箱边缘位于0.5值上.

Note that the reason I added 0.5 to the vertex coordinates is because in imagesc the bins are centered around integer values, ans so the bin edges are on 0.5 values.

这篇关于无论如何,在MATLAB中有没有加粗的imagesc某些区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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