关于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/11/22 21:51:48
关于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;