Esempio n. 1
0
File: main.php Progetto: vench/esee
<?php

namespace esee;

require_once 'esee/App.php';
App::autoload();
$image = new Image('../x1.jpg');
$image->open();
$diff = 16777215 / 2;
$provider = new provider\ProviderFile('data.txt');
$chainBuilder = new ChainBuilder($image, $diff);
$ar = [];
for ($y = 0; $y < $image->getHeight(); $y++) {
    for ($x = 0; $x < $image->getWidth(); $x++) {
        if ($chainBuilder->getValue($x, $y) == 1) {
            $c = $chainBuilder->makeChain($x, $y);
            if (is_null($c)) {
                continue;
            }
            Helper::view2($c);
            list($ax, $ay) = Helper::avg($c);
            $char = $provider->findByXY($ax, $ay);
            if (!is_null($char)) {
                echo "Find: {$char->char}\n";
                exit;
            } else {
                echo "No find: {$ax}, {$ay}\n";
            }
            array_push($ar, $c);
        }
    }
Esempio n. 2
0
File: vektr.php Progetto: vench/esee
echo $width . ' - ' . $height;
echo "\n";
$diff = 16777215 / 2;
$points = [];
for ($y = 0; $y < $height; $y++) {
    $points[$y] = [];
    for ($x = 0; $x < $width; $x++) {
        $v = imagecolorat($img, $x, $y);
        $points[$y][$x] = $v < $diff ? 1 : 0;
    }
}
echo "\n";
$ar = [];
$hash = [];
$words = (require 'dic.php');
$chainBuilder = new ChainBuilder($points);
foreach ($points as $y => $point) {
    foreach ($point as $x => $v) {
        if ($v == 1) {
            $c = $chainBuilder->makeChain2($x, $y);
            if (is_null($c)) {
                continue;
            }
            array_push($ar, $c);
            Helper::view2($c);
            echo "\n";
            //optimize($c);
            $mat = rastToVector($c->p);
            //print_r( $mat );
            $key = '';
            foreach ($mat as $m) {