Matlab API ordfilt2在OpenCV中的实现 [英] Implementation of Matlab API ordfilt2 in OpenCV

查看:69
本文介绍了Matlab API ordfilt2在OpenCV中的实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将用 Matlab 编写的代码翻译成 OpenCV.在 Matlab 中,有 ordfilt2 函数.OpenCV 中是否有类似的实现?谢谢

I am translating the code written in Matlab to OpenCV. In Matlab, there is ordfilt2 function. Is there any similar implementation in OpenCV? Thanks

推荐答案

我使用 OpenCV 中的腐蚀或膨胀在 Matlab 中实现了 ordfilt2().ordfilt2(A,1,ones(3,3)) 在 Matlab 中是腐蚀函数,可以用 cv::erode(im, mx, mk,cv::Point(-1,-1),1,BORDER_CONSTANT ); 在 OpenCV 中.在 Matlab 中 ordfilt2(A,9,ones(3,3)) 是膨胀,可以用 cv::dilate(im, mx, mk,cv::Point(-1,-1),1,BORDER_CONSTANT );.

I implemented the ordfilt2() in Matlab using erosion or dilation in OpenCV. ordfilt2(A,1,ones(3,3)) in Matlab is erosion function and can be replaced with cv::erode(im, mx, mk,cv::Point(-1,-1),1,BORDER_CONSTANT ); in OpenCV. ordfilt2(A,9,ones(3,3)) in Matlab is dilation and can be replaced with cv::dilate(im, mx, mk,cv::Point(-1,-1),1,BORDER_CONSTANT );.

这篇关于Matlab API ordfilt2在OpenCV中的实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆