Skip to content

PHP implementation of Sobel operator (Sobel filter)

Notifications You must be signed in to change notification settings

qmegas/sobel-operator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sobel operator

This is Sobel operator (or Sobel filter) implementation on PHP. It used in image processing and computer vision, particularly within edge detection algorithms. Read full article in Wikipedia

Installation

composer require qmegas/sobel-operator

Requirements

PHP >= 7.0

Usage Examples

<?php

$sobel = new \Qmegas\SobelOperator();
$image = imagecreatefromjpeg('1.jpg');
header('Content-type: image/png');
imagepng($sobel->applyFilter($image));

Options

Parameter Description
flat Enables flat mode
threshold Set threshold manually. In case that parameter is not set, algorithm choose threshold automatically
return_threshold Return an array of two elements. First one is an image with Sobel filter applied, second element is value of applied threshold
<?php

$sobel = new \Qmegas\SobelOperator();
$image = imagecreatefromjpeg('1.jpg');
header('Content-type: image/png');
imagepng($sobel->applyFilter($image, [
	'flat' => true,
	'threshold' => 30,
]));

About

PHP implementation of Sobel operator (Sobel filter)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages