1

我正在使用 openCV 库来检测对象(彩色方块)。我的问题是低帧率。我的设备是 4 核三星 Galaxy S3。

这是我的代码的一部分,它大大降低了帧速率:

public void morphOps(Mat filteredFrame)
{
    erosion_size = morphSeekBars[0].getRealProgress();
    dilation_size = morphSeekBars[1].getRealProgress();

    //create structuring element that will be used to "dilate" and "erode" image.       
    erodeElement = Imgproc.getStructuringElement( Imgproc.MORPH_ERODE, new Size(2 * erosion_size + 1, 2 * erosion_size + 1), new Point(erosion_size, erosion_size));
    Imgproc.erode(filteredFrame, filteredFrame, erodeElement);

    //dilate with larger element so make sure object is nicely visible
    dilateElement = Imgproc.getStructuringElement( Imgproc.MORPH_RECT, new Size(2 * dilation_size + 1, 2 * dilation_size + 1), new Point(dilation_size/2, dilation_size/2));
    Imgproc.dilate(filteredFrame, filteredFrame, dilateElement);
    Imgproc.dilate(filteredFrame, filteredFrame, dilateElement);
}

如您所见,我进行了一次侵蚀和两次扩张操作,在 640x480 分辨率下,我得到了大约 12 fps... 有什么想法吗?

4

0 回答 0