Skip to content

MithatGuner/Convolution-Algorithm-PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convolution Algorithm in PHP

Operation Kernel Image Result g(x,y)
Identity [0 0 0]
[0 1 0]
[0 0 0]
alt text
Ridge [0 0 0]
[0 1 0]
[0 0 0]
alt text
Edge Detection [-1 -1 -1]
[-1 8 -1]
[-1 -1 -1]
alt text
Sharpen [0 -1 0]
[-1 5 -1]
[0 -1 0]
alt text

Usage

public function __construct($img_path, $kernel) { }
    @param mixed $img_path
    @param mixed $kernel
    @return void

public function convolution($image) { }
    @param mixed $image
    @return array

Example

<?php
$kernel = array(
    array(0, 0, 0),
    array(0, 1, 0),
    array(0, 0, 0),
);
$conv = new convolution("image.png", $kernel);

$conv->createImage(
    "result.png",
    $conv->convolution($conv->r_array),
    $conv->convolution($conv->g_array),
    $conv->convolution($conv->b_array),
    $conv->convolution($conv->a_array)
);

About

Convolution Algorithm in PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages