<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## 圖片轉素描 ```php $image_path = "1.jpg"; // $image_path="2.png"; $im_gray = imagecreatefromjpeg($image_path); $width = imagesx($im_gray); $height = imagesy($im_gray); //對圖像使用過濾器 imagefilter($im_gray, IMG_FILTER_GRAYSCALE); //用于創建畫布 $im_invert = imagecreatetruecolor($width, $height); //在畫布中繪制圖像 imagecopy($im_invert, $im_gray, 0, 0, 0, 0, $width, $height); //對圖像使用過濾器 imagefilter($im_invert, IMG_FILTER_NEGATE); imagefilter($im_invert, IMG_FILTER_GAUSSIAN_BLUR); //這個算法最后再給出 $image = color_dodge_blend($im_gray, $im_invert, $width, $height); header('Content-Type: image/jpeg'); //設置圖片類型,同樣如果想生成gif或者png圖象,要替換成相應的頭 imagejpeg($image); //輸出圖象,如果是gif就用imagegif,如果是png就用imagepng…… imagedestroy($image); function color_dodge($mask, $image) { $GAUSS_COUNT = 10; $COLOR_STEP = 30; $result = ($image === 255) ? $image : min(255, (($mask << 8 ) / (255 - $image))); //$result = ($result <= 210) ? 0 : $result; // var_dump($result,$COLOR_STEP);die; $result = (int) ($result / $COLOR_STEP) * $GAUSS_COUNT; return $result; } function kmax1($array) { return array_search(max($array), $array); } function color_dodge_blend($source, $layer, $width, $height) { //用于創建畫布 $image = imagecreatetruecolor($width, $height); $color_array = array(); for ($x = 0; $x < $width; $x++) { for ($y = 0; $y < $height; $y++) { //計算灰度 $rgb = ImageColorAt($source, $x, $y); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; $rgb2 = ImageColorAt($layer, $x, $y); $r2 = ($rgb2 >> 16) & 0xFF; $g2 = ($rgb2 >> 8) & 0xFF; $b2 = $rgb2 & 0xFF; $r = color_dodge($r, $r2); $g = color_dodge($g, $g2); $b = color_dodge($b, $b2); $rgb = ($r << 16) | ($g << 8) | $b; $color_array[$rgb] = key_exists($rgb, $color_array) ? $color_array[$rgb] + 1 : 1; //在指定的坐標處繪制像素。 imagesetpixel($image, $x, $y, $rgb); } } $background = kmax1($color_array); for ($x = 0; $x < $width; $x++) { for ($y = 0; $y < $height; $y++) { //獲取顏色 $rgb = ImageColorAt($image, $x, $y); if ($rgb === $background) { //在指定的坐標處繪制像素。 imagesetpixel($image, $x, $y, 0xFFFFFF); } } } return $image; } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看