数字图像处理中圆形感兴趣区域的提取

xiaoxiao2021-02-28  30

不免自己要用到,给保存起来!! img = imread( 'r_lena.png' ); grayimg = rgb2gray(img); [imgW,imgH] = size(grayimg); t = linspace(0, 2*pi, 50);   %# approximate circle with 50 points r = 100;                      %半径 c = [250 250];               %圆心坐标 %get circular mask BW = poly2mask(r* cos (t)+c(1), r* sin (t)+c(2), imgW, imgH); rgbmask(:,:,1) = BW; rgbmask(:,:,2) = BW; rgbmask(:,:,3) = BW; rgbROI = immultiply(img,rgbmask);% grayROI = immultiply(grayimg,BW); figure,imshow(BW); figure,imshow(rgbROI); figure,imshow(grayROI); 原图: mask: 灰度图mask结果: RGB图mask结果 原图:
转载请注明原文地址: https://www.6miu.com/read-1950388.html

最新回复(0)