to make the rectangle move over the image
2 ビュー (過去 30 日間)
古いコメントを表示
hai
i am new to matlab i doing a project for locating the optic disc for that i have create a rectangular window and make the window to move the image and calculate the sum of edge diff inside the window and divide that by sum of intensity inside the window
now i have created a window but i don't know how to move the rectangular window
this is my code please help me
_clc; clear all; close all; fundus=imread('D:\10mcs010\im0001.ppm'); grayImage=fundus(:,:,1);
subplot(4, 4, 1);
imshow(grayImage);
title('Original Grayscale Image');
binaryImage = grayImage > 35;
% Display the binary image.
subplot(4, 4, 2);
imshow(binaryImage);
title('Binary Image');
A=[0 0 0;0 1 0;0 0 0];
op=imopen(binaryImage,A);
subplot(4,4,3);
imshow(op);
title('open image');
clos=imopen(op,A);
subplot(4,4,4);
imshow(clos);
title('closeimage');
eror=imopen(clos,A);
subplot(4,4,5);
imshow(eror);
subplot(4,4,6);
maskedRgbImage = bsxfun(@times, fundus, cast(eror,class(fundus)));
imshow(maskedRgbImage);
title('RGB IMAGE');
g=maskedRgbImage(:,:,2);
subplot(4,4,7);
imshow(g);
title ('Green component');
subplot(4,4,8);
imv=conv2(double(g),[1 0 -1],'same');
imshow((imv));
title ('vertical image');
subplot(4,4,9);
imh=conv2(double(g),[1;0;-1],'same');
imshow(imh);
re=imh;
imwrite(re,'horizontal.tif');
title ('horizontal image');
edgesum=abs(imh)+abs(imv);
% % intens=impixel(fundus);
%
% % figure,imshow(edgesum);
% edgediff=abs(imv)-abs(imh);
im = imread('horizontal.tif');
subplot(4,4,10);
imshow(im);
r=rectangle('Position',[10,10,12,560]);
set(r,'edgecolor','w') % change the color of the rectangle to white
title('image with rectangle');_
*BOLD TEXT*
1 件のコメント
Walter Roberson
2011 年 8 月 20 日
duplicate is at http://www.mathworks.com/matlabcentral/answers/13866-move-rectangle-over-te-image
回答 (4 件)
Jason
2011 年 8 月 10 日
You can use imrect and use the mouse to size and move. It returns the position and size.
h = imrect;
pos = h.getPosition();
Jason
0 件のコメント
Image Analyst
2011 年 8 月 10 日
How about using rbbox()? It lets your user draw a box. There's sample code in its help.
0 件のコメント
Walter Roberson
2011 年 8 月 20 日
This seems to me to be a make-work project. Moving a virtual array over the data array would be much much more efficient than drawing a rectangle on the screen and figuring out what is inside the drawn portion.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!