MATLAB Answers

How to select irregular area in a pic.

5 views (last 30 days)
Hello! I am working on a project in which i have to select a circular or irregular area and blur the background or the outer area of the selected area. as i have applied smoothing filter to blur the pic but i am having difficulty in selecting area. Can anyone please help me in selecting the shape and aplying the filter only on the outer side of selected shape. And also how can i take selection input from user.

Accepted Answer

Vishnu Vardhan
Vishnu Vardhan on 8 Jun 2019
To find the area you may need to segment your image. If you just want to define the area's vertices somehow, like with roipoly() or imfreehand(), then you can get the area with polyarea(). However if the area is defined by something like intensity, texture, or whatever, then you need to segment the image. Segmentation means undergoing a series of steps such as filtering or morphology or something until you eventually get to an image that can be thresholded to form a binary image (your segmented image). With that binary image you can then label it with bwlabel() or bwconncomp() and then call regionprops(). Or you can call bwarea() for a different definition of area, weighted by how the boundary winds around, whereas regionprops() gives area as a simple count of pixels in the blobs.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by