327 views

Uploaded by Poonam Sharma

- historyofmatricesproject
- Region Props PDF
- AarielHall_Animator_Resume_2017
- Programmers Guide to the Java 2D API - Book
- Viewing
- Algebra I Review Sheet[1].doc
- FE-CBT-Mechanical-Problems-Solutions.pdf
- Advanced Finite Element Analysis
- DirectionCosineMatrix
- c++ program
- Sammelmappe_Uebungen
- Maximal and minimal solutions for two-sided problem of type (1, n) in max-min algebra
- Tobler 1979 CellularGeog
- UNIT-IV_
- 3.Geometry.pdf
- Kuliah minggu ke 8 Transformations.pps
- transformations
- 1.1 notes
- 1-s2.0-S0378873396003036-main
- MATB 113 TEST1 s2 1112 (ANS- ACTUAL)1.doc

You are on page 1of 9

Syntax

STATS STATS STATS STATS = = = = regionprops(BW, properties) regionprops(CC, properties) regionprops(L, properties) regionprops(..., I, properties)

Description

measures a set of properties for each connected component (object) in the binary image, BW. The image BW is a logical array; it can have any dimension.

STATS = regionprops(BW, properties) STATS = regionprops(CC, properties) measures a set of properties for each connected component (object) in CC, which is a structure returned by bwconncomp. STATS = regionprops(L, properties) measures a set of properties for each labeled region in the label matrix L. Positive integer elements of L correspond to different regions. For example, the set of elements of L equal to 1 corresponds to region 1; the set of elements of L equal to 2 corresponds to region 2; and so on. STATS = regionprops(..., I, properties) measures a set of properties for each labeled region in the image I. The first input to regionpropseither BW, CC, or L identifies the regions in I. The sizes must match: size(I) must equal size(BW), CC.ImageSize, or size(L). STATS is a structure array with length equal to the number of objects in BW, CC.NumObjects, or max(L(:)). The fields of the structure array denote different properties for each region, as specified by properties.

Properties

can be a comma-separated list of strings, a cell array containing strings, the single string 'all', or the string 'basic'. If properties is the string 'all', regionprops computes all the shape measurements, listed in Shape Measurements. If called with a grayscale image, regionprops also returns the pixel value measurements, listed in Pixel Value Measurements. If properties is not specified or if it is the string 'basic', regionprops computes only the 'Area', 'Centroid', and 'BoundingBox' measurements. You can calculate the following properties on N-D inputs: 'Area',

properties

Shape Measurements

'Area' 'BoundingBox' 'Centroid' 'ConvexArea' 'ConvexHull' 'ConvexImage' 'Eccentricity' 'EulerNumber' 'Extent' 'Extrema' 'FilledArea' 'FilledImage' 'Image' 'MajorAxisLength' 'Orientation' 'Perimeter' 'PixelIdxList'' 'PixelList' 'Solidity' 'SubarrayIdx'

'EquivDiameter' 'MinorAxisLength'

'MaxIntensity' 'MinIntensity' 'WeightedCentroid'

'MeanIntensity' 'PixelValues'

Definitions

Scalar; the actual number of pixels in the region. (This value might differ slightly from the value returned by bwarea, which weights different patterns of pixels differently.)

'Area' 'BoundingBox' The smallest rectangle containing the region, a 1-by-Q *2 where Q is the number of image dimensions: ndims(L), ndims(BW), or numel(CC.ImageSize). BoundingBox is [ul_corner width], where: ul_corner width

vector,

is in the form [x y z ...] and specifies the upper-left corner of the bounding box is in the form [x_width y_width ...] and specifies the width of the bounding box along each dimension

1-by-Q vector that specifies the center of mass of the region. Note that the first element of Centroid is the horizontal coordinate (or x-coordinate) of the center of mass, and the second element is the vertical coordinate (or y-coordinate). All other elements of Centroid are in order of dimension.

'Centroid'

This figure illustrates the centroid and bounding box. The region consists of the white pixels; the green box is the bounding box, and the red dot is the centroid.

p-by-2 matrix that specifies the smallest convex polygon that can contain the region. Each row of the matrix contains the x- and y-coordinates of one vertex of the polygon. This property is supported only for 2-D input label matrices.

'ConvexHull'

Binary image (logical) that specifies the convex hull, with all pixels within the hull filled in (i.e., set to on). (For pixels that the boundary of the hull passes through, regionprops uses the same logic as roipoly to determine whether the pixel is inside or outside the hull.) The image is the size of the bounding box of the region. This property is supported only for 2-D input label matrices.

'ConvexImage'

Scalar that specifies the number of pixels in 'ConvexImage'. This property is supported only for 2-D input label matrices.

'ConvexArea'

Scalar that specifies the eccentricity of the ellipse that has the same second-moments as the region. The eccentricity is the ratio of the distance between the foci of the ellipse and its major axis length. The value is between 0 and 1. (0 and 1 are degenerate cases; an ellipse whose eccentricity is 0 is actually a circle, while an ellipse whose eccentricity is 1 is a line segment.) This property is supported only for 2-D input label matrices.

'Eccentricity'

Scalar that specifies the diameter of a circle with the same area as the region. Computed as sqrt(4*Area/pi). This property is supported only for 2-D input label matrices.

'EquivDiameter'

Scalar that specifies the number of objects in the region minus the number of holes in those objects. This property is supported only for 2-D input label matrices. regionprops uses 8-connectivity to compute the EulerNumber measurement. To learn more about connectivity, see Pixel Connectivity.

'EulerNumber'

Scalar that specifies the ratio of pixels in the region to pixels in the total bounding box. Computed as the Area divided by the area of the bounding box. This property is supported only for 2-D input label matrices.

'Extent'

8-by-2 matrix that specifies the extrema points in the region. Each row of the matrix contains the x- and y-coordinates of one of the points. The format of the vector is [top-left top-right right-top right-bottom bottom-right bottom-left left-bottom left-top]. This property is supported only for 2-D input label matrices.

'Extrema'

This figure illustrates the extrema of two different regions. In the region on the left, each extrema point is distinct. In the region on the right, certain extrema points (e.g., topleft and left-top) are identical.

'FilledArea'

'FilledImage' Binary image (logical) of the same size as the bounding region. The on pixels correspond to the region, with all holes filled in.

'Image' Binary image (logical) of the same size as the bounding the on pixels correspond to the region, and all other pixels are off. 'MajorAxisLength'

Scalar specifying the length (in pixels) of the major axis of the ellipse that has the same normalized second central moments as the region. This property is supported only for 2-D input label matrices.

'MaxIntensity'

Scalar specifying the value of the pixel with the greatest intensity in Scalar specifying the mean of all the intensity values in the region.

the region.

'MeanIntensity'

'MinIntensity'

Scalar specifying the value of the pixel with the lowest intensity in

the region. Scalar; the length (in pixels) of the minor axis of the ellipse that has the same normalized second central moments as the region. This property is supported only for 2-D input label matrices.

'MinorAxisLength'

Scalar; the angle (in degrees ranging from -90 to 90 degrees) between the x-axis and the major axis of the ellipse that has the same second-moments as the region. This property is supported only for 2-D input label matrices.

'Orientation'

This figure illustrates the axes and orientation of the ellipse. The left side of the figure shows an image region and its corresponding ellipse. The right side shows the same ellipse, with features indicated graphically:

The solid blue lines are the axes. The red dots are the foci. The orientation is the angle between the horizontal dotted line and the major axis.

Scalar; the distance around the boundary of the region. regionprops computes the perimeter by calculating the distance between each adjoining pair of pixels around the border of the region. If the image contains discontiguous regions, regionprops returns unexpected results. The following figure shows the pixels included in the perimeter calculation for this object.

'Perimeter'

'PixelIdxList'

region. p-by-Q matrix specifying the locations of pixels in the region. Each row of the matrix has the form [x y z ...] and specifies the coordinates of one pixel in the region.

'PixelList'

p-by-1 vector, where p is the number of pixels in the region. Each element in the vector contains the value of a pixel in the region.

'PixelValues'

Scalar specifying the proportion of the pixels in the convex hull that are also in the region. Computed as Area/ConvexArea. This property is supported only for 2D input label matrices.

'Solidity' 'SubarrayIdx' Cell-array containing indices elements of L inside the object bounding box. 'WeightedCentroid'

p-by-Q vector of coordinates specifying the center of the region based on location and intensity value. The first element of WeightedCentroid is the horizontal coordinate (or x-coordinate) of the weighted centroid. The second element is the vertical coordinate (or y-coordinate). All other elements of WeightedCentroid are in order of dimension.

Class Support

If the first input is BW, BW must be a logical array and it can have any dimension. If the first input is CC, CC must be a structure returned by bwconncomp. If the first input is L, L must be real, nonsparse, and contain integers. L can have any numeric class and any dimension.

Tips

Note on Terminology

You can use regionprops on contiguous regions and discontiguous regions. Contiguous regions are also called "objects," "connected components," and "blobs." A label matrix containing contiguous regions might look like this:

1 1 0 2 2 0 3 3 1 1 0 2 2 0 3 3

Elements of L equal to 1 belong to the first contiguous region or connected component; elements of L equal to 2 belong to the second connected component; etc.

Discontiguous regions are regions that might contain multiple connected components. A label matrix containing discontiguous regions might look like this:

1 1 0 1 1 0 2 2 1 1 0 1 1 0 2 2

Elements of L equal to 1 belong to the first region, which is discontiguous and contains two connected components. Elements of L equal to 2 belong to the second region, which is a single connected component.

The function ismember is useful in conjunction with regionprops, bwconncomp, and labelmatrix for creating a binary image containing only objects or regions that meet certain criteria. For example, these commands create a binary image containing only the regions whose area is greater than 80.

cc = bwconncomp(BW); stats = regionprops(cc, 'Area'); idx = find([stats.Area] > 80); BW2 = ismember(labelmatrix(cc), idx);

The comma-separated list syntax for structure arrays is very useful when you work with the output of regionprops. For example, for a field that contains a scalar, you can use this syntax to create a vector containing the value of this field for each region in the image. For instance, if stats is a structure array with field Area, then the following two expressions are equivalent:

stats(1).Area, stats(2).Area, ..., stats(end).Area

and

stats.Area

Therefore, you can use these calls to create a vector containing the area of each region in the image.

stats = regionprops(L, 'Area'); allArea = [stats.Area]; allArea

Performance Considerations

Most of the measurements take very little time to compute. However, there are a few measuements, listed below, that can take significantly longer, depending on the number of regions in L:

'ConvexHull' 'ConvexImage' 'ConvexArea' 'FilledImage'

Note that computing certain groups of measurements takes about the same amount of time as computing just one of them because regionprops takes advantage of intermediate computations used in both computations. Therefore, it is fastest to compute all the desired measurements in a single call to regionprops.

The functions bwlabel, bwlabeln, and bwconncomp all compute connected components for binary images. bwconncomp replaces the use of bwlabel and bwlabeln. It uses significantly less memory and is sometimes faster than the other functions. Function

bwlabel bwlabeln bwconncomp

CC

struct

The output of bwlabel and bwlabeln is a double-precision label matrix. To compute a label matrix using a more memory-efficient data type, use the labelmatrix function on the output of bwconncomp:

CC = bwconncomp(BW); L = labelmatrix(CC);

To extract features from a binary image using regionprops with the default connectivity, it is no longer necessary to call bwlabel or bwlabeln first. You can simply pass the binary image directly to regionprops, which then uses the memory-efficient bwconncomp to compute the connected components automatically for you. To extract features from a binary image using a nondefault connectivity, call bwconncomp first and then pass the result to regionprops:

CC = bwconncomp(BW, CONN); S = regionprops(CC);

Examples

Label the connected pixel components in the text.png image, compute their centroids, and superimpose the centroid locations on the image:

BW = imread('text.png'); s = regionprops(BW, 'centroid'); centroids = cat(1, s.Centroid); imshow(BW) hold on plot(centroids(:,1), centroids(:,2), 'b*') hold off

- historyofmatricesprojectUploaded byapi-239316362
- Region Props PDFUploaded byRobert Tarré Fernández
- AarielHall_Animator_Resume_2017Uploaded byAariel Hall
- Programmers Guide to the Java 2D API - BookUploaded byearmarques
- ViewingUploaded bySabareesan Subramanian
- Algebra I Review Sheet[1].docUploaded byDorothy Dwyer
- FE-CBT-Mechanical-Problems-Solutions.pdfUploaded byMonish Prasad Sapkota
- Advanced Finite Element AnalysisUploaded byIbmWasuser
- DirectionCosineMatrixUploaded byNeelam Shukla
- c++ programUploaded byGurinder Pal Singh
- Sammelmappe_UebungenUploaded byzemabder
- Maximal and minimal solutions for two-sided problem of type (1, n) in max-min algebraUploaded byPavel Krbálek
- Tobler 1979 CellularGeogUploaded byJose Northern Lights
- UNIT-IV_Uploaded bytarasasanka
- 3.Geometry.pdfUploaded byybourini
- Kuliah minggu ke 8 Transformations.ppsUploaded byTiara Adrian
- transformationsUploaded byapi-379150276
- 1.1 notesUploaded byZain Rajpoot
- 1-s2.0-S0378873396003036-mainUploaded byDrHanan Sanad
- MATB 113 TEST1 s2 1112 (ANS- ACTUAL)1.docUploaded byBelleRz12
- What is Digital ArtUploaded byninasweet
- time4Uploaded byababacarba
- listofprogramC++Uploaded byKanchan Khurana
- תכן לוגי מתקדם- הרצאה 3 (עוד המשך) | Functional ClassificationUploaded byRon
- IGREV320616.pdfUploaded byPeter Sobolev
- C++ AssignmentUploaded bySourav Roy
- Locating Facilities 2Uploaded byShahzad Hassan Jaffar
- PPT_Econ_9e_one_click_ch01.pptUploaded byErsin Tukenmez
- ti36pro guidebook en 1Uploaded byapi-162570032
- LAB3Uploaded bytarek mahmoud

- Chapter 6 Debraj RayUploaded bymuhammadsiddique990
- M.Tech June - 2013Uploaded bylog
- table talk strategyUploaded byapi-248208787
- Intel VTuneUploaded byDvijesh
- 'Farming in 10 Years time' From an AgriChatuk discussion via @rusourceUploaded byrob yorke
- Fast Radio Bearer SetupUploaded byVictor Perez Jimenez
- Chapter 1 Introduction 1Uploaded byMaverick Caermare Agulto
- ON-AIR_Publication_2012_full.pdfUploaded byMariela Silva
- Reviewing the Existing LiteratureUploaded byOxfam
- 10. Cocu 5 - Storyboard Development (New)Uploaded bynoor an nisaa zulkefli
- Web Dynpro ABAP vs. JavaUploaded byojnc
- Geomatics ConceptUploaded byNuramalina
- photosynthesis & cellular respiration foldable presentationUploaded byapi-249582169
- Sage Chap17.pdfUploaded byDaniel Esteban Matapi Gómez
- Online Quiz 4 Efficient Portfolios Q&AUploaded byjon
- How Does a Boomerang WorkUploaded byspaceskipper
- ashley enslen 3Uploaded byapi-283540060
- 3.UsersManual.pdfUploaded by黃鼎峰
- Twelve Things You Don't Learn in School PaperUploaded byciarmel
- ME Math ToolUploaded byMario Labastida Ayuban
- Control Flow CoverageUploaded byTrandafir Carmen
- Physiognomy or Face Reading Body Language Physiognomy and How to Read Different Faces.Uploaded byUtpal Kumar
- Types of SocietiesksnmlsnclsdnvspdnvpsdnvsdknvsdnvdUploaded byjomar_1600
- Cct for Rate ReactionUploaded byFatinAzahra
- literature reviewUploaded byapi-273451340
- The Effect of Gamma Radiation on Freezing Tolerance of Chickpea (Cicer Aretinum L.) at in Vitro CultureUploaded byBagus Herwibawa
- Discussion and Conclusion(Flat Boundary Layer)Uploaded byFalcon Ford
- Definition & Scope of Political ScienceUploaded bybiplob
- B5 GeniE Deck With Detailed JointUploaded byJorge Hernandez
- מטבוליזםUploaded byZiv Ash