Unpack binary image
BW = bwunpack(BWP,m)
BW = bwunpack(BWP,m) unpacks
the packed binary image
uint32 array. When it unpacks
the least significant bit of the first row of
the first pixel in the first row of
BW. The most
significant bit of the first element of
to the first pixel in the 32nd row of
BW, and so
N is the number of columns of
m is omitted, its default value is
This function supports code generation (see Tips).
Binary image packing is used to accelerate some binary morphological
operations, such as dilation and erosion. If the input to
a packed binary image, the functions use a specialized routine to
perform the operation faster.
bwpack is used to create packed binary images.
BWP is of class
must be real, 2-D, and nonsparse. The return value
Pack, dilate, and unpack a binary image.
bw = imread('text.png'); bwp = bwpack(bw); bwp_dilated = imdilate(bwp,ones(3,3),'ispacked'); bw_dilated = bwunpack(bwp_dilated, size(bw,1));
This function supports the generation of C code using MATLAB® Coder™. The code generated for this function uses a precompiled, platform-specific shared library. Use of a shared library preserves performance optimizations but limits the target platforms for which code can be generated. For more information, see Understanding Code Generation with Image Processing Toolbox.
When generating code, all input arguments must be compile-time constants.