为某些选定区域中的像素提供特定的值 [英] Giving specific values to pixels in some selected region

查看:70
本文介绍了为某些选定区域中的像素提供特定的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在MATLAB中执行以下操作:

I'm trying to do the following in MATLAB:

  • 选择一些感兴趣的区域
  • 将该区域中的像素的值设置为例如1

我不确定,imfreehand是选择感兴趣区域的起点吗?那怎么办?

I'm not sure, would imfreehand be a starting point here for selecting the region of interest. What then?

如何在MATLAB中完成此操作?

谢谢.

推荐答案

这里是一个简短的示例.由于您提到了imfreehand,因此我将其包括在内,但根据您要创建哪种ROI的类型,impolyimrect可能会做得更好:

Here is a short sample. Since you mentioned imfreehand, I included that but depending on what type of ROI you want to create, impoly or imrect may do a better job:

img = im2double(imread('cameraman.tif'));
imshow(img);
roi = imfreehand;
img2 = img;
img2(roi.createMask) = 1;
imshow(img2);

这篇关于为某些选定区域中的像素提供特定的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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