EXCEPTION_access_violation using Hough circle transform
I'm a newbie using Opencv 3.0 . I keep getting access violation error and i don't know how to fix it. Please help!!!!
// app1.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/imgproc/imgproc.hpp" // has cvtColor
#include <iostream>
#include <stdio.h>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat src, src_gray;
/// Read the image
src = imread("Tennisball2.PNG",1);
if (!src.data)
{
cout << "EMPTY" << endl;
return -1;
}
/// Convert it to gray
cvtColor(src, src_gray, COLOR_BGR2GRAY);
/// Reduce the noise so we avoid false circle detection
GaussianBlur(src_gray, src_gray, Size(9, 9), 2, 2);
vector<Vec3f> face;
/// Apply the Hough Transform to find the circles
HoughCircles(src_gray, face, HOUGH_GRADIENT, 1, src_gray.rows / 8, 200, 100, 0, 0);
//waitKey(1000);
/// Draw the circles detected
for (size_t i = 0; i < face.size() ; i++)
{
Point center(cvRound(face[i][0]), cvRound(face [i][1]));
int radius = cvRound(face [i][2]);
// circle center
circle(src, center, 3, Scalar(0, 255, 0), -1, 8, 0);
// circle outline
circle(src, center, radius, Scalar(0, 0, 255), 3, 8, 0);
}
/// Show your results
namedWindow("Hough Circle Transform Demo", WINDOW_AUTOSIZE);
imshow("Hough Circle Transform Demo", src);
waitKey(33);
return 0;
}