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
26 changes: 12 additions & 14 deletions Live-LeastWorkingModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,18 @@ 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
p1 = c1*PERCENT_SKIP + c2*(1-PERCENT_SKIP)
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()
Expand Down Expand Up @@ -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()
Expand All @@ -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 = []
Expand All @@ -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
Expand All @@ -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
Expand Down
Binary file modified django13api/__init__.pyc
Binary file not shown.
Binary file modified django13api/settings.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion django13api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
)
2 changes: 1 addition & 1 deletion quizAngular/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h1>IPRO 207 Interactive Exercises<span>From Physical Ball and Stick to Computer
<li class="active"><a href="#nomenclature" data-toggle="tab">Nomenclature</a></li>
<li><a href="#stereochemistry" data-toggle="tab">Stereochemistry</a></li>
<li><a href="#reactions" data-toggle="tab">Reactions</a></li>
<li><a href="#easy" data-toggle="tab">Easy Quiz</a></li>
<li><a href="#easy" data-toggle="tab">Easy Exercises</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="nomenclature">
Expand Down
3 changes: 2 additions & 1 deletion quizAngular/app/views/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ <h4 id="question">{{question}}</h4>
<button class="btn btn-danger" id="btnStop" style="width:50px"><span class="glyphicon glyphicon-stop"></span></button>
<button class="btn btn-warning" id="btnPhoto" style="width:50px"><span class="glyphicon glyphicon-picture"></span></button>
</div>
<canvas id="canvas" width="250" height="180" style="padding:5px 0px 0px 5px"></canvas>
<!--<canvas id="canvas" width="250" height="180" style="padding:5px 0px 0px 5px"></canvas>-->
<canvas id="canvas" width="640" height="480" style="padding:5px 0px 0px 5px"></canvas>
</div>
</div>

Expand Down
3 changes: 2 additions & 1 deletion quizAngular/app/views/template2.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ <h4 id="question">{{question}}</h4>
<button class="btn btn-danger" id="btnStop" style="width:50px"><span class="glyphicon glyphicon-stop"></span></button>
<button class="btn btn-warning" id="btnPhoto" style="width:50px"><span class="glyphicon glyphicon-picture"></span></button>
</div>
<canvas id="canvas" width="250" height="180" style="padding:5px 0px 0px 5px"></canvas>
<!--<canvas id="canvas" width="250" height="180" style="padding:5px 0px 0px 5px"></canvas>-->
<canvas id="canvas" width="640" height="480" style="padding:5px 0px 0px 5px"></canvas>
</div>
</div>

Expand Down
3 changes: 2 additions & 1 deletion quizAngular/app/views/template3.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ <h4 id="question">{{question}}</h4>
<button class="btn btn-danger" id="btnStop" style="width:50px"><span class="glyphicon glyphicon-stop"></span></button>
<button class="btn btn-warning" id="btnPhoto" style="width:50px"><span class="glyphicon glyphicon-picture"></span></button>
</div>
<canvas id="canvas" width="250" height="180" style="padding:5px 0px 0px 5px"></canvas>
<!--<canvas id="canvas" width="250" height="180" style="padding:5px 0px 0px 5px"></canvas>-->
<canvas id="canvas" width="640" height="480" style="padding:5px 0px 0px 5px"></canvas>
</div>
</div>

Expand Down
3 changes: 2 additions & 1 deletion quizAngular/app/views/template4.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ <h4 id="question">{{question}}</h4>
<button class="btn btn-danger" id="btnStop" style="width:50px"><span class="glyphicon glyphicon-stop"></span></button>
<button class="btn btn-warning" id="btnPhoto" style="width:50px"><span class="glyphicon glyphicon-picture"></span></button>
</div>
<canvas id="canvas" width="250" height="180" style="padding:5px 0px 0px 5px"></canvas>
<!--<canvas id="canvas" width="250" height="180" style="padding:5px 0px 0px 5px"></canvas>-->
<canvas id="canvas" width="640" height="480" style="padding:5px 0px 0px 5px"></canvas>
</div>
</div>

Expand Down
24 changes: 21 additions & 3 deletions quizAngular/dist/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<!doctype html> <html class="no-js"> <head> <meta charset="utf-8"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> <link rel="icon" type="image/icon" href="favicon (1).ico"> <link rel="stylesheet" href="styles/vendor.2ac5f564.css"> <link rel="stylesheet" href="styles/main.d6eaaed8.css"> <body ng-app="quizAngularApp"> <!--[if lt IE 7]>
<!doctype html> <html class="no-js"> <head> <meta charset="utf-8"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="icon" type="image/icon" href="favicon (1).ico">
<link rel="stylesheet" href="styles/vendor.2ac5f564.css">
<link rel="stylesheet" href="styles/main.d6eaaed8.css">
<body ng-app="quizAngularApp"> <!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]--> <!-- Add your site or application content here --> <div class="jumbotron"> <section class="container"> <h1>IPRO 207 Quiz App <span>From Physical Ball and Stick to Computer Models of Chemical Systems</span></h1> </section> <!-- <div class="navbar navbar-default" role="navigation">
<![endif]--> <!-- Add your site or application content here --> <div class="jumbotron"> <section class="container">
<h1>IPRO 207 Interactive Excercise App <span>From Physical Ball and Stick to Computer Models of Chemical Systems</span></h1> </section> <!-- <div class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">

Expand All @@ -23,7 +29,19 @@
</ul>
</div>
</div>
</div>--> </div> <div class="container"> <div class="row"> <ul class="nav nav-tabs"> <li class="active"><a href="#nomenclature" data-toggle="tab">Nomenclature</a></li> <li><a href="#stereochemistry" data-toggle="tab">Stereochemistry</a></li> <li><a href="#reactions" data-toggle="tab">Reactions</a></li> <li><a href="#easy" data-toggle="tab">Easy Quiz</a></li> </ul> <div class="tab-content"> <div class="tab-pane fade in active" id="nomenclature"> <quiz> <br> </quiz></div> <div class="tab-pane fade" id="stereochemistry"> <quiz2> <br> </quiz2></div> <div class="tab-pane fade" id="reactions"> <quiz3> <br> </quiz3></div> <div class="tab-pane fade" id="easy"> <quiz4> <br> </quiz4></div> </div> </div> </div> <div class="footer"> <div class="container"> <p><span class="glyphicon glyphicon-heart"></span> from the IPRO 207 team</p> </div> </div> <!-- Google Analytics: change UA-XXXXX-X to be your site's ID --> <script>!function(A,n,g,u,l,a,r){A.GoogleAnalyticsObject=l,A[l]=A[l]||function(){
</div>--> </div> <div class="container">
<div class="row"> <ul class="nav nav-tabs">
<li class="active"><a href="#nomenclature" data-toggle="tab">Nomenclature</a></li>
<li><a href="#stereochemistry" data-toggle="tab">Stereochemistry</a></li>
<li><a href="#reactions" data-toggle="tab">Reactions</a></li>
<li><a href="#easy" data-toggle="tab">Easy Excercise</a></li> </ul>
<div class="tab-content"> <div class="tab-pane fade in active" id="nomenclature"> <quiz> <br> </quiz></div>
<div class="tab-pane fade" id="stereochemistry"> <quiz2> <br> </quiz2></div>
<div class="tab-pane fade" id="reactions"> <quiz3> <br> </quiz3></div>
<div class="tab-pane fade" id="easy"> <quiz4> <br> </quiz4></div> </div> </div> </div>
<div class="footer"> <div class="container"> <p><span class="glyphicon glyphicon-heart"></span> from the IPRO 207 team</p> </div> </div>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID -->
<script>!function(A,n,g,u,l,a,r){A.GoogleAnalyticsObject=l,A[l]=A[l]||function(){
(A[l].q=A[l].q||[]).push(arguments)},A[l].l=+new Date,a=n.createElement(g),
r=n.getElementsByTagName(g)[0],a.src=u,r.parentNode.insertBefore(a,r)
}(window,document,'script','//www.google-analytics.com/analytics.js','ga');
Expand Down
33 changes: 33 additions & 0 deletions quizAngular/dist/scripts/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';

/**
* @ngdoc overview
* @name quizAngularApp
* @description
* # quizAngularApp
*
* Main module of the application.
*/
angular
.module('quizAngularApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngRoute',
'ngSanitize',
'ngTouch'
])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/about', {
templateUrl: 'views/about.html',
controller: 'AboutCtrl'
})
.otherwise({
redirectTo: '/'
});
});
17 changes: 17 additions & 0 deletions quizAngular/dist/scripts/controllers/about.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

/**
* @ngdoc function
* @name quizAngularApp.controller:AboutCtrl
* @description
* # AboutCtrl
* Controller of the quizAngularApp
*/
angular.module('quizAngularApp')
.controller('AboutCtrl', function ($scope) {
$scope.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
];
});
Loading