Using Gaussian algorithm to realize image fuzzy processing

Source: Internet
Author: User

<?PHPclassimage_blur{function Gaussian_blur ($srcImg, $savepath=NULL, $savename =NULL, $blurFactor =3) {$gdImageResource=$ This-Image_create_from_ext ($SRCIMG); $SRCIMGOBJ=$ This-Blur ($gdImageResource, $blurFactor); $temp=PathInfo ($SRCIMG); $name= $temp ['basename']; $path= $temp ['dirname']; $exte= $temp ['extension']; $savename= $savename?$savename: $name; $savepath= $savepath?$savepath: $path; $savefile= $savepath.'/'. $savename; $srcinfo=@getimagesize ($SRCIMG); Switch($srcinfo [2]) {             Case 1: Imagegif ($SRCIMGOBJ, $savefile); Break;  Case 2: imagejpeg ($SRCIMGOBJ, $savefile); Break;  Case 3: Imagepng ($SRCIMGOBJ, $savefile); Break; default:return 'Save failed';//Save failed        }        return$savefile;    Imagedestroy ($SRCIMGOBJ); }} $image _blur=NewImage_blur ();
The value of Blurfactor represents the degree of ambiguity, Savepath is directly covered when empty, Savename is empty directly with the original
$image _blur->gaussian_blur ($srcImg ="./5.jpg", $savepath =null, $ Savename=null, $blurFactor =5);
?>

This method Baidu to, there is an interview I let me do, Baidu a pile of data to achieve.

The value of Blurfactor represents the degree of ambiguity
Effect Show:
Original


Degree of ambiguity 2


Degree of ambiguity 3


Degree of ambiguity 4


Degree of ambiguity 5


Degree of ambiguity 6


Degree of ambiguity 7

Using Gaussian algorithm to realize image fuzzy processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.