Image.zerocross#

Image.zerocross() Any[source]#

Compute zero crossing

Returns:

boolean image

Return type:

Image instance

Compute a zero-crossing image, where pixels are true if they are adjacent to a change in sign.

Example:

>>> from machinevisiontoolbox import Image, meshgrid
>>> U, V = meshgrid(6, 6)
>>> img = Image(U - V - 2, dtype='float')
>>> img.print()
   -2.00 -1.00  0.00  1.00  2.00  3.00
   -3.00 -2.00 -1.00  0.00  1.00  2.00
   -4.00 -3.00 -2.00 -1.00  0.00  1.00
   -5.00 -4.00 -3.00 -2.00 -1.00  0.00
   -6.00 -5.00 -4.00 -3.00 -2.00 -1.00
   -7.00 -6.00 -5.00 -4.00 -3.00 -2.00
>>> img.zerocross().print()
   0 0 0 1 0 0
   0 0 1 0 1 0
   0 0 0 1 0 1
   0 0 0 0 1 0
   0 0 0 0 0 0
   0 0 0 0 0 0

Note

Uses morphological filtering with 3x3 structuring element, which can lead to erroneous values in border pixels.

References:
Seealso:

Laplace LoG