Skip to content
Snippets Groups Projects
Commit 8d54c64a authored by razvan841's avatar razvan841
Browse files

added .env variables

parent 794c182f
Branches
No related tags found
No related merge requests found
......@@ -2,8 +2,13 @@ import cv2
import numpy as np
from tensorflow.keras.models import load_model # type: ignore
import os
from dotenv import load_dotenv
DEBUGGING = True
load_dotenv()
# Access environment variables
DEBUGGING = os.getenv('DEBUGGING')
def extract_patches(image):
height, width, _ = image.shape
......
......@@ -4,8 +4,12 @@ from tensorflow.keras.models import Sequential # type: ignore
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense # type: ignore
import os
import json
from dotenv import load_dotenv
DEBUGGING = True
load_dotenv()
# Access environment variables
DEBUGGING = os.getenv('DEBUGGING')
# extract 9 patches from the image assuming the image
# contains only the cube and is properly aligned.
def extract_patches(image):
......
......@@ -4,9 +4,16 @@ from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import numpy as np
from ultralytics import YOLO
import cv2
from tensorflow.keras.models import load_model
from tensorflow.keras.models import load_model # type: ignore
from Color_detection import raspberryPi
import os
from dotenv import load_dotenv
load_dotenv()
# Access environment variables
CAMERA_INDEX = os.getenv('CAMERA_INDEX')
# Initialize cube state
cube_state = {
......@@ -131,7 +138,7 @@ def draw_cube(state):
model = YOLO(r"Cube_detection/runs/detect/best/weights/best.pt")
# Open video capture
cap = cv2.VideoCapture(1)
cap = cv2.VideoCapture(CAMERA_INDEX)
print("Press 'q' to quit.")
model_path = r"Color_detection/rubiks_cube_model.h5"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment