我创建了一个合成图像,该图像由一个框中心的圆圈组成,代码如下。
%# Create a logical image of a circle with image size specified as follows:
imageSizeY = 400;
imageSizeX = 300;
[ygv, xgv] = meshgrid(1:imageSizeY, 1:imageSizeX);
%# Next create a logical mask for the circle with specified radius and center
centerY = imageSizeY/2;
centerX = imageSizeX/2;
radius = 100;
Img = double( (ygv - centerY).^2 + (xgv - centerX).^2 <= radius.^2 );
%# change image labels from double to numeric
for ii = 1:numel(Img)
if Img(ii) == 0
Img(ii) = 2; %change label from 0 to 2
end
end
%# plot image
RI = imref2d(size(Img),[0 size(Img, 2)],[0 size(Img, 1)]);
figure, imshow(Img, RI, [], 'InitialMagnification','fit');
现在,我需要在图像上创建一个矩形遮罩(标签 == 3,行/列尺寸:1 by imageSizeX),并与圆的边缘成已知角度(见附图)。另外,如何通过 imageSizeX 使矩形比 1 厚?作为另一种选择,我很想尝试让矩形停止在第 350 列。最后,有什么想法可以提高分辨率吗?我的意思是可以在增加/减少分辨率的同时保持图像大小相同。
我不知道该怎么做。请我需要任何我能得到的帮助/建议/建议。非常感谢!。