laplacelaplaceLaplaceLaplacelaplace (算子)
名称
laplacelaplaceLaplaceLaplacelaplace — 使用有限差分计算拉普拉斯算子。
签名
void Laplace(const HObject& Image, HObject* ImageLaplace, const HTuple& ResultType, const HTuple& MaskSize, const HTuple& FilterMask)
HImage HImage::Laplace(const HString& ResultType, const HTuple& MaskSize, const HString& FilterMask) const
HImage HImage::Laplace(const HString& ResultType, Hlong MaskSize, const HString& FilterMask) const
HImage HImage::Laplace(const char* ResultType, Hlong MaskSize, const char* FilterMask) const
HImage HImage::Laplace(const wchar_t* ResultType, Hlong MaskSize, const wchar_t* FilterMask) const
(
Windows only)
描述
laplacelaplaceLaplaceLaplaceLaplacelaplace filters the input images ImageImageImageImageimageimage using a
Laplace operator. Depending on the parameter FilterMaskFilterMaskFilterMaskFilterMaskfilterMaskfilter_mask
the following approximations of the Laplace operator are used:
- 'n_4'
1
1 -4 1
1
- 'n_8'
1 1 1
1 -8 1
1 1 1
- 'n_8_isotropic'
10 22 10
22 -128 22
10 22 10
For the three filter masks the following normalizations of the
resulting gray values is applied, (i.e., by dividing the result by
the given divisor): 'n_4'"n_4""n_4""n_4""n_4""n_4" normalization by 1, 'n_8'"n_8""n_8""n_8""n_8""n_8", normalization
by 2 and for 'n_8_isotropic'"n_8_isotropic""n_8_isotropic""n_8_isotropic""n_8_isotropic""n_8_isotropic" normalization by 32.
For a Laplace operator with size 3x3, the
corresponding filter is applied directly, while for larger filter
sizes the input image is first smoothed using a Gaussian
filter (see
gauss_imagegauss_imageGaussImageGaussImageGaussImagegauss_image) or a binomial filter (see
binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilterbinomial_filter) of size
MaskSizeMaskSizeMaskSizeMaskSizemaskSizemask_size-2. The Gaussian
filter is selected for the above values of
ResultTypeResultTypeResultTypeResultTyperesultTyperesult_type.
Here,
MaskSizeMaskSizeMaskSizeMaskSizemaskSizemask_size = 5, 7, 9, 11, or 13 must be used. The
binomial filter is selected by appending
'_binomial'"_binomial""_binomial""_binomial""_binomial""_binomial" to the
above values of
ResultTypeResultTypeResultTypeResultTyperesultTyperesult_type. Here,
MaskSizeMaskSizeMaskSizeMaskSizemaskSizemask_size can be
selected between 5 and 39. Furthermore, it is possible to select
different amounts of smoothing for the column and row direction by
passing two values in
MaskSizeMaskSizeMaskSizeMaskSizemaskSizemask_size. Here, the first value of
MaskSizeMaskSizeMaskSizeMaskSizemaskSizemask_size corresponds to the mask width (smoothing in the
column direction), while the second value corresponds to the mask
height (smoothing in the row direction) of the binomial filter.
Therefore,
laplace(O:R:'absolute',MaskSize,N:)laplace(O,R,"absolute",MaskSize,N)Laplace(O,R,"absolute",MaskSize,N)Laplace(O,R,"absolute",MaskSize,N)Laplace(O,R,"absolute",MaskSize,N)laplace(O,R,"absolute",MaskSize,N)
|
for
MaskSizeMaskSizeMaskSizeMaskSizemaskSizemask_size >
3 is equivalent to
gauss_image(O:G:MaskSize-2:)gauss_image(O,G,MaskSize-2)GaussImage(O,G,MaskSize-2)GaussImage(O,G,MaskSize-2)GaussImage(O,G,MaskSize-2)gauss_image(O,G,MaskSize-2)
|
laplace(G:R:'absolute',3,N:)laplace(G,R,"absolute",3,N)Laplace(G,R,"absolute",3,N)Laplace(G,R,"absolute",3,N)Laplace(G,R,"absolute",3,N)laplace(G,R,"absolute",3,N)
|
and
laplace(O:R:'absolute_binomial',MaskSize,N:)laplace(O,R,"absolute_binomial",MaskSize,N)Laplace(O,R,"absolute_binomial",MaskSize,N)Laplace(O,R,"absolute_binomial",MaskSize,N)Laplace(O,R,"absolute_binomial",MaskSize,N)laplace(O,R,"absolute_binomial",MaskSize,N)
|
is equivalent to
binomial_filter(O:B:MaskSize-2,MaskSize-2:)binomial_filter(O,B,MaskSize-2,MaskSize-2)BinomialFilter(O,B,MaskSize-2,MaskSize-2)BinomialFilter(O,B,MaskSize-2,MaskSize-2)BinomialFilter(O,B,MaskSize-2,MaskSize-2)binomial_filter(O,B,MaskSize-2,MaskSize-2)
|
laplace(B:R:'absolute',3,N:)laplace(B,R,"absolute",3,N)Laplace(B,R,"absolute",3,N)Laplace(B,R,"absolute",3,N)Laplace(B,R,"absolute",3,N)laplace(B,R,"absolute",3,N).
|
laplacelaplaceLaplaceLaplaceLaplacelaplace either returns the absolute value of the Laplace
filtered image (ResultTypeResultTypeResultTypeResultTyperesultTyperesult_type = 'absolute'"absolute""absolute""absolute""absolute""absolute") in a
byte or uint2 image or the signed result (ResultTypeResultTypeResultTypeResultTyperesultTyperesult_type =
'signed'"signed""signed""signed""signed""signed" or 'signed_clipped'"signed_clipped""signed_clipped""signed_clipped""signed_clipped""signed_clipped"). Here, the output
image type has the same number of bytes per pixel as the input image
(i.e., int1 or int2) for 'signed_clipped'"signed_clipped""signed_clipped""signed_clipped""signed_clipped""signed_clipped", while the output
image has the next larger number of pixels (i.e., int2 or int4) for
'signed'"signed""signed""signed""signed""signed".
注意
请注意,若使用域缩减后的图像作为输入,滤波器算子可能会返回意外结果。请参阅 滤波器 一章
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 在元组级别上自动并行化。
- 在通道级别上自动并行化。
- 在域级别上自动并行化。
参数
ImageImageImageImageimageimage (输入对象) (multichannel-)image(-array) → objectHImageHObjectHImageHobject (byte / uint2)
输入图像。
ImageLaplaceImageLaplaceImageLaplaceImageLaplaceimageLaplaceimage_laplace (输出对象) (multichannel-)image(-array) → objectHImageHObjectHImageHobject * (byte / uint2 / int2 / int2 / int4)
Laplace-filtered result image.
ResultTypeResultTypeResultTypeResultTyperesultTyperesult_type (输入控制) string → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Type of the result image, whereas for byte and uint2
the absolute value is used.
默认值:
'absolute'
"absolute"
"absolute"
"absolute"
"absolute"
"absolute"
值列表:
'absolute'"absolute""absolute""absolute""absolute""absolute", 'absolute_binomial'"absolute_binomial""absolute_binomial""absolute_binomial""absolute_binomial""absolute_binomial", 'signed'"signed""signed""signed""signed""signed", 'signed_binomial'"signed_binomial""signed_binomial""signed_binomial""signed_binomial""signed_binomial", 'signed_clipped'"signed_clipped""signed_clipped""signed_clipped""signed_clipped""signed_clipped", 'signed_clipped_binomial'"signed_clipped_binomial""signed_clipped_binomial""signed_clipped_binomial""signed_clipped_binomial""signed_clipped_binomial"
MaskSizeMaskSizeMaskSizeMaskSizemaskSizemask_size (输入控制) integer(-array) → HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Size of filter mask.
默认值:
3
值列表:
3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39
FilterMaskFilterMaskFilterMaskFilterMaskfilterMaskfilter_mask (输入控制) string → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Filter mask used in the Laplace operator
默认值:
'n_4'
"n_4"
"n_4"
"n_4"
"n_4"
"n_4"
值列表:
'n_4'"n_4""n_4""n_4""n_4""n_4", 'n_8'"n_8""n_8""n_8""n_8""n_8", 'n_8_isotropic'"n_8_isotropic""n_8_isotropic""n_8_isotropic""n_8_isotropic""n_8_isotropic"
示例(C)
read_image(&Image,"mreut");
laplace(Image,&Laplace,"signed",3,"n_8_isotropic");
zero_crossing(Laplace,&ZeroCrossings);
结果
laplacelaplaceLaplaceLaplaceLaplacelaplace 在所有参数正确时返回 2 ( H_MSG_TRUE )。 如果输入为空则可设置行为通过 set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>)。如有必要,则抛出异常。
可能的后继
zero_crossingzero_crossingZeroCrossingZeroCrossingZeroCrossingzero_crossing,
dual_thresholddual_thresholdDualThresholdDualThresholdDualThresholddual_threshold,
thresholdthresholdThresholdThresholdThresholdthreshold
替代
diff_of_gaussdiff_of_gaussDiffOfGaussDiffOfGaussDiffOfGaussdiff_of_gauss,
laplace_of_gausslaplace_of_gaussLaplaceOfGaussLaplaceOfGaussLaplaceOfGausslaplace_of_gauss,
derivate_gaussderivate_gaussDerivateGaussDerivateGaussDerivateGaussderivate_gauss
另见
highpass_imagehighpass_imageHighpassImageHighpassImageHighpassImagehighpass_image,
edges_imageedges_imageEdgesImageEdgesImageEdgesImageedges_image
模块
基础