Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question// ------------- Detection ------------- for (int i 0, n blob.Length; i < n; i++) { List edgePoints = blobCounter.GetBlobsEdgePoints(blob[i]); List corners = PointsCloud.FindQuadrilateralCorners(edgePoints); g.DrawPolygon(Bleu,ToPointsArray(corners)); int cornersCount = corners.Count; // Devrait être 4 pour le quadrilatère // 1 - se préparent pour les calculs de distance entre un point // Et le quadrilatère double[] k = new double[cornersCount]; double[] b = new double[cornersCount]; double[] div = new double[cornersCount]; // precalculated divisor bool[] isVert = new bool[cornersCount]; for (int j = 0; j < cornersCount; j++) { IntPoint currentPoint = corners[j]; IntPoint nextPoint (j + 1 cornersCount) ? corners[0] : corners[j + 1]; if (!(isVert[j] = nextPoint.X == currentPoint.X)) { k[j] = (double)(nextPoint.Y - currentPoint.Y) / (nextPoint.X - currentPoint.X); b[j] = currentPoint.Y - k[j] * currentPoint.X; div[j] = Math.Sqrt(k[j] * k[j] + 1); } // c'est pour compter le nombre de LEDs if (div[j] >= 2 & cornersCount == 4 ) { nombre_led = nombre_led+1; } }
// pour avoir 4 point de mon quadrilatere int cornersCount = corners.Count; // declaration des 4 point double[] A = new double[cornersCount]; double[] B = new double[cornersCount]; double[] C = new double[cornersCount]; double[] D = new double[cornersCount]; double Air_1,Air_2,Air_total=0; for (int j = 0; j < cornersCount; j++) { IntPoint currentPoint = corners[j]; IntPoint nextPoint (j + 1 cornersCount) ? corners[0] : corners[j + 1]; if ((nextPoint.X == currentPoint.X)) { // pour avoir les coordoner des points mais je suis pas sur A[j] = (double)(nextPoint.Y - currentPoint.Y) / (nextPoint.X - currentPoint.X); B[j] = (double)(nextPoint.Y - currentPoint.Y) / (nextPoint.X - currentPoint.X); C[j] = (double)(nextPoint.Y - currentPoint.Y) / (nextPoint.X - currentPoint.X); D[j] = (double)(nextPoint.Y - currentPoint.Y) / (nextPoint.X - currentPoint.X); // calcul de l'aire d'un triangle aire = (hauteur*base)/2 Air_1 = ((A[j] - D[j]) * (D[j] - C[j]) / 2); Air_2 = ((A[j] - B[j]) * (B[j] - C[j]) / 2); Air_total = Air_1 + Air_2; } if (Air_total >2 & cornersCount 4 ) { nombre_led = nombre_led+1; } }