小编ImL*_*ing的帖子

OpenCV-Canny边缘检测无法正常工作

我是Android的OpenCV的新手。我目前正在研究文件检测演示应用程序。我到目前为止所做的如下:

原始图像 - > 灰度图像 - > 高斯模糊 - > Canny边缘检测 - > 查找轮廓 - > 绘制轮廓

从下图中可以看到,我能够完美地检测到纸张。

在此处输入图片说明

但是它无法检测到某些文件。以下是其中之一

在此处输入图片说明

我对此进行了大量研究,发现问题出在Canny边缘检测上,下面是Canny图像:

在此处输入图片说明

如您所见,边缘检测未完美链接,并且在某些点上未连接边缘。这就是这样做的原因。

我在以下地方经历过类似的问题:如何在OpenCV中实现的Canny Edge检测算法中选择最佳的参数集? 我已经遵循了解决方案,但是它对我没有用。

我的精明检测代码如下:

double otsu_thresold = Imgproc.threshold(mGray,edged,0,255, Imgproc.THRESH_OTSU);
Imgproc.Canny(mRgba, edged, otsu_thresold*0.5,otsu_thresold);
Run Code Online (Sandbox Code Playgroud)

我不知道我哪里错了!我应该怎么做才能完美地检测文档?

opencv image-processing edge-detection opencv4android

4
推荐指数
1
解决办法
5590
查看次数

使用Hough变换OpenCV Android进行矩形文档检测

我正在尝试使用opencv 4 android sdk检测矩形文档。首先我试图通过找到轮廓来检测它,但是它不能用于多彩色文档。您可以检查此链接以获得更好的主意: 使用OpenCV4Android检测多彩色文档

我进行了很多研究,发现可以使用houghline变换来完成它,因此我遵循以下方法来检测文档:

原始图像-> cvtColor->高斯模糊滤波器->对其进行扩张以锐化边缘->应用分水岭图像分割算法->具有动态otsu阈值的canny边缘检测->然后应用霍夫线变换

我为霍夫线变换所做的是:

Imgproc.HoughLinesP(watershedMat, lines, 1, Math.PI / 180, 50, 100, 50);

    List<Line> horizontals = new ArrayList<>();
    List<Line> verticals = new ArrayList<>();
    for (int x = 0; x < lines.rows(); x++)
    {
        double[] vec = lines.get(x, 0);
        double x1 = vec[0],
                y1 = vec[1],
                x2 = vec[2],
                y2 = vec[3];
        Point start = new Point(x1, y1);
        Point end = new Point(x2, y2);
        Line line = new Line(start, end);
        if (Math.abs(x1 - x2) > Math.abs(y1-y2)) …
Run Code Online (Sandbox Code Playgroud)

opencv edge-detection hough-transform opencv4android houghlinesp

2
推荐指数
1
解决办法
2229
查看次数

Replace node renderable ( same rotation, position and scale ) with another node renderable in Sceneform sdk

I am new to sceneform sdk for Android . I have added one Transformable Node , then i applied some rotation , scaling and changed its position also. Now on click of button i need to place second node with same rotation , scaling and position.

For that what i did is:

 Node nodeTwo = new Node(); // second node
 nodeTwo.setLocalPosition(nodeOne);
 nodeTwo.setLocalRotation(nodeOne);
 nodeTwo.setLocalScale(nodeOne);
 nodeTwo.setRenderable(renderable); 
Run Code Online (Sandbox Code Playgroud)

I have also tried with setWorldPosition() , setWorldRotation().. But nothing works , second node got …

android augmented-reality android-augmented-reality arcore sceneform

2
推荐指数
1
解决办法
1082
查看次数