How to find the Area for irregular shape in particular region of image?
19 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I Need to find the area of the water body in this image
1 comentario
DGM
el 20 de Feb. de 2023
If you want to save images without losing information, save them using imwrite(), not by creating screenshots or by saving the figure (which is essentially a screenshot).
Respuestas (2)
Jinal
el 17 de Feb. de 2023
Hey Gowtham,
I understand that you wish to find the area of the regions covered by water body in the image you have provided.
You can do this by creating a mask (a b&w image) of the given image such that the regions covered by the water body are the objects in focus i.e. the waterbody covered regions will be white while the rest of the image region will be black.
Once you have the mask in the form of a binary image, the area of the regions covered by the waterbody can be calculated using regionprops function. The code for the same is as follows:
props = regionprops(maskbinaryimage, 'Area');
area = [props.Area];
To create the mask of an image you can use the Graph Cut feature in Image Segmenter. To access the Image Segmenter app you will require the Image Processing Toolbox (can be installed using MATLAB Get Add-Ons feature).
After loading the image in MATLAB Workspace, you will be required to open the Image Segmenter app from the Apps tab, under Image Processing and Computer Vision section. You can also open the app using the command : imageSegmenter(image);
After creating the mask save it by clicking Export. This will create two variables –
- Mask image data as an array
- Mask binary image as a logical array
Pass the binary image (logical array) to regionprops function in order to calculate the required area.
Hope this helps.
2 comentarios
Image Analyst
el 17 de Feb. de 2023
This looks like a pseudocolored image. Can you attach the original grayscale image(s)?
Then I'd determine the proper threshold using my interactive tool:
If (unfortunately) all you have is the pseudocolored image, I'd use the Color Thresholder on the Apps tab of the tool ribbon to find a mask based on color. Then you can use other functions like bwareafilt(), bwareaopen(), and imfill() to clean up the mask based on the color segmentation alone and get rid of non-water regions that got picked up just because they're the same color.
2 comentarios
Image Analyst
el 20 de Feb. de 2023
How do you know which pixels are water? Just by intensity? Do you want to say that all pixels darker than some gray level are water?
It's a generic, general purpose demo of how to threshold an image to find blobs, and then measure things about the blobs, and extract certain blobs based on their areas or diameters.
Ver también
Categorías
Más información sobre Image Processing Toolbox 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!