當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python Wand stereogram()用法及代碼示例

立體圖效果是在圖像內部生成圖像的效果。立體圖是圖片中的圖片。正確查看時,隱藏在每個圖像內部的對象會以3D形式顯示。
stereogram()函數使用兩個Image實例(每隻眼睛一個),並通過將Red&Cyan分開來創建3d圖像。

用法:
wand.image.stereogram(left, right)

參數:

參數 輸入類型 描述
left wand.image.Image() Left-eye圖片。
right wand.image.Image() Right-eye圖片。

源圖像:

範例1:



# Import Image from wand.image module 
from wand.image import Image 
  
# Read image using Image function 
with Image(filename ="koala.jpeg") as leftimg:
  
    with Image(filename ="koala.jpeg") as rightimg:
        # stereogram image using stereogram function 
        with Image.stereogram(left = leftimg, right = rightimg) as img:
            img.save(filename ="fx-stereogram.jpg")

輸出:

源圖像:

範例2:

# Import Image from wand.image module 
from wand.image import Image 
  
# Read image using Image function 
with Image(filename ="koala.jpeg") as leftimg:
  
    with Image(filename ="koala.jpeg") as rightimg:
  
        # stereogram image using stereogram function 
        with Image.stereogram(left = leftimg, right = rightimg) as img:
            img.save(filename ="fx-stereogram.jpg")

輸出:




相關用法


注:本文由純淨天空篩選整理自RahulSabharwal大神的英文原創作品 Wand stereogram() function in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。