how to draw ellipse in image processing for finding border irregularity?
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hi,i am working for image prcessing to find melanoma.for this,i have to find out the border irregularity.So i needed the cpde for drawing an ellipse with the centroid i found before. Please help me out.
0 comentarios
Respuestas (2)
Ameer Hamza
el 8 de Mzo. de 2020
It gives you the option to interactively draw the ellipse, or you can even draw it programmatically by providing the center of the ellipse, length of its axis, and rotation angle. For example,
drawellipse(ax, 'Center',[500,500],'SemiAxes',[200,100],'RotationAngle',90);
ax is the axis on which the image is drawn. The center and axis lengths are in pixels, whereas RotationAngle is in degrees.
Image Analyst
el 10 de Mzo. de 2020
If you want to manually draw an ellipse, see this code:
[rows, columns, numberOfColorChannels] = size(rgbImage);
mask = true(rows, columns); % Initialize so we'll have something in case an error is thrown.
hFig = figure;
imshow(rgbImage);
hFig.WindowState = 'maximized';
h = uicontrol('Position',[20 620 200 40],'String','Accept', 'FontSize', 12, 'FontWeight', 'bold', ...
'Callback','uiresume(gcbf)');
userPrompt = sprintf('Please draw out an ellipse.\nClick the Accept button to the left when done.');
msgboxw(userPrompt);
caption = sprintf('Please draw out an ellipse. Close the window when done.');
title(caption, 'FontSize', 14);
% Have the user interactively drag out the ellipse and adjust its size and position.
roi = drawellipse();
xy = roi.Vertices;
% Quirky other stuff needed to let the user adjust the ellipse and get back the xy coordinates.
% The listener updates xy in the base workspace when the user changes the ellipse.
addlistener(roi, 'ROIMoved', @(src,evt) assignin('base','xy',src.Vertices));
uiwait(hFig);
xy = evalin('base', 'xy'); % Get the xy coordinates from the base workspace.
mask = poly2mask(xy(:, 1), xy(:, 2), rows, columns);
imshow(mask);
drawnow;
close(hFig);
See this to draw ellipses over segmented blobs: Steve Eddins Image Processing Blog
Once you have xy (the coordinates of the ellipse), you can use sqrt() to find the distance from the actual boundary from bwboundaries() to the ellipse. Then get the mean of all those distances.
But, why not just take the blob as it is? Why have the user draw an ellipse? You might be able to use the solidity from regionprops as a relevant metric for border irregularity.
1 comentario
Ver también
Categorías
Más información sobre Biotech and Pharmaceutical en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!