Пример #1
0
QVector<QPair<QPoint, QColor> > ImageProcessor::findTeeth(QImage input) {
    QTime t;
    t.start();
    QImage useMe = constrastImage(input,65);
    QVector<QPoint> points = ImageProcessor::findOcculsionFaster(useMe);
    qDebug("1Time elapsed: %d ms", t.elapsed());

    QVector<float> occValues = findAverageAndStd(points,input);
    int average = (int) occValues.at(0);
    float standardDev = occValues.at(1);
    qDebug("2Time elapsed: %d ms", t.elapsed());

    int cutoff = average + (0 * standardDev);
    QPair<QVector<QPoint>,QVector<QPoint> > outlines = ImageProcessor::findOutline(input,cutoff,points);
    qDebug("3Time elapsed: %d ms", t.elapsed());
    QVector<QPoint> allOutlines = outlines.first + outlines.second;
    qDebug("4Time elapsed: %d ms", t.elapsed());
    QVector<QPoint> inter = ImageProcessor::findInterProximal(input,points,allOutlines,cutoff);
    qDebug("5Time elapsed: %d ms", t.elapsed());
    QList<QVector<QPoint> > interProxGroups = groupPoints(inter,input.width(),input.height(),1,1,750);
    qDebug("6Time elapsed: %d ms", t.elapsed());

    QVector<QPoint> enamelPoints = findInterProximalEnamel(input,interProxGroups,points);
    qDebug("7Time elapsed: %d ms", t.elapsed());
    QVector<QPoint> badTooth = findCloseDecay(interProxGroups,input);
    qDebug("8Time elapsed: %d ms", t.elapsed());
    QVector<QPoint> badEnamel = intersection(enamelPoints,badTooth);
    qDebug("9Time elapsed: %d ms", t.elapsed());



    //QList<QVector<QPoint> > groupedEnamel = groupPoints(badEnamel,input.width(),input.height(),2,2,10);

    QVector<QPair<QPoint, QColor> > returnMe;

    foreach(QPoint point ,points) {
        QPair<QPoint, QColor> addMe(point,QColor(0,200,0,150));
        returnMe.append(addMe);
    }
Пример #2
0
vector<vector<DotNode*> > GraphKMeans::cluster(ConnectedDotGraph& g, int K)
{
	assert(K >= 1);

	VVN res;
	double bestValue = -1;

	for (int attempt = 0; attempt < 10; attempt++)
	{
		vector<DotNode*> centers = chooseCenters(g, K);

		ClusteringInfo clusterInfo = groupPoints(centers, g);
		updateClusters(clusterInfo, g);

		double value = clusterInfo.getModularity();
		if (bestValue == -1 || bestValue < value)
		{
			bestValue = value;
			res = clusterInfo.getGroups();
		}
	}

	return res;
}