Canny边缘检测 - CannyEdge
函数简介
使用 Canny 算法对图像进行边缘检测。
接口名称
CannyEdge
DLL调用
int64_t CannyEdge(int64_t instance, int64_t ptr, int32_t kernelSize);
参数说明
参数名 | 类型 | 说明 |
---|---|---|
instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
ptr | 长整数型 | 图像指针。 |
kernelSize | 整数型 | 高斯平滑核大小(奇数),用于预处理降噪。 |
示例
long image = LoadImage(ola, "D:/test/img.png");
if (image) {
long edge = CannyEdge(ola, image, 3);
if (edge) {
ShowImage(ola, edge);
FreeImagePtr(ola, edge);
}
FreeImagePtr(ola, image);
}
返回值
返回边缘图像句柄,失败返回0。
注意事项
- 输入图像会进行高斯预处理以降低噪声。
- 处理后的图像需调用
FreeImagePtr
释放。