31
A simple image edge detection method
General steps:
- Zoom pictures to improve efficiency
- Picture grayscale
- Calculate edges based on brightness
The third step is the most critical. There are many ways to directly contrast the adjacent brightness.
Instructions:
composer require lizhichao/one-img
$img_path = '1.jpg';
$img = new \OneImg\Border();
$img->setImg($img_path)
->scale(300, 300)
->outline()
->save(); //Output to browser
![](https://res.cloudinary.com/practicaldev/image/fetch/s--OBGfL7jr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w7cd9mezynrzwu3kj2bx.png)
31