3) Consider a simple binary image and perform the following compound morphological operations.
a) opening b) closing c) hit-or-miss
(Hint: use imopen, imclose, bwhitmiss MATLAB commands).
Morphological techniques probe an image with a small shape or template called a structuring element. The structuring element is positioned at all possible locations in the image and it is compared with the corresponding neighbourhood of pixels. Some operations test whether the element "fits" within the neighbourhood, while others test whether it "hits" or intersects the neighbourhood:
Probing of an image with a structuring element
(white and grey pixels have zero and non-zero values,
respectively).
A morphological operation on a binary
image creates a new binary image in which the pixel has a non-zero
value only if the test is successful at that location in the input
image.
The structuring element is a small binary image, i.e. a small matrix of pixels, each with a value of zero or one:
Examples of simple structuring elements.
A common practice is to have odd
dimensions of the structuring matrix and the origin defined as the
centre of the matrix. Stucturing elements play in moprphological
image processing the same role as convolution kernels in linear
image filtering.
When a structuring element is placed in a binary image, each of its pixels is associated with the corresponding pixel of the neighbourhood under the structuring element. The structuring element is said to fit the image if, for each of its pixels set to 1, the corresponding image pixel is also 1. Similarly, a structuring element is said to hit, or intersect, an image if, at least for one of its pixels set to 1 the corresponding image pixel is also 1.
Fitting and hitting of a binary image with structuring
elements s1 and s2.
Zero-valued pixels of the structuring
element are ignored, i.e. indicate points where the corresponding
image value is irrelevant.
Fundamental operations
More formal descriptions and examples of how basic morphological operations work are given in the Hypermedia Image Processing Reference (HIPR) developed by Dr. R. Fisher et al. at the Department of Artificial Intelligence in the University of Edinburgh, Scotland, UK.
Erosion and dilation
The erosion of a binary image f by a structuring element s (denoted f s) produces a new binary image g = f s with ones in all locations (x,y) of a structuring element's origin at which that structuring element s fits the input image f, i.e. g(x,y) = 1 is s fits f and 0 otherwise, repeating for all pixel coordinates (x,y).
Greyscale image | Binary image by thresholding | Erosion: a 2×2 square structuring element |
Erosion with small (e.g. 2×2 - 5×5)
square structuring elements shrinks an image by stripping away a
layer of pixels from both the inner and outer boundaries of
regions. The holes and gaps between different regions become
larger, and small details are eliminated:
Erosion: a 3×3 square structuring element
.
Larger structuring elements have a
more pronounced effect, the result of erosion with a large
structuring element being similar to the result obtained by
iterated erosion using a smaller structuring element of the same
shape. If s1 and s2 are a pair of structuring elements identical in
shape, with s2 twice the size of
s1,
then
f s2 ≈ (f s1) s1.
Erosion removes small-scale details
from a binary image but simultaneously reduces the size of regions
of interest, too. By subtracting the eroded image from the original
image, boundaries of each region can be found: b
= f − (f s )
where f is an image of the regions, s
is a 3×3 structuring element,
and b is an image of
the region boundaries.
The dilation of an image f by a structuring element s (denoted f s) produces a new binary image g = f s with ones in all locations (x,y) of a structuring element's orogin at which that structuring element s hits the the input image f, i.e. g(x,y) = 1 if s hits f and 0 otherwise, repeating for all pixel coordinates (x,y). Dilation has the opposite effect to erosion -- it adds a layer of pixels to both the inner and outer boundaries of regions.
Binary image | Dilation: a 2×2 square structuring element |
The holes enclosed by a single region
and gaps between different regions become smaller, and small
intrusions into boundaries of a region are filled in:
Dilation: a 3×3 square structuring element
Results of dilation or erosion are
influenced both by the size and shape of a structuring element.
Dilation and erosion are dual operations in that they have opposite effects.
Let f c denote the complement of an image
f, i.e., the image produced
by replacing 1 with 0 and vice versa. Formally, the duality is
written as
f s = f c srot
where srot
is the structuring element
s rotated by
180. If a structuring element is symmetrical with
respect to rotation, then srot
does not differ from
s. If a binary image is
considered to be a collection of connected regions of pixels set to
1 on a background of pixels set to 0, then erosion is the fitting
of a structuring element to these regions and dilation is the
fitting of a structuring element (rotated if necessary) into the
background, followed by inversion of the result.
Compound operations
Many morphological operations are represented as combinations of erosion, dilation, and simple set-theoretic operations such as the complement of a binary image:
f c(x,y) = 1 if f(x,y) = 0, and f c(x,y) = 0 if f(x,y) = 1,
the
intersection h = f ∩ g of two binary images f
and g:
h(x,y) = 1 if f(x,y) = 1 and g(x,y) = 1, and h(x,y) = 0 otherwise,
and the union
h = f ∪ g of two binary
images f and
g:
h(x,y) = 1 if f(x,y) = 1 or g(x,y) = 1, and h(x,y) = 0 otherwise:
Set operations on binary images: from left to right: a binary
image f,
a binary image g, the complement f c
of f, the intersection f ∩ g, and the union f
∪ g.
The opening
of an image f
by a structuring element
s (denoted by f
s) is an erosion followed by a dilation:
f s = ( f s) s
Binary image | Opening: a 2×2 square structuring element |
Opening is so called because it can
open up a gap between objects connected by a thin bridge of pixels.
Any regions that have survived the erosion are restored to their
original size by the dilation:
Binary image f | f s (5×5 square) | f s (9×9 square) |
Opening is an idempotent operation: once an image has been opened, subsequent openings with the same structuring element have no further effect on that image:
(f s) s) = f s.
The closing of an image f by a structuring element s (denoted by f • s) is a dilation followed by an erosion:
f • s = ( f srot) srot
Binary image | Closing: a 2×2 square structuring element |
In this case, the dilation and erosion should be performed with a rotated by 180 structuring element. Typically, the latter is symmetrical, so that the rotated and initial versions of it do not differ.
Closing with a 3×3 square structuring
element
Closing is so called because it can fill holes in the regions while keeping the initial region sizes. Like opening, closing is idempotent: (f • s) • s = f • s, and it is dual operation of opening (just as opening is the dual operation of closing):
f • s = (f c s)c; f s = (f c • s)c.
In other words, closing (opening) of a
binary image can be performed by taking the complement of that
image, opening (closing) with the structuring element, and taking
the complement of the result.
The hit and miss transform (see also HIPS2 web page) allows to derive information on how objects in a binary image are related to their surroundings. The operation requires a matched pair of structuring elements, {s1, s2}, that probe the inside and outside, respectively, of objects in the image:
f {s1, s2} = (f s1) ∩ (f cs2).
Binary image | Hit and miss transform: an elongated 2×5 structuring element |
A pixel belonging to an object is preserved by the hit and miss transform if and only if s1 translated to that pixel fits inside the object AND s2 translated to that pixel fits outside the object. It is assumed that s1 and s2 do not intersect, otherwise it would be impossible for both fits to occur simultaneously.
It is easier to describe it by considering s1 and s2 as a single structuring element with 1s for pixels of s1 and 0s for pixels of s2; in this case the hit-and-miss transform assigns 1 to an output pixel only if the object (with the value of 1) and background (with the value of 0) pixels in the structuring element exactly match object (1) and background (0) pixels in the input image. Oterwise that pixel is set to the background value (0).
The hit and miss transform can be used for detecting specific shapes (spatial arrangements of object and background pixel values) if the two structuring elements present the desired shape, as well as for thinning or thickening of object linear elements.
Morphological filtering
of a binary image is conducted by considering compound operations like opening and closing as filters. They may act as filters of shape. For example, opening with a disc structuring element smooths corners from the inside, and closing with a disc smooths corners from the outside. But also these operations can filter out from an image any details that are smaller in size than the structuring element, e.g. opening is filtering the binary image at a scale defined by the size of the structuring element. Only those portions of the image that fit the structuring element are passed by the filter; smaller structures are blocked and excluded from the output image. The size of the structuring element is most important to eliminate noisy details but not to damage objects of interest.
3) Consider a simple binary image and perform the following compound morphological operations. a) opening b)...
4) Consider the image a) and use morphological operations to perform: a) Count the number of blobs in the image. (Hint: use bwlabel, bwselect_MATLAB commands) b) Which morphological operations should be employed to get images b, c, and d? Verify your answer. (a) (b) (c) (d)
2) The aim of this project is to explore the role of structuring element on the output image. Consider the following simple binary image. Apply morphological dilation with different structuring elements and different sizes. (Hint: use imdilate, strel MATLAB commands). Image=[00000;01100;01100;00100;00000]
3- Perform the following mathematical operations using binary arithmetic. Use 8 bits of precision for each of the operations. (43)10 (13)10 4- Perform the following mathematical operations using binary arithmetic. Use 8 bits of precision for each of the operations. (11)10 (9)10
3. Perform the following arithmetic operations in Binary and present your resu indicate the C &Z & DC flags status after each operation: (18 Points) (NOTE: another way of indicating that the value is HEX) nd present your results in HEX and also (a) OX48 - 0X75 (d) OX56 - OXAD (b) OXEF + OXAC (e) OX34 - OXE7 (c) OX49 + OX9D (f) OXFE - OX02 6. Perform the following logic operations in Binary and present your results innen...
6. Convert .3710 to a binary fraction of 10 binary digits. 7. Use two's compliment arithmetic to perform the following 8 bit binary operations. a. 0010 1110 + 0001 1011 b. 0101 1101 – 0011 1010 c. 1011 1000 – 1000 1011 d. 1000 1100 – 1111 0111 8. Convert 150.8476562510 to IEEE Floating Point Standard. 9. Simplify the following Boolean expressions. a. xy + xy + xz b. (w + x)(x + y)(w + x + y + z)...
8 - For the following operations: write the operands as 2's complement binary numbers then perform the addition or subtraction operation shown. Show all work in binary operating on 8-bit numbers. • [1 pts) 6+3 . [1 pts) 6-3 • [1 pts) 3 - 6
Perform the indicated arithmetic operations (binary): A) 10001 + 1010 B) 11011 + 100000 C) 10010100 – 1100000 D) 1000000 - 111 E) 110001 x 101 F) 101 x 1110
10.00 points 1 out of 3 attempts Assistan Draw the mirror image of the following compound, and label the compound as chiral or achiral. Be sure to answer all parts. Check M View Hit View Qu Show M Guided Print Questior Report a OH OH draw structure erythrose (a simple sugar) This compound is (select) O Type here to search 曲-# 回ヨ
ord Paragrapth Styles 1 Perform the following conversions Convert 51 (decimal) to binary and to hex a b. Convert 0xDI (hexadecimal) to binary and to decimal c. Convert Ob11001001 (binary) to hex and to decimal 2. Find the 2's complement of the following 4 bit numbers a 1101 b 0101 3. Perform the following 4 bit unsigned operations. For each, indicate the 4-bet result and the carry bit, and indicate if the answer is correct or not a. 5+8 b....
Problem 1: Perform the following number conversions: A. 0x25B9D2 to binary B. binary 1010111001001001 to hexadecimal C. OxA8B3D to binary D. binary 1100100010110110010110 to hexadecimal