diff --git a/Live-LeastWorkingModel.py b/Live-LeastWorkingModel.py index 2130e82..c8eb93a 100644 --- a/Live-LeastWorkingModel.py +++ b/Live-LeastWorkingModel.py @@ -50,7 +50,7 @@ def nearestNeighbor(colors, pixel): def detectSingleBond(image, c1, c2): distance = distance2D(c1,c2) - if distance>5*c1[2] or distance>5*c2[2]: return False + if distance>4*c1[2] and distance>4*c2[2]: return False STEPS =25 PERCENT_SKIP=0.3 THRESHOLD=0.85 @@ -58,12 +58,10 @@ def detectSingleBond(image, c1, c2): p2 = c2*PERCENT_SKIP + c1*(1-PERCENT_SKIP) direction = p2-p1 count=0 - print 'STARTINGS' for i in range(STEPS): step = direction*i/STEPS test = p1 + step - print image[math.floor(test[1])][math.floor(test[0])] - if abs(distance3D(image[math.floor(test[1])][math.floor(test[0])], [185,135,135]))<45: + if abs(distance3D(image[math.floor(test[1])][math.floor(test[0])], [190,150,155]))<45: count = count+1 return count>THRESHOLD #End Function detectSingleBond() @@ -127,13 +125,13 @@ def recursiveDFS(graph, vertexNames, seen, cur, parent): return ret #End Function recursiveDFS(graph, vertexNames, seen, cur) -cap = cv2.VideoCapture(0) -cv2.namedWindow('Ball And Stick Tracker',cv2.WINDOW_AUTOSIZE) +cap = cv2.VideoCapture(1) +cv2.namedWindow('Ball And Stick Tracker',cv2.CV_WINDOW_AUTOSIZE) printHelpText() -COUNTER=27 +COUNTER=50 quit=False while not quit: retval,image = cap.read() @@ -147,13 +145,13 @@ def recursiveDFS(graph, vertexNames, seen, cur, parent): image = cv2.medianBlur(image,3) cimg = image.copy() img = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) - circles = cv2.HoughCircles(img,cv2.HOUGH_GRADIENT,1,30, - param1=50,param2=35,minRadius=15,maxRadius=50) + circles = cv2.HoughCircles(img,cv2.cv.CV_HOUGH_GRADIENT,1,30, + param1=45,param2=25,minRadius=15,maxRadius=40) if circles!=None: circles = np.uint16(np.around(circles)) - atomNames = ['C', 'O', 'N','P','H','C6'] - colorNames = ['Black', 'Red', 'Blue','Purple','White','Benzene'] - color = [[34,27,25], [70,25,155], [210,125,75], [165,80,95], [245,175,185],[55,85,80]] + atomNames = ['C', 'O', 'N','P','H','F'] + colorNames = ['Black', 'Red', 'Blue','Purple','White','Yellow'] + color = [[27,25,20], [50,20,160], [220,130,88], [185,100,115], [245,175,185],[90,150,170]] count = [0,0,0,0,0,0] vertexNames = [] @@ -168,7 +166,7 @@ def recursiveDFS(graph, vertexNames, seen, cur, parent): cv2.circle(cimg,(i[0],i[1]),i[2],(0,255,0),2) # draw the center of the circle cv2.circle(cimg,(i[0],i[1]),2,(0,0,255),3) - cv2.putText(cimg, colorNames[color_index], (i[0],i[1]), cv2.FONT_HERSHEY_SIMPLEX,0.6,(255,255,255),2) + cv2.putText(cimg, atomNames[color_index], (i[0],i[1]), cv2.FONT_HERSHEY_SIMPLEX,0.6,(255,255,255),2) #End for #Mark Connections @@ -193,7 +191,7 @@ def recursiveDFS(graph, vertexNames, seen, cur, parent): #End If cv2.imshow('Ball And Stick Tracker', cimg) - key = cv2.waitKey(200) + key = cv2.waitKey(50) if key==-1: continue if chr(key)=='q': quit=True diff --git a/django13api/__init__.pyc b/django13api/__init__.pyc index 909bde2..3f30871 100755 Binary files a/django13api/__init__.pyc and b/django13api/__init__.pyc differ diff --git a/django13api/settings.pyc b/django13api/settings.pyc index 196f507..96aa229 100755 Binary files a/django13api/settings.pyc and b/django13api/settings.pyc differ diff --git a/django13api/urls.py b/django13api/urls.py index f9ccb26..f6c91b7 100755 --- a/django13api/urls.py +++ b/django13api/urls.py @@ -14,5 +14,5 @@ # Uncomment the next line to enable the admin: # url(r'^admin/', include(admin.site.urls)), - url(r'^detect/$', 'detection.detect.views.detect'), + url(r'^detect/$', 'detect.views.detect'), ) diff --git a/quizAngular/app/index.html b/quizAngular/app/index.html index c4d4f32..87fe933 100755 --- a/quizAngular/app/index.html +++ b/quizAngular/app/index.html @@ -59,7 +59,7 @@

IPRO 207 Interactive ExercisesFrom Physical Ball and Stick to Computer
  • Nomenclature
  • Stereochemistry
  • Reactions
  • -
  • Easy Quiz
  • +
  • Easy Exercises
  • diff --git a/quizAngular/app/views/template.html b/quizAngular/app/views/template.html index 42f9ffe..1b8e943 100755 --- a/quizAngular/app/views/template.html +++ b/quizAngular/app/views/template.html @@ -56,7 +56,8 @@

    {{question}}

    - + +
    diff --git a/quizAngular/app/views/template2.html b/quizAngular/app/views/template2.html index 8452908..57e3eac 100755 --- a/quizAngular/app/views/template2.html +++ b/quizAngular/app/views/template2.html @@ -56,7 +56,8 @@

    {{question}}

    - + + diff --git a/quizAngular/app/views/template3.html b/quizAngular/app/views/template3.html index c18105c..f9b5f74 100755 --- a/quizAngular/app/views/template3.html +++ b/quizAngular/app/views/template3.html @@ -70,7 +70,8 @@

    {{question}}

    - + + diff --git a/quizAngular/app/views/template4.html b/quizAngular/app/views/template4.html index dcbff1b..8e38cbe 100755 --- a/quizAngular/app/views/template4.html +++ b/quizAngular/app/views/template4.html @@ -70,7 +70,8 @@

    {{question}}

    - + + diff --git a/quizAngular/dist/index.html b/quizAngular/dist/index.html index 3f2105b..14d6e6b 100755 --- a/quizAngular/dist/index.html +++ b/quizAngular/dist/index.html @@ -1,6 +1,12 @@ - + + + +

    IPRO 207 Quiz App From Physical Ball and Stick to Computer Models of Chemical Systems

    +

    IPRO 207 Interactive Excercise App From Physical Ball and Stick to Computer Models of Chemical Systems

    + +

    {{hint}}

    + + +
    +


    +
    Instructions
    +
      +
    1. Start playing by clicking . The button will be disabled after being activated only once.
    2. +
    3. Start the web camera stream by clicking .
    4. +
    5. Capture a picture and submit the picture to server that can detect the model you built by clicking .
    6. +
    7. In case that you want to stop the web cam stream, click .
    8. +
    9. Submit the result as usual once you are confident with the result.

    +
    +
    + +
    +
    + +
    + Correct! + Incorrect :(
    +

    Quiz is over. Score: {{score}}

    +
    +
    +

    Nomenclature

    +

    This series of questions will help you review nomenclature of organic molecules. Apart from traditional exercise questions, you will be building several molecules based on their name using the modelling kit.



    Begin!
    \ No newline at end of file diff --git a/quizAngular/dist/views/template2.html b/quizAngular/dist/views/template2.html index ea90157..533f4dd 100755 --- a/quizAngular/dist/views/template2.html +++ b/quizAngular/dist/views/template2.html @@ -1 +1,45 @@ -

    {{question}}

    {{hint}}



    Instructions
    1. Start playing by clicking . The button will be disabled after being activated only once.
    2. Start the web camera stream by clicking .
    3. Capture a picture and submit the picture to server that can detect the model you built by clicking .
    4. In case that you want to stop the web cam stream, click .
    5. Submit the result as usual once you are confident with the result.
    Correct! Incorrect :(

    Quiz is over. Score: {{score}}

    Stereochemistry


    Stereochemistry, a subdiscipline of chemistry, involves the study of the relative spatial arrangement of atoms that form the structure of molecules and their manipulation. An important branch of stereochemistry is the study of chiral molecules.



    Begin!
    \ No newline at end of file +
    +
    +
    +
    +
    +
    +

    {{question}}

    + + +

    {{hint}}

    + + +
    +
      +
    • +
    +

    +

    Instructions
    +
      +
    1. Start playing by clicking . The button will be disabled after being activated only once.
    2. +
    3. Start the web camera stream by clicking .
    4. +
    5. Capture a picture and submit the picture to server that can detect the model you built by clicking .
    6. +
    7. In case that you want to stop the web cam stream, click .
    8. +
    9. Submit the result as usual once you are confident with the result.
    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + Correct! + Incorrect :(
    +
    +

    Quiz is over. Score: {{score}}

    +
    +

    Stereochemistry

    +

    Stereochemistry, a subdiscipline of chemistry, involves the study of the relative spatial arrangement of atoms that form the structure of molecules and their manipulation. An important branch of stereochemistry is the study of chiral molecules.

    +

    Begin!
    \ No newline at end of file diff --git a/quizAngular/dist/views/template3.html b/quizAngular/dist/views/template3.html index f09b728..5d2696e 100755 --- a/quizAngular/dist/views/template3.html +++ b/quizAngular/dist/views/template3.html @@ -10,4 +10,39 @@ -ms-transition: opacity 2s ease-in; transition: opacity 2s ease-in; }​ --->

    {{question}}

    {{hint}}



    Instructions
    1. Start playing by clicking . The button will be disabled after being activated only once.
    2. Start the web camera stream by clicking .
    3. Capture a picture and submit the picture to server that can detect the model you built by clicking .
    4. In case that you want to stop the web cam stream, click .
    5. Submit the result as usual once you are confident with the result.
    Correct! Incorrect :(

    Quiz is over. Score: {{score}}

    Reactions


    A chemical reaction is when a substance (or a few substances) change into another substance. Chemical reactions are chemical transformations. If you take a chemistry class, you'll definitely learn about chemical reactions: when one or more substances change into something else. Get tested on your knowledge of reactions.



    Begin!
    \ No newline at end of file +-->
    +
    +
    +
    +
    +

    {{question}}

    + + +

    {{hint}}

    + + +
    +

    +

    +
    Instructions
      +
    1. Start playing by clicking . The button will be disabled after being activated only once.
    2. +
    3. Start the web camera stream by clicking .
    4. +
    5. Capture a picture and submit the picture to server that can detect the model you built by clicking .
    6. +
    7. In case that you want to stop the web cam stream, click .
    8. +
    9. Submit the result as usual once you are confident with the result.
    +
    +
    +
    +
    +
    +
    Correct! + Incorrect :(
    +

    Quiz is over. Score: {{score}}

    +

    Reactions


    +

    A chemical reaction is when a substance (or a few substances) change into another substance. Chemical reactions are chemical transformations. If you take a chemistry class, you'll definitely learn about chemical reactions: when one or more substances change into something else. Get tested on your knowledge of reactions.



    +Begin!
    \ No newline at end of file diff --git a/quizAngular/dist/views/template4.html b/quizAngular/dist/views/template4.html index e55220b..a5c9470 100755 --- a/quizAngular/dist/views/template4.html +++ b/quizAngular/dist/views/template4.html @@ -10,4 +10,50 @@ -ms-transition: opacity 2s ease-in; transition: opacity 2s ease-in; }​ --->

    {{question}}

    {{hint}}



    Instructions
    1. Start playing by clicking . The button will be disabled after being activated only once.
    2. Start the web camera stream by clicking .
    3. Capture a picture and submit the picture to server that can detect the model you built by clicking .
    4. In case that you want to stop the web cam stream, click .
    5. Submit the result as usual once you are confident with the result.
    Correct! Incorrect :(

    Quiz is over. Score: {{score}}

    Easy Quiz


    A collection of easy quiz to get started with!



    Begin!
    \ No newline at end of file +-->
    +
    +
    +
    +
    +

    {{question}}

    + + +

    {{hint}}

    + + +
      +
    +

    +

    Instructions
    +
    1. Start playing by clicking . The button will be disabled after being activated only once.
    2. +
    3. Start the web camera stream by clicking .
    4. +
    5. Capture a picture and submit the picture to server that can detect the model you built by clicking .
    6. +
    7. In case that you want to stop the web cam stream, click .
    8. +
    9. Submit the result as usual once you are confident with the result.
    +
    +
    +
    +
    +
    + + +
    + + +
    +
    +
    +
    + Correct! + Incorrect :(
    +

    Quiz is over. Score: {{score}}

    +
    +

    Easy Quiz


    +

    A collection of easy quiz to get started with!



    Begin! +
    \ No newline at end of file diff --git a/quizAngular/views/about.html b/quizAngular/views/about.html new file mode 100644 index 0000000..d21bf89 --- /dev/null +++ b/quizAngular/views/about.html @@ -0,0 +1 @@ +

    This is the about view.

    diff --git a/quizAngular/views/template.html b/quizAngular/views/template.html new file mode 100644 index 0000000..1b8e943 --- /dev/null +++ b/quizAngular/views/template.html @@ -0,0 +1,89 @@ +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    {{question}}

    +
    +
      +
    • + +
    • +
    +
    + +
    + +
    +
    + +
    +
    +
    +
    Instructions
    +
      +
    1. Start playing by clicking . The button will be disabled after being activated only once.
    2. +
    3. Start the web camera stream by clicking .
    4. +
    5. Capture a picture and submit the picture to server that can detect the model you built by clicking .
    6. +
    7. In case that you want to stop the web cam stream, click .
    8. +
    9. Submit the result as usual once you are confident with the result.
    10. +
    +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    + + + + +
    + + +
    +
    + +
    + +
    + + Correct! + Incorrect :( +
    +
    +
    + +
    +

    Quiz is over. Score: {{score}}

    + +
    + +
    + +
    +

    Nomenclature

    +
    +

    This series of questions will help you review nomenclature of organic molecules. Apart from traditional exercise questions, you will be building several molecules based on their name using the modelling kit.

    +
    +
    + Begin! +
    + diff --git a/quizAngular/views/template2.html b/quizAngular/views/template2.html new file mode 100644 index 0000000..57e3eac --- /dev/null +++ b/quizAngular/views/template2.html @@ -0,0 +1,88 @@ +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    {{question}}

    +

    {{hint}}

    +
    +
      +
    • + +
    • +
    +
    + +
    + +
    +
    + +
    +
    +
    +
    Instructions
    +
      +
    1. Start playing by clicking . The button will be disabled after being activated only once.
    2. +
    3. Start the web camera stream by clicking .
    4. +
    5. Capture a picture and submit the picture to server that can detect the model you built by clicking .
    6. +
    7. In case that you want to stop the web cam stream, click .
    8. +
    9. Submit the result as usual once you are confident with the result.
    10. +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    + + + + +
    + + +
    +
    + +
    + +
    + + Correct! + Incorrect :( +
    +
    +
    + +
    +

    Quiz is over. Score: {{score}}

    + +
    + +
    + +
    +

    Stereochemistry

    +
    +

    Stereochemistry, a subdiscipline of chemistry, involves the study of the relative spatial arrangement of atoms that form the structure of molecules and their manipulation. An important branch of stereochemistry is the study of chiral molecules.

    +
    +
    + Begin! +
    \ No newline at end of file diff --git a/quizAngular/views/template3.html b/quizAngular/views/template3.html new file mode 100644 index 0000000..f9b5f74 --- /dev/null +++ b/quizAngular/views/template3.html @@ -0,0 +1,102 @@ + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    {{question}}

    +

    {{hint}}

    +
    +
      +
    • + +
    • +
    +
    + +
    + +
    +
    + +
    +
    + +
    +
    Instructions
    +
      +
    1. Start playing by clicking . The button will be disabled after being activated only once.
    2. +
    3. Start the web camera stream by clicking .
    4. +
    5. Capture a picture and submit the picture to server that can detect the model you built by clicking .
    6. +
    7. In case that you want to stop the web cam stream, click .
    8. +
    9. Submit the result as usual once you are confident with the result.
    10. +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    + + + + +
    + + +
    +
    + +
    + +
    + + Correct! + Incorrect :( +
    +
    +
    + +
    +

    Quiz is over. Score: {{score}}

    + +
    + +
    + +
    +

    Reactions

    +
    +

    A chemical reaction is when a substance (or a few substances) change into another substance. Chemical reactions are chemical transformations. If you take a chemistry class, you'll definitely learn about chemical reactions: when one or more substances change into something else. Get tested on your knowledge of reactions.

    +
    +
    + Begin! +
    \ No newline at end of file diff --git a/quizAngular/views/template4.html b/quizAngular/views/template4.html new file mode 100644 index 0000000..8e38cbe --- /dev/null +++ b/quizAngular/views/template4.html @@ -0,0 +1,102 @@ + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    {{question}}

    +

    {{hint}}

    +
    +
      +
    • + +
    • +
    +
    + +
    + +
    +
    + +
    +
    +
    +
    Instructions
    +
      +
    1. Start playing by clicking . The button will be disabled after being activated only once.
    2. +
    3. Start the web camera stream by clicking .
    4. +
    5. Capture a picture and submit the picture to server that can detect the model you built by clicking .
    6. +
    7. In case that you want to stop the web cam stream, click .
    8. +
    9. Submit the result as usual once you are confident with the result.
    10. +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + + +
    + + + + +
    + + +
    +
    + +
    + +
    + + Correct! + Incorrect :( +
    +
    +
    + +
    +

    Quiz is over. Score: {{score}}

    + +
    + +
    + +
    +

    Easy Quiz

    +
    +

    A collection of easy quiz to get started with!

    +
    +
    + Begin! +
    \ No newline at end of file