第一种:
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int sliderPos = 70;
Mat image;
void processImage(int, void*);
int main( int argc, char** argv )
{
image = imread("C:\\Users\\Administrator\\Desktop\\20140528\\129.bmp", 0);
if( image.empty() )
{
cout << "Couldn't open image " << "\n";
return 0;
}
namedWindow("result", 1);
// Create toolbars. HighGUI use.
createTrackbar( "threshold", "result", &sliderPos, 255, processImage );
processImage(0, 0);
// Wait for a key stroke; the same function arranges events processing
waitKey();
return 0;
}
// Define trackbar callback functon. This function find contours,
// draw it and approximate it by ellipses.
void processImage(int /*h*/, void*)
{
vector<vector<Point> > contours;

本文介绍了两种使用OpenCV进行椭圆检测的方法,包括相关算法和步骤,帮助理解如何在计算机视觉项目中检测椭圆形物体。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



