saevisionbut3fi
Fichier pour générer les facettes du cube
- generecube.py
import os import cv2 import numpy as np filename="image_principale" #tabcolors_python= [[0,2,6,5,5,1,3,2,1],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0] ] tabcolors_python= [[0,0,0,0,1,0,0,0,0],[0,0,0,0,2,0,0,0,0],[0,0,0,0,3,0,0,0,0],[0,0,0,0,4,0,0,0,0],[0,0,0,0,5,0,0,0,0],[0,0,0,0,6,0,0,0,0] ] def create_tab_colors(): with open('tab_colors.scad', 'w') as f: f.write('// fichier de définition du cube, a inclure avec:\n') f.write('// include <tab_colors.scad>\n') f.write('// Definition des couleurs\n') f.write('color_black = [0, 0, 0]; // indice 0 \n') f.write('color_white = [1, 1, 1]; // indice 1\n') f.write('color_red = [1, 0, 0]; // indice 2\n') f.write('color_green = [0, 1, 0]; // indice 3\n') f.write('color_orange = [1, 0.5, 0]; // indice 4\n') f.write('color_yellow = [1, 1, 0]; // indice 5\n') f.write('color_blue = [0, 0, 1]; // indice 6\n') f.write('tab_indices_color=[color_black,color_white,color_red,color_green,color_orange,color_yellow,color_blue];\n') f.write('tabcolors= [') for nface in range(6): f.write('[') for ncarre in range(9): #f.write(str(nface)) f.write(str(tabcolors_python[nface][ncarre])) if ncarre!=8: f.write(',') else: f.write(']') if nface!=5: f.write(',') f.write('];') f.close() create_tab_colors()
Images
Pleins d'images à utiliser: https://bvdp.inetdoc.net/files/iut/vision_BUT3/
Archive zip des images: https://bvdp.inetdoc.net/files/iut/vision_BUT3/images_rubiks.zip
saevisionbut3fi.txt · Dernière modification : 2024/01/12 10:06 de bvandepo