Contenu principal

countEachLabel

(Removed) Count number of pixel labels for each class of bigimageDatastore object

The countEachLabel function of the bigimageDatastore object has been removed (since R2026a). Use the countEachLabel function associated with the blockedImageDatastore object instead. For more information, see Version History.

Description

counts = countEachLabel(bigds) returns the number of each pixel label for all big images in big image datastore bigds.

example

Examples

collapse all

Load pixel label data.

load("buildingPixelLabeled.mat");

Specify the classes and pixel label IDs of the pixel label data.

pixelLabelID = [1 2 3 4];
classNames = ["sky" "grass" "building" "sidewalk"];

Create a bigimage to manage the pixel label data.

bigLabeledImage = bigimage(uint8(label),"Classes",classNames, ...
    "PixelLabelIDs",pixelLabelID);

Create a bigimageDatastore that reads blocks of size 200-by-150 pixels at the finest resolution level from bigLabeledImage.

level = 1;
blockSize = [200 150];
biglabelds = bigimageDatastore(bigLabeledImage,level,"BlockSize",blockSize);

Count the number of pixel labels for each class.

tbl = countEachLabel(biglabelds)
tbl=4×3 table
       Name       PixelCount    BlockPixelCount
    __________    __________    _______________

    "sky"              81525        1.58e+05   
    "grass"            32983           51200   
    "building"    1.8036e+05       3.072e+05   
    "sidewalk"         10491           51200   

Input Arguments

collapse all

Big image datastore, specified as a bigimageDatastore object.

Output Arguments

collapse all

Label information, returned as a table that contains three variables.

Pixel Count VariablesDescription
NamePixel label class name
PixelCountNumber of pixels in class
BlockPixelCountTotal number of pixels in blocks that have an instance of the class

Version History

Introduced in R2020a

expand all