how to create rounded edges of an irregular object? I want to smoothen the corners of this object.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Respuesta aceptada
Image Analyst
el 8 de Sept. de 2020
You can blur the image with imfilter() or conv2():
windowSize = 21; % Bigger for more blurring.
kernel = ones(windowSize) / windowSize^2;
output = imfilter(rgbImage, kernel);
7 comentarios
Image Analyst
el 27 de Sept. de 2020
Yes. First get the area, then divide by 0.4 to get the number of pixels in the cropped image. Then use indexing to crop it out.
mask = bwareafilt(mask, 1); % Take largest blob only.
props = regionprops(mask, 'area', 'Centroid');
imageArea = area / 0.4;
imageWidth = sqrt(imageArea);
xCentroid = props.Centroid(1);
yCentroid = props.Centroid(2);
xLeftCol = round(xCentroid - imageWidth/2);
xRightCol = round(xCentroid + imageWidth/2);
yTopRow = round(yCentroid - imageWidth/2);
yBottomRow = round(yCentroid + imageWidth/2);
output = mask(yTopRow : yBottomRow, xLeftCol : xRightCol);
Más respuestas (0)
Ver también
Categorías
Más información sobre Get Started with Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!