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 make_bigger_image(): | |
""" To get a better result from OCR images should be large. | |
Function enlarges the image | |
""" | |
bolder_image = Image.open("bold_image.gif") | |
big = bolder_image.resize((1000, 500), Image.NEAREST) | |
big.save("bigger_image.tif") |
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
if __name__ == "__main__": | |
image = Image.open("some_captcha_image_path") | |
make_bolder_image(image) | |
make_bigger_image() | |
final_image = Image.open("bigger_image.tif") | |
print(image_to_string(final_image)) |
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
<html> | |
<head> | |
<title>Graph</title> | |
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/style.css"> | |
<script src="http://code.jquery.com/jquery-1.8.3.js"></script> | |
</head> | |
<body> | |
<center><h2>Graph Coloring</h2></center> | |
<center> | |
<canvas id="myCanvas" width="700" height="450" style="background-color: #ffffff; border: 5px solid #000000;"> |
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
var board = document.getElementById("myCanvas"); | |
var ctx = board.getContext("2d"); | |
var colorset = ['#698B22', '#CD2626', '#FF7F00', '#FFD700', '#00CDCD', '#1874CD', '#FF00FF', '#CD6090']; |
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
board.onmousedown = function(e) { | |
var x = e.pageX - this.offsetLeft; | |
var y = e.pageY - this.offsetTop; | |
ctx.fillStyle = "#000000" | |
ctx.beginPath(); | |
ctx.arc(x, y, 10, 0 , 2 * Math.PI, false); | |
ctx.fill(); | |
ctx.closePath(); | |
ctx.fillText(++node_id, x+10, y-10); | |
node_set.push({id: node_id, "x": x, "y": y}); |
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 (var i=0;i<node_set.length;i++){ | |
var n_x = node_set[i].x; | |
var n_y = node_set[i].y; | |
if (!adj_list[i+1]){ | |
adj_list[i+1] = []; | |
} | |
if (x <= n_x+10 && x >= n_x-10 && y <= n_y+10 && y >= n_y-10){ | |
if (!edge_started){ | |
s_x = n_x, s_y = n_y; | |
glitter(s_x, s_y); |
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
function send(){ | |
$.post("/", {adj_data: JSON.stringify(adj_list)}, function(data, status) { | |
colorify_graph(JSON.parse(data)); | |
}); | |
} | |
function colorify_graph (data){ | |
for (var i=0; i<=node_set.length; i++){ | |
ctx.fillStyle = colorset[data[i+1]]; | |
ctx.beginPath(); |
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
function clears(){ | |
document.location.href="/"; | |
} |
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 django.conf.urls import patterns, include, url | |
from views import graph | |
from django.contrib import admin | |
admin.autodiscover() | |
urlpatterns = patterns('', | |
# Examples: | |
# url(r'^$', 'graphs_django.views.home', name='home'), | |
# url(r'^blog/', include('blog.urls')), |
OlderNewer