Are there any bold specific areas of imagesc in MATLAB?

As a pure example, from the images c (rand (10,10)) the following matrix was obtained. enter image description here

I was wondering if there is a way in MATLAB to highlight a bold black border to certain elements? I made a bad example in MS paints to get the point.enter image description here

+4
source share
2 answers

An alternative that is better in my opinion 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)

enter image description here

Note that the reason I added 0.5 to the coordinates of the vertices is because the imagescbins are centered around integer values, so the edges of the bin are 0.5 values.

+4
source

You can simply use it plotto draw lines wherever you want.

imagesc(rand(10,10)), hold on
plot([1.5,1.5],[0,10],'black','LineWidth',3)

and then define your bounding fields as you want.

+2
source

Source: https://habr.com/ru/post/1599383/


All Articles