Unpack binary image
BW = bwunpack(BWP,m)
Read binary image into the workspace.
BW = imread('text.png'); imshow(BW)
Pack the image.
BWp = bwpack(BW);
Dilate the packed image.
BWp_dilated = imdilate(BWp,ones(3,3),'ispacked');
Unpack the dilated image and display it.
BW_dilated = bwunpack(BWp_dilated, size(BW,1)); imshow(BW_dilated)
BWP— Packed binary image
Packed binary image, specified as a 2-D numeric array of data type
BWP, the function maps the
least significant bit of the first row of
BWP to the first pixel in the
first row of
BW. The most significant bit of the first element of
BWP maps to the first pixel in the 32nd row of
Usage notes and limitations:
bwunpack supports the generation of C
code (requires MATLAB®
Coder™). Note that if you choose the generic
MATLAB Host Computer
bwunpack generates code that 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 Code Generation Using a Shared Library.
When generating code, all input arguments must be compile-time constants.