mirror of
https://forge.apps.education.fr/blender-edutech/blender-edutech-tutoriels.git
synced 2024-01-27 09:42:33 +01:00
Mise à jour de la table d'équilibre
This commit is contained in:
parent
6d97bb76cb
commit
8158ed672d
0
labyrinthe/6-jumeaux/impression3d/attache-cables.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/attache-cables.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/attache-domino.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/attache-domino.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/attache-plaque.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/attache-plaque.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/bras-avec_butees.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/bras-avec_butees.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/bras-sans_butees.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/bras-sans_butees.stl
Executable file → Normal file
11762
labyrinthe/6-jumeaux/impression3d/cache.stl
Normal file
11762
labyrinthe/6-jumeaux/impression3d/cache.stl
Normal file
File diff suppressed because it is too large
Load Diff
10180
labyrinthe/6-jumeaux/impression3d/cam-contreventement-1.stl
Normal file
10180
labyrinthe/6-jumeaux/impression3d/cam-contreventement-1.stl
Normal file
File diff suppressed because it is too large
Load Diff
10068
labyrinthe/6-jumeaux/impression3d/cam-contreventement-2.stl
Normal file
10068
labyrinthe/6-jumeaux/impression3d/cam-contreventement-2.stl
Normal file
File diff suppressed because it is too large
Load Diff
3558
labyrinthe/6-jumeaux/impression3d/cam-contreventement-joint.stl
Normal file
3558
labyrinthe/6-jumeaux/impression3d/cam-contreventement-joint.stl
Normal file
File diff suppressed because it is too large
Load Diff
0
labyrinthe/6-jumeaux/impression3d/cam-mount-1.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/cam-mount-1.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/cam-mount-2.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/cam-mount-2.stl
Executable file → Normal file
36120
labyrinthe/6-jumeaux/impression3d/cam-pied-partie3.stl → labyrinthe/6-jumeaux/impression3d/cam-pied-droit-1.stl
Executable file → Normal file
36120
labyrinthe/6-jumeaux/impression3d/cam-pied-partie3.stl → labyrinthe/6-jumeaux/impression3d/cam-pied-droit-1.stl
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
34386
labyrinthe/6-jumeaux/impression3d/cam-pied-droit-2.stl
Normal file
34386
labyrinthe/6-jumeaux/impression3d/cam-pied-droit-2.stl
Normal file
File diff suppressed because it is too large
Load Diff
47182
labyrinthe/6-jumeaux/impression3d/cam-pied-gauche.stl
Normal file
47182
labyrinthe/6-jumeaux/impression3d/cam-pied-gauche.stl
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
6806
labyrinthe/6-jumeaux/impression3d/cam-pied-joint.stl
Normal file
6806
labyrinthe/6-jumeaux/impression3d/cam-pied-joint.stl
Normal file
File diff suppressed because it is too large
Load Diff
1094
labyrinthe/6-jumeaux/impression3d/cam-pied-montant.stl
Normal file
1094
labyrinthe/6-jumeaux/impression3d/cam-pied-montant.stl
Normal file
File diff suppressed because it is too large
Load Diff
1094
labyrinthe/6-jumeaux/impression3d/cam-pied-montant_court.stl
Normal file
1094
labyrinthe/6-jumeaux/impression3d/cam-pied-montant_court.stl
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
47434
labyrinthe/6-jumeaux/impression3d/cam-socle-droit.stl
Normal file
47434
labyrinthe/6-jumeaux/impression3d/cam-socle-droit.stl
Normal file
File diff suppressed because it is too large
Load Diff
32328
labyrinthe/6-jumeaux/impression3d/cam-socle-gauche.stl
Normal file
32328
labyrinthe/6-jumeaux/impression3d/cam-socle-gauche.stl
Normal file
File diff suppressed because it is too large
Load Diff
3558
labyrinthe/6-jumeaux/impression3d/cam-socle-joint.stl
Normal file
3558
labyrinthe/6-jumeaux/impression3d/cam-socle-joint.stl
Normal file
File diff suppressed because it is too large
Load Diff
15528
labyrinthe/6-jumeaux/impression3d/coin.stl
Normal file
15528
labyrinthe/6-jumeaux/impression3d/coin.stl
Normal file
File diff suppressed because it is too large
Load Diff
0
labyrinthe/6-jumeaux/impression3d/labyrinthe-fond.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/labyrinthe-fond.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/labyrinthe-murs.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/labyrinthe-murs.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/labyrinthe-rallonge.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/labyrinthe-rallonge.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/labyrinthe_goulotte.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/labyrinthe_goulotte.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/moteur_semelle.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/moteur_semelle.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/plateau.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/plateau.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/poche-bille-9mm.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/poche-bille-9mm.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/poche.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/poche.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/rotule_centrale-jeu_faible.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/rotule_centrale-jeu_faible.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/rotule_centrale-jeu_moyen.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/rotule_centrale-jeu_moyen.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/socle-carte_pied.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/socle-carte_pied.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/socle-patin.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/socle-patin.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/socle.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/socle.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/socle_pied.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/socle_pied.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/support-sphere.stl
Executable file → Normal file
0
labyrinthe/6-jumeaux/impression3d/support-sphere.stl
Executable file → Normal file
@ -1,105 +0,0 @@
|
|||||||
import os, time
|
|
||||||
import numpy as np
|
|
||||||
import cv2 as cv
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# cam_bille-test.py :
|
|
||||||
# @title: Détection de la bille par vision (caméra + OpenCV)
|
|
||||||
# @project: Blender-EduTech - Tutoriel : Tutoriel 6 : Labyrinthe à bille - Développement de jumeau numérique
|
|
||||||
# @lang: fr
|
|
||||||
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
|
||||||
# @copyright: Copyright (C) 2023 Philippe Roy
|
|
||||||
# @license: GNU GPL
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
###
|
|
||||||
# Installation :
|
|
||||||
# - pip3 install opencv-python
|
|
||||||
###
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Paramètres de reconnaissance de la bille
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
# Rayon pour une bille de 9 mm
|
|
||||||
rayon_min, rayon_max = 8, 10
|
|
||||||
|
|
||||||
# Cadre carré du labyrinthe avec une bordure de 10 px et un image de 640x480 px
|
|
||||||
cadre_cote = 460
|
|
||||||
cadre_x0= round((480/2)-(cadre_cote/2))
|
|
||||||
cadre_x1= round((480/2)+(cadre_cote/2))
|
|
||||||
cadre_y0 = round((640/2)-(cadre_cote/2))
|
|
||||||
cadre_y1 = round((640/2)+(cadre_cote/2))
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Initialisation
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
# Init de la caméra
|
|
||||||
cam_id = 0 # 0 pour la 1ere camera, 1 pour la seconde ...
|
|
||||||
cam = cv.VideoCapture(cam_id) # 0 pour la 1ere camera, 1 pour la
|
|
||||||
assert cam.isOpened(), "Erreur lors de l'ouverture de la camera !"
|
|
||||||
|
|
||||||
# Création de la fenêtre d'affichage
|
|
||||||
# cv.namedWindow("Caméra")
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Affichage
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
# Capture vidéo
|
|
||||||
echap=''
|
|
||||||
while cam.isOpened():
|
|
||||||
cam_actif, cam_img_orig = cam.read()
|
|
||||||
cam_img = cv.rotate(cam_img_orig, cv.ROTATE_90_CLOCKWISE)
|
|
||||||
cam_gray = cv.cvtColor(cam_img, cv.COLOR_BGR2GRAY)
|
|
||||||
# cam_gray = cv.medianBlur(cam_gray, 5) # Réduction de la netteté
|
|
||||||
# (thresh, cam_bw) = cv.threshold(gray, 127, 255, cv.THRESH_BINARY) # Noir et blanc
|
|
||||||
rows = cam_gray.shape[0]
|
|
||||||
|
|
||||||
# Version initiale
|
|
||||||
# cercles = cv.HoughCircles(cam_gray, cv.HOUGH_GRADIENT, 1, rows / 8, param1=100, param2=30, minRadius=rayon_min, maxRadius=rayon_max)
|
|
||||||
|
|
||||||
# Un lent mais fiable
|
|
||||||
# cercles = cv.HoughCircles(cam_gray, cv.HOUGH_GRADIENT, 1, rows/10, param1=100, param2=15, minRadius=rayon_min, maxRadius=rayon_max) # un peu lent
|
|
||||||
|
|
||||||
# Rapide mais avec beaucoup de faux positif -> contrôle cinématique
|
|
||||||
cercles = cv.HoughCircles(cam_gray, cv.HOUGH_GRADIENT, 1.5, rows/10, param1=100, param2=15, minRadius=rayon_min, maxRadius=rayon_max)
|
|
||||||
|
|
||||||
# Archives ...
|
|
||||||
# cercles = cv.HoughCircles(cam_gray, cv.HOUGH_GRADIENT, 1, rows / 8, param1=30, param2=15, minRadius=rayon_min, maxRadius=rayon_max)
|
|
||||||
# cercles = cv.HoughCircles(cam_gray, cv.HOUGH_GRADIENT, 1.5, rows / 8, param1=100, param2=30, minRadius=rayon_min, maxRadius=rayon_max)
|
|
||||||
# cercles = cv.HoughCircles(cam_gray, cv.HOUGH_GRADIENT, 1, rows / 8, param1=100, param2=30, minRadius=5, maxRadius=10)
|
|
||||||
|
|
||||||
# Dessin de la zone de détection
|
|
||||||
cv.rectangle(cam_img, (cadre_x0, cadre_y0), (cadre_x1, cadre_y1), (0, 0, 255), 2) # Contour du cadre de détection
|
|
||||||
cv.rectangle(cam_gray, (cadre_x0, cadre_y0), (cadre_x1, cadre_y1), (0, 0, 255), 2) # Contour du cadre de détection
|
|
||||||
|
|
||||||
# Détection de la bille
|
|
||||||
if cercles is not None:
|
|
||||||
cercles = np.uint16(np.around(cercles))
|
|
||||||
for i in cercles[0, :]:
|
|
||||||
cx, cy, r = i[0], i[1], i[2]
|
|
||||||
if cx > cadre_x0 and cx< cadre_x1 and cy > cadre_y0 and cy< cadre_y1: # Supression en dehors de la zone de détection
|
|
||||||
cv.circle(cam_img, (cx, cy), 1, (255, 0, 255), 2) # Point des centres
|
|
||||||
cv.circle(cam_gray, (cx, cy), 1, (255, 0, 255), 2) # Point des centres
|
|
||||||
r = i[2]
|
|
||||||
print ("Rayon :", r, "- Centre :", cx, cy)
|
|
||||||
cv.circle(cam_img, (cx, cy), r, (255, 0, 255), 2) # Contour des cercles
|
|
||||||
cv.circle(cam_gray, (cx, cy), r, (255, 0, 255), 2) # Contour des cercles
|
|
||||||
|
|
||||||
cv.imshow("Detection de cercles", cam_img) # "Détection" -> bug !
|
|
||||||
# cv.imshow("Detection de cercles", cam_gray) # "Détection" -> bug !
|
|
||||||
# cv.imwrite("camera.png", cam_img) # Enregister l'image
|
|
||||||
|
|
||||||
# Sortir
|
|
||||||
echap = cv.waitKey(1) # Saisie clavier avec un timeout de 1 ms
|
|
||||||
if echap & 0xFF == ord('q') or echap == 27 :
|
|
||||||
break
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Quitter
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
cam.release()
|
|
||||||
cv.destroyAllWindows()
|
|
@ -1 +0,0 @@
|
|||||||
phroy@debian.94838:1699716570
|
|
BIN
labyrinthe/6-jumeaux/test/cam_bille-test.png
Normal file
BIN
labyrinthe/6-jumeaux/test/cam_bille-test.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 872 KiB |
@ -21,8 +21,8 @@ import cv2 as cv
|
|||||||
# Paramètres de reconnaissance de la bille
|
# Paramètres de reconnaissance de la bille
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# Rayon pour une bille de 9 mm
|
# Rayon pour une bille de 8 mm
|
||||||
rayon_min, rayon_max = 8, 10
|
rayon_min, rayon_max = 6, 8
|
||||||
|
|
||||||
# Cadre carré du labyrinthe avec une bordure de 10 px et un image de 640x480 px
|
# Cadre carré du labyrinthe avec une bordure de 10 px et un image de 640x480 px
|
||||||
cadre_cote = 460
|
cadre_cote = 460
|
||||||
@ -71,7 +71,6 @@ while cam.isOpened():
|
|||||||
# cercles = cv.HoughCircles(cam_gray, cv.HOUGH_GRADIENT, 1.5, rows / 8, param1=100, param2=30, minRadius=rayon_min, maxRadius=rayon_max)
|
# cercles = cv.HoughCircles(cam_gray, cv.HOUGH_GRADIENT, 1.5, rows / 8, param1=100, param2=30, minRadius=rayon_min, maxRadius=rayon_max)
|
||||||
# cercles = cv.HoughCircles(cam_gray, cv.HOUGH_GRADIENT, 1, rows / 8, param1=100, param2=30, minRadius=5, maxRadius=10)
|
# cercles = cv.HoughCircles(cam_gray, cv.HOUGH_GRADIENT, 1, rows / 8, param1=100, param2=30, minRadius=5, maxRadius=10)
|
||||||
|
|
||||||
|
|
||||||
# Dessin de la zone de détection
|
# Dessin de la zone de détection
|
||||||
cv.rectangle(cam_img, (cadre_x0, cadre_y0), (cadre_x1, cadre_y1), (0, 0, 255), 2) # Contour du cadre de détection
|
cv.rectangle(cam_img, (cadre_x0, cadre_y0), (cadre_x1, cadre_y1), (0, 0, 255), 2) # Contour du cadre de détection
|
||||||
cv.rectangle(cam_gray, (cadre_x0, cadre_y0), (cadre_x1, cadre_y1), (0, 0, 255), 2) # Contour du cadre de détection
|
cv.rectangle(cam_gray, (cadre_x0, cadre_y0), (cadre_x1, cadre_y1), (0, 0, 255), 2) # Contour du cadre de détection
|
||||||
|
@ -21,8 +21,8 @@ import cv2 as cv
|
|||||||
# Paramètres de reconnaissance de la bille
|
# Paramètres de reconnaissance de la bille
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# Rayon pour une bille de 9 mm
|
# Rayon pour une bille de 8 mm
|
||||||
rayon_min, rayon_max = 8, 10
|
rayon_min, rayon_max = 6, 8
|
||||||
|
|
||||||
# Couleur à détecter
|
# Couleur à détecter
|
||||||
rouge = [0, 0, 255] # rouge dans l'espace BGR
|
rouge = [0, 0, 255] # rouge dans l'espace BGR
|
||||||
@ -84,6 +84,10 @@ while cam.isOpened():
|
|||||||
cam_hsv = cv.cvtColor(cam_img, cv.COLOR_BGR2HSV)
|
cam_hsv = cv.cvtColor(cam_img, cv.COLOR_BGR2HSV)
|
||||||
cam_mask=cv.inRange(cam_hsv, lower_limit, upper_limit)
|
cam_mask=cv.inRange(cam_hsv, lower_limit, upper_limit)
|
||||||
|
|
||||||
|
# Dessin de la zone de détection
|
||||||
|
cv.rectangle(cam_img, (cadre_x0, cadre_y0), (cadre_x1, cadre_y1), (0, 0, 255), 2) # Contour du cadre de détection
|
||||||
|
|
||||||
|
# Détection de la bille rouge
|
||||||
elements=cv.findContours(cam_mask, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)[-2]
|
elements=cv.findContours(cam_mask, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)[-2]
|
||||||
if len(elements) > 0:
|
if len(elements) > 0:
|
||||||
c=max(elements, key=cv.contourArea)
|
c=max(elements, key=cv.contourArea)
|
||||||
@ -99,7 +103,8 @@ while cam.isOpened():
|
|||||||
cv.circle(cam_img, (cx, cy), r, (255, 0, 255), 2) # Contour des cercles
|
cv.circle(cam_img, (cx, cy), r, (255, 0, 255), 2) # Contour des cercles
|
||||||
cv.circle(cam_mask, (cx, cy), r, (255, 0, 255), 2) # Contour des cercles
|
cv.circle(cam_mask, (cx, cy), r, (255, 0, 255), 2) # Contour des cercles
|
||||||
|
|
||||||
cv.imshow("Detection de la couleur rouge", cam_img) # "Détection" -> bug !
|
# cv.imshow("Detection de la couleur rouge", cam_img) # "Détection" -> bug !
|
||||||
|
cv.imshow("Detection de la couleur rouge", cam_mask) # "Détection" -> bug !
|
||||||
|
|
||||||
# Sortir
|
# Sortir
|
||||||
echap = cv.waitKey(1) # Saisie clavier avec un timeout de 1 ms
|
echap = cv.waitKey(1) # Saisie clavier avec un timeout de 1 ms
|
||||||
|
Loading…
Reference in New Issue
Block a user