Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Presentations/RCOS.pdf
Binary file not shown.
Binary file added Presentations/RCOSPPT.pptx
Binary file not shown.
30 changes: 30 additions & 0 deletions learning/FileMoniter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os
import time
import platform

def main(AskForPath = False, Intervtime = 5):
if AskForPath:
print("Enter the path: ")
print("If the program is already in the requested directory, press 'Enter' directly. (Use / to replace \\):",end = ' ')
path = input("")
if path != "":
os.chdir(path) # change the path
else:
if 'windows' in platform.platform().lower():
path = os.getcwd()
else:
path = os.getcwdu()
allfile = os.listdir(path)
print('Current Files:', allfile)
while 1:
newfile = os.listdir(path)
if allfile != newfile:
print("Changes Found")
print('Current Files:', newfile)
time.sleep(Intervtime)
allfile = newfile


if __name__ == '__main__':
main()

1 change: 1 addition & 0 deletions sample/AnswerSheet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from Box import Box
import cv2


class AnswerSheet(object):
def __init__(self,myCentre=(0.0,0.0),myAnswerArea = 0.0):
self.centre = myCentre
Expand Down
6 changes: 4 additions & 2 deletions sample/Box.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ def __init__(self, my_contour):
self.area = cv2.contourArea(my_contour)
self.centre = self.find_centre()

def find_centre(self):
def find_centre(self, printed=False):
x_axis = []
y_axis = []
for point in self.contour:
x_axis.append(point[0][0])
y_axis.append(point[0][1])
# print cnts[0][0][0][0]
if printed:
pass
# print(cnts[0][0][0][0])
x_axis = sorted(x_axis)
y_axis = sorted(y_axis)
x_centre = int((x_axis[0] + x_axis[-1]) / 2)
Expand Down