Now that a decent Hit Rate has been achieved, the focus turns to reducing the False Alarms. One step to reducing the false alarms is to black out the suns disk, so that the false alarms picked up in the suns disk will eliminated from the count.

Original False Alarm count was 95058, after some implementation on blocking out the suns disk the count drop to 85725.
This reduces the false alarms by 9333 which is about ≈ 10%.

Below is a coding excerpt for the function to Black out the suns disk. First we blur the image slightly, followed by running the Canny edge detector on the image. Once the edges are found the HoughLines algorithm is run to find all the line segments in the image. Using these methods we are trying to determine a radius to the suns edge to then determine our circle size.

//!**************************************************
//! @details
//! This will first perform Canny detection on the image
//! once the edges are found it will find the lines of the edges
//! using the Hough transform. Which will get the radius of the area
//! to black out.
//!
//! @return <bool bProcessed>
//! Whether we were able to process any lines found.
//!**************************************************
bool BlackOutTheSun()
{
	Mat cdst;
	bool bProcessed = false;
	cdst.create(image.size(), image.type());
	blur(image, edge, Size(3,3));

	// Run the edge detector on grayscale
	Canny(edge, edge, edgeThresh, edgeThresh*3, 3);
	cedge = Scalar::all(0);

	image.copyTo(cedge, edge);

	vector<Vec4i> lines;
	HoughLinesP(cedge, lines, 1, CV_PI/180, 50, 50, 10 );
	float slope;
	for( size_t i = 0; i < lines.size(); i++ )
	{
		Vec4i l = lines[i];
		line( cdst, Point(l[0], l[1]), Point(l[2], l[3]), CVX_RED, 3, CV_AA);

		// Make sure we don't get into a divide by 0 state
		if((l[0] - l[2]) != 0)
		{
			slope = static_cast<float>((l[1] - l[3]) / (l[0] - l[2]));

			if(abs(slope) >= 1)
			{
				m_nfoundX = l[0];
				m_nfoundY = l[1];
			}
			bProcessed = true;
		}
	}
	cvNamedWindow("Edge Lines", CV_WINDOW_NORMAL);
	imshow("Edge Lines", edge);
	waitKey(0);

	cvNamedWindow("Image Lines", CV_WINDOW_NORMAL);
	imshow("Image Lines", image);
	waitKey(0);

	cvNamedWindow("Detected Lines", CV_WINDOW_NORMAL);
	imshow("Detected Lines", cdst);
	waitKey(0);

	return bProcessed;
}

Below are examples of the image outputs from the operations in the above code excerpt.

Tags: , , ,

Leave a Reply