PHP Class JansenFelipe\OMR\Contracts\Scanner

Show file Open project: jansenfelipe/omr

Protected Properties

Property Type Description
$debug boolean Debug flag
$debugPath string Path image to wirte debug image file
$imagePath string Path image to be scanned

Public Methods

Method Description
scan ( Map $map ) : Result Scan specific image
setDebug ( boolean $debug ) Set debug flag
setDebugPath ( mixed $debugPath ) Set debug image path
setImagePath ( mixed $imagePath ) Set image path

Protected Methods

Method Description
ajustRotate ( float $degrees ) Rotate image
ajustSize ( float $percent ) Increases or decreases image size
anglePoints ( Point $a, Point $b ) : float Calculates angle between two points
bottomLeft ( Point $near ) : Point Most point to the bottom/left
circleArea ( Point $a, float $radius, float $tolerance ) : Area Returns pixel analysis in a circular area
createResult ( string $imagePath ) : Result Create Result object from imagePath
debug ( ) Genereate file debug.jpg with targets, topRight and buttonLeft
distancePoints ( Point $a, Point $b ) : float Calculates distance between two points
finish ( ) Finish processes
rectangleArea ( Point $a, Point $b, float $tolerance ) : Area Returns pixel analysis in a rectangular area
textArea ( Point $a, Point $b ) : string Returns image blob in a rectangular area
topRight ( Point $near ) : Point Most point to the top/right

Method Details

ajustRotate() abstract protected method

Rotate image
abstract protected ajustRotate ( float $degrees )
$degrees float

ajustSize() abstract protected method

Increases or decreases image size
abstract protected ajustSize ( float $percent )
$percent float

anglePoints() protected method

Calculates angle between two points
protected anglePoints ( Point $a, Point $b ) : float
$a JansenFelipe\OMR\Point
$b JansenFelipe\OMR\Point
return float

bottomLeft() abstract protected method

Most point to the bottom/left
abstract protected bottomLeft ( Point $near ) : Point
$near JansenFelipe\OMR\Point
return JansenFelipe\OMR\Point

circleArea() abstract protected method

Returns pixel analysis in a circular area
abstract protected circleArea ( Point $a, float $radius, float $tolerance ) : Area
$a JansenFelipe\OMR\Point
$radius float
$tolerance float
return JansenFelipe\OMR\Area

createResult() protected method

Create Result object from imagePath
protected createResult ( string $imagePath ) : Result
$imagePath string
return JansenFelipe\OMR\Result

debug() abstract protected method

Genereate file debug.jpg with targets, topRight and buttonLeft
abstract protected debug ( )

distancePoints() protected method

Calculates distance between two points
protected distancePoints ( Point $a, Point $b ) : float
$a JansenFelipe\OMR\Point
$b JansenFelipe\OMR\Point
return float

finish() abstract protected method

Finish processes
abstract protected finish ( )

rectangleArea() abstract protected method

Returns pixel analysis in a rectangular area
abstract protected rectangleArea ( Point $a, Point $b, float $tolerance ) : Area
$a JansenFelipe\OMR\Point
$b JansenFelipe\OMR\Point
$tolerance float
return JansenFelipe\OMR\Area

scan() public method

Scan specific image
public scan ( Map $map ) : Result
$map Map
return JansenFelipe\OMR\Result

setDebug() public method

Set debug flag
public setDebug ( boolean $debug )
$debug boolean

setDebugPath() public method

Set debug image path
public setDebugPath ( mixed $debugPath )
$debugPath mixed

setImagePath() public method

Set image path
public setImagePath ( mixed $imagePath )
$imagePath mixed

textArea() abstract protected method

Returns image blob in a rectangular area
abstract protected textArea ( Point $a, Point $b ) : string
$a JansenFelipe\OMR\Point
$b JansenFelipe\OMR\Point
return string

topRight() abstract protected method

Most point to the top/right
abstract protected topRight ( Point $near ) : Point
$near JansenFelipe\OMR\Point
return JansenFelipe\OMR\Point

Property Details

$debug protected property

Debug flag
protected bool $debug
return boolean

$debugPath protected property

Path image to wirte debug image file
protected string $debugPath
return string

$imagePath protected property

Path image to be scanned
protected string $imagePath
return string