如何删除图像区域以在matlab中留下周围空间 [英] How to remove a region of an image to leave the surrounding space in matlab

查看:177
本文介绍了如何删除图像区域以在matlab中留下周围空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,如果我有灰度图像_I,我需要从中删除region_R以留下周围的空间。

So if I have a grayscale image_I, I need to remove a region_R from it to leave the surrounding space.

到目前为止,我已经

region_R = image_I(regionStartPoint(1):regionStartPoint(1)+size_W(1)-1,...
                   regionStartPoint(2):regionStartPoint(2)+size_W(2)-1);

surroundingSpace = image_I - region_R

感谢您的帮助!

推荐答案

如果删除,您的意思是制作它为0或1,你可以简单地做如下:

If by removing, you mean making it to 0 or 1, than you can simply do as follows:

image_I(regionStartPoint(1):regionStartPoint(1)+size_W(1)-1,...
                   regionStartPoint(2):regionStartPoint(2)+size_W(2)-1) = 0

或者您可以为其分配NaN,

Or you can assign NaN to it,

image_I(regionStartPoint(1):regionStartPoint(1)+size_W(1)-1,...
                   regionStartPoint(2):regionStartPoint(2)+size_W(2)-1) = NaN

这篇关于如何删除图像区域以在matlab中留下周围空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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