简体   繁体   English

如何在Matlab中突出显示图像中的感兴趣区域

[英]How to highlight a region of Interest in an image in Matlab

我想知道如何在给定/指定位置的Matlab图像中突出显示感兴趣的蒙版/区域(或如何标记识别的对象)?

Another useful command is rectangle . 另一个有用的命令是rectangle Suppose rect holds the bounding box around the object (in format [ from_x from_y width height] ), then the following code will produce a box around the object in the image: 假设rect保持对象周围的边框(格式为[ from_x from_y width height] ),那么以下代码将在图像中的对象周围生成一个框:

figure('Name', 'showing detected object');
imshow( img ); % show original image
hold all;  % hold image and plot rectangle on top
rectangle( 'Position', rect );

if you have all the vertexes of the region you are interested in you can simply use the line command. 如果您拥有该区域的所有顶点,则只需使用line命令即可。 I post you how to draw a rectangle having the four vertexes (each a pair of x,y coordinates). 我向您发布了如何绘制具有四个顶点(每个x,y坐标对)的矩形。

rect1=[a';b';c';d';a'];

line(rect1(:,1),rect1(:,2),'LineWidth',5);

I don't know if that is what you are looking for. 我不知道那是你在找什么。

If you want the user to select a region on an image, then you can use the functions: 如果要用户选择图像上的区域,则可以使用以下功能:

imrect
impoly
imellipse
imline

from the Image Processing toolkit. 从图像处理工具箱中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM