【发布时间】:2016-01-27 17:44:58
【问题描述】:
我正在开发一个 CBIR 系统,我必须按以下方式分割我的 RGB 图像:
我正在 matlab 中实现代码,但无法为其构建正确的掩码。
我使用了imellipse,但这需要使用imshow 实现的图像句柄,但我不想显示我的图像。
我的代码是
img=imread('peppers.png');
h_im=imshow(img); %I want to get rid of imshow because I don't want to show the image
[height, width, planes]=size(img);
%(cX,cY) is image center
cX=width/2;
cY=(height)/2;
%Here I define my ROI which is an ellipse that stretches to 75 percent of
%height and width of the image
e=imellipse(gca,[(1/2-3/8)*width, (1/2-3/8)*height,(3/4)*width,(3/4)*height]);
mymask=createMask(e,h_im);
%extending mask to three channels
mymask=repmat(mymask,[1 1 3]);
ROI=img;
ROI(mymask==0)=0;
figure, imshow(ROI);
【问题讨论】:
标签: matlab image-processing machine-learning computer-vision