Skip to content

Instantly share code, notes, and snippets.

@flyboy74
flyboy74 / cuberead5.pu
Created February 18, 2017 09:42
Rubik's Cube detection written in Python
from picamera.array import PiYUVArray
from picamera import PiCamera
import time
import cv2
import numpy as np
import colorsys
#set Pi Camera settings
camera = PiCamera()
camera.resolution = (640, 480)
'First 55 lines of code are to open and read from a file that was written by the cube recognition program
'The recongition program was written in python running on a raspberry pi
'It was orginally intended that it would run as a webserver using flask and this Small Basic program would use the Network.GetWebPageContents to get the data
'the file has 12 lines, 6 sets of 2 pairs of lines. First line is which face it is and the second line is a string of 9 char of the colors of that face
'We have 6 arrays that are 2 dimentional 3 x 3 (row,colum) to store the colors
For line = 1 To 6
dataface = File.ReadLine("C:\Data\Robitics\MacTwist.txt",line*2-1)
datatile = File.ReadLine("C:\Data\Robitics\MacTwist.txt",line*2)