This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#extended from http://stackoverflow.com/questions/15706339/how-to-compute-emd-for-2-numpy-arrays-i-e-histogram-using-opencv | |
#Earth Mover Distance = histogram similarity metric. Weights are optional. | |
def histEMD(hist1, hist2, hist1weights = [], hist2weights = []): | |
if not len(hist1weights): | |
hist1weights = np.ones(len(hist1)) | |
if not len(hist2weights): | |
hist2weights = np.ones(len(hist1)) | |
a64 = cv.fromarray(np.dstack((hist1weights, hist1))[0].copy()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2013-04-09 07:39:21,858: ERROR/MainProcess] Error in timer: ConnectionError('Too many heartbeats missed', None, None, None, '') | |
Traceback (most recent call last): | |
File "/usr/local/lib/python2.7/dist-packages/celery/utils/timer2.py", line 97, in apply_entry | |
entry() | |
File "/usr/local/lib/python2.7/dist-packages/celery/utils/timer2.py", line 51, in __call__ | |
return self.fun(*self.args, **self.kwargs) | |
File "/usr/local/lib/python2.7/dist-packages/celery/utils/timer2.py", line 153, in _reschedules | |
return fun(*args, **kwargs) | |
File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 264, in heartbeat_check | |
return self.transport.heartbeat_check(self.connection, rate=rate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mongoengine import Q | |
parts = Frame.objects(Q(**{"metadata__Part Number__startswith": "NC"}) | Q(**{"metadata__Part Number__startswith": "OK"})) | |
symerror = [] | |
for p in parts: | |
fd = p.features[0].featuredata | |
symerror.append(abs(fd['transition_length_left_mm'] - fd['transition_length_right_mm'])) | |
print fd['transition_length_left_mm'], " ", fd['transition_length_right_mm'] | |
print "average:", np.sum(symerror) / len(symerror) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def findShaftTransition(self,img,left_guess,right_guess,top_cutoff): | |
""" | |
Walk the line on the shaft find where it starts to bulge out | |
""" | |
def transformFromROI(roi, points): | |
return np.array([(p[0] + roi[0], p[1] + roi[1]) for p in points]) | |
right_guess = sorted(right_guess, key = lambda l: l[1]) #make sure it's bottom, top | |
roi_delta = 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# <nbformat>3.0</nbformat> | |
# <codecell> | |
from random import random | |
from SimpleCV import Image, Color | |
from scipy import stats | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vendor css: | |
https://github.com/ingenuitas/SimpleSeer/tree/master/SimpleSeer/static/vendor/styles | |
our css: | |
https://github.com/ingenuitas/SimpleSeer/tree/master/SimpleSeer/static/app/styles | |
our "theme" page (header/footer) and any static image files | |
https://github.com/ingenuitas/SimpleSeer/tree/master/SimpleSeer/static/app/assets | |
our templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cameras": [ | |
{ "id": 0, "name": "Scanner", "scanner": 1 } | |
], | |
"web": { "address": "localhost:8080" }, | |
"mongo": { "host" : "127.0.0.1" }, | |
"database": "default", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SimpleSeer.Web: ERROR Exception on /grid/thumbnail_file/4fe47a9c598e1e04a90000f8 [GET] | |
Traceback (most recent call last): | |
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1504, in wsgi_app | |
response = self.full_dispatch_request() | |
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1264, in full_dispatch_request | |
rv = self.handle_user_exception(e) | |
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1262, in full_dispatch_request | |
rv = self.dispatch_request() | |
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1248, in dispatch_request | |
return self.view_functions[rule.endpoint](**req.view_args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gc | |
import SimpleSeer.models as M | |
@core.state('start') | |
def start(state): | |
state.core.set_rate(10.0) | |
return state.core.state('waitforbuttons') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for v in Image("lenna").findLines()[0].__dict__.values(): | |
try: | |
for vprime in v: | |
print type(vprime) | |
except: | |
print type(v) |