关于matlab的图像区域提取I=imread('1.jpg');%figure(1);%imshow(I);%I1=0.3*I(:,:,1)+0.59*I(:,:,2)+0.11*I(:,:,3);figure(2);imshow(I);k=waitforbuttonpress;point= get(gca,'CurrentPoint') %mouse pressedrectregion = rbbox point= point(1,1:2)% extra
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/20 15:01:03
![关于matlab的图像区域提取I=imread('1.jpg');%figure(1);%imshow(I);%I1=0.3*I(:,:,1)+0.59*I(:,:,2)+0.11*I(:,:,3);figure(2);imshow(I);k=waitforbuttonpress;point= get(gca,'CurrentPoint') %mouse pressedrectregion = rbbox point= point(1,1:2)% extra](/uploads/image/z/3935358-54-8.jpg?t=%E5%85%B3%E4%BA%8Ematlab%E7%9A%84%E5%9B%BE%E5%83%8F%E5%8C%BA%E5%9F%9F%E6%8F%90%E5%8F%96I%3Dimread%28%271.jpg%27%29%3B%25figure%281%29%3B%25imshow%28I%29%3B%25I1%3D0.3%2AI%28%3A%2C%3A%2C1%29%2B0.59%2AI%28%3A%2C%3A%2C2%29%2B0.11%2AI%28%3A%2C%3A%2C3%29%3Bfigure%282%29%3Bimshow%28I%29%3Bk%3Dwaitforbuttonpress%3Bpoint%3D+get%28gca%2C%27CurrentPoint%27%29++%25mouse+pressedrectregion+%3D+rbbox+point%3D+point%281%2C1%3A2%29%25+extra)
关于matlab的图像区域提取I=imread('1.jpg');%figure(1);%imshow(I);%I1=0.3*I(:,:,1)+0.59*I(:,:,2)+0.11*I(:,:,3);figure(2);imshow(I);k=waitforbuttonpress;point= get(gca,'CurrentPoint') %mouse pressedrectregion = rbbox point= point(1,1:2)% extra
关于matlab的图像区域提取
I=imread('1.jpg');
%figure(1);
%imshow(I);
%I1=0.3*I(:,:,1)+0.59*I(:,:,2)+0.11*I(:,:,3);
figure(2);
imshow(I);
k=waitforbuttonpress;
point= get(gca,'CurrentPoint') %mouse pressed
rectregion = rbbox
point= point(1,1:2)% extract col/row min and maxs
point_x=point(1)
point_y=point(2)
[xmax,ymax]=size(I)
for i=1:xmax
for j=1:ymax
if(sqrt((j-point_x)^2+(i-point_y)^2)40))
I(i,j)=I(i,j);
else
I(i,j)=0;
end
end
end
figure(3)
imshow(I);
我想把以鼠标点击的坐标为圆心的圆提取出来,其余部分变为黑色,可是程序运行完之后,想要提取的那一部分颜色失真,不知道怎么一回事,请各位高手指点
关于matlab的图像区域提取I=imread('1.jpg');%figure(1);%imshow(I);%I1=0.3*I(:,:,1)+0.59*I(:,:,2)+0.11*I(:,:,3);figure(2);imshow(I);k=waitforbuttonpress;point= get(gca,'CurrentPoint') %mouse pressedrectregion = rbbox point= point(1,1:2)% extra
三行错误:
[xmax ymax]=size(I);
I(i,j)=I(i,j);
I(i,j)=0;
更正后:
[xmax ymax zmax]=size(I);
I(i,j,:)=I(i,j,:);
I(i,j,:)=0;