PHP implements a simple image edge detection

Time:2021-9-17

A simple image edge detection method

General steps:

  1. Zoom pictures for efficiency
  2. Image graying
  3. Calculate edges based on brightness

The third step is the most critical. There are many methods used here to directly compare the adjacent brightness.

usage method:

install

composer require lizhichao/one-img

use

$img_path = '1.jpg';
$img = new \OneImg\Border();
$img->setImg($img_path)
    ->scale(300, 300)
    ->outline()
    ->save(); // Export to browser

effect

PHP implements a simple image edge detection
PHP implements a simple image edge detection
PHP implements a simple image edge detection
PHP implements a simple image edge detection
PHP implements a simple image edge detection

Code warehouse

https://github.com/lizhichao/doImg

My other warehouses welcome star

Recommended Today

Seven Python code review tools recommended

althoughPythonLanguage is one of the most flexible development languages at present, but developers often abuse its flexibility and even violate relevant standards. So PythoncodeThe following common quality problems often occur: Some unused modules have been imported Function is missing arguments in various calls The appropriate format indentation is missing Missing appropriate spaces before and after […]