我在机器人相机(寻找圆圈)的流图像上使用Canny检测。为了获得边缘之间的最大对比度,我将rgb图像分割为单独的通道,对每个通道执行Canny,然后将位图或边缘一起合并到合并的图像中。在简单图像上使用时,我的fps在30 fps时相对不受影响。当相机看到更复杂的图像时,fps降至24 fps。这是正常的吗?如果是这样,那么我是否可以加快速度以便继续以恒定的帧速率运行?OpenCV的Canny检测在更复杂的图像上变慢
下面是我使用的代码:
vector<Mat> rgb;
split(src, rgb);
Canny(rgb[0], rgb[0], cannyThreshold, cannyThreshold2, 3);
Canny(rgb[1], rgb[1], cannyThreshold, cannyThreshold2, 3);
Canny(rgb[2], rgb[2], cannyThreshold, cannyThreshold2, 3);
Mat mergedImage;
bitwise_or(rgb[0], rgb[1], mergedImage);
bitwise_or(mergedImage, rgb[2], mergedImage);
它是有道理的。由于bitwise_or可能只查看存在正值的图像位置。当有更多的正面价值时,需要更长的时间。 –