Enhance edges within the image with a convolution filter of the given radius. Use radius 0 and it will be auto-selected.
function edgeImage($image_path, $radius)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->edgeImage($radius);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}