({{, (RefLink[ContourDetect, paclet:ref/ContourDetect])[image] 
gives a binary image in which white pixels correspond to the zeros and zero crossings in image.}, {, (RefLink[ContourDetect, paclet:ref/ContourDetect])[image,delta]
treats values in image that are smaller in absolute value than delta as zero.}, {, (RefLink[ContourDetect, paclet:ref/ContourDetect])[array,…]
gives a binary sparse array in which 1 corresponds to zeros and zero crossings in array. }})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[ContourDetect, paclet:ref/ContourDetect]) finds pixels with zero value as well as pixels with positive values that have at least one negative neighbor.

For color images, (RefLink[ContourDetect, paclet:ref/ContourDetect]) operates on the intensity averaged over all channels.

(RefLink[ContourDetect, paclet:ref/ContourDetect]) works with 3D as well as 2D images, and also with arrays of rank 1, 2, or 3.

(RefLink[ContourDetect, paclet:ref/ContourDetect])[array,delta] effectively chops values smaller in magnitude than delta.

(RefLink[ContourDetect, paclet:ref/ContourDetect]) takes a (RefLink[CornerNeighbors, paclet:ref/CornerNeighbors]) option. The default setting is (RefLink[CornerNeighbors, paclet:ref/CornerNeighbors])->(RefLink[True, paclet:ref/True]).

Using the option setting (RefLink[CornerNeighbors, paclet:ref/CornerNeighbors])->(RefLink[None, paclet:ref/None]), (RefLink[ContourDetect, paclet:ref/ContourDetect]) operates on the dual grid whose pixels correspond to the corners in the original image, thereby reducing the dimensions of the resulting image by one pixel.

OpenersPrimaryExamplesSection(Spacer1)Examples  (11)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Zeros and zero crossings of a list:

ContourDetect[{4,0,1,-2,1,-2,-3,-1,3}]//Normal

Find zeros and zero crossings in a real-valued image:

ContourDetect[]

OpenersExampleSection1(Spacer1)Scope  (3)

Find zeros and zero crossings in a matrix:

ContourDetect[(({{1, -1, -1}, {0, 0, 1}, {1, 1, 1}}))] // MatrixForm

Find a thick contour of a blurred object:

ContourDetect[ImageSubtract[,0.3], 0.05]

Find values below a given threshold:

ContourDetect[,0.25]

OpenersExampleSection2(Spacer1)Options  (1)

OpenersExampleSubsection0(Spacer1)CornerNeighbors  (1)

This operates on the dual grid:

ContourDetect[{1,-1,1,1,0},CornerNeighbors -> None]//Normal

OpenersExampleSection3(Spacer1)Applications  (2)

Find a contour line in an elevation raster:

ContourDetect[ImageSubtract[,0.25]]

Find flat regions in an image by detecting the zero contour of its second derivative:

ContourDetect[LaplacianGaussianFilter[,1],0.08]

OpenersExampleSection4(Spacer1)Properties & Relations  (2)

When converting a real-valued image to type (StringTypeLink["Byte", paclet:ref/format/Byte]), all negative values will be clipped to zero:

ContourDetect[Image[,"Byte"]]

Illustrate the effect of the LoG filter:

ContourDetect[LaplacianGaussianFilter[,6],0.01]

OpenersExampleSection5(Spacer1)Possible Issues  (1)

All data dimensions should be greater than 1 to construct the dual grid using (RefLink[CornerNeighbors, paclet:ref/CornerNeighbors])->(RefLink[None, paclet:ref/None]):

ContourDetect[{{1,-.2,.4,0,0,1}},CornerNeighbors->None]

Use (RefLink[CornerNeighbors, paclet:ref/CornerNeighbors])->(RefLink[Automatic, paclet:ref/Automatic]) instead:

ContourDetect[{{1,-.2,.4,0,0,1}},CornerNeighbors->Automatic]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[CrossingDetect, paclet:ref/CrossingDetect])  ▪  (RefLink[Threshold, paclet:ref/Threshold])  ▪  (RefLink[MorphologicalPerimeter, paclet:ref/MorphologicalPerimeter])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Feature Detection, paclet:guide/FeatureDetection])}, {▪(RefLinkPlain[3D Images, paclet:guide/3DImages])}})}})