2011-08-09 19 views
2

我試圖在iphone中實現Shephards失真。 以下是我的代碼:2個控制點的謝潑德失真扭曲整個圖像 - ImageMagick Iphone sdk

const double ctrlPts[8] = {125,200 ,150,150, 255,150, 150, 150}; 
const size_t q = 8; 
MagickDistortImage(magick_wand, ShepardsDistortion , q, ctrlPts, MagickFalse); 

以下是我的結果

第一個是原始圖像和第二個是扭曲的圖像。

Original ImageDistorted Image

我只想一個像素移動到其他位置。 我無法弄清楚我犯的錯誤。

我想給多點和自由歪曲從這個 link

+0

你能澄清你的意思是:「我只是想一個像素移動到其他位置」? – msgambel

+0

我只想將一個像素從一個點移動到另一個點。在結果圖像中,您可以看到一列像素被移動,因此圖像失真。我只想移動一個像素而不是該列。 – DivineDesert

+0

你能發佈更多的代碼嗎,因此有人可以更容易地嘗試一下嗎? – jtbandes

回答

1

難道僅僅因爲你拖動圖像進入中心略,並沒有要放什麼差距?

嘗試設置邊角角的固定:

const double ctrlPts[24] = { 
    // Points to move 
    125,200 ,150,150, 255,150, 150, 150, 

    // Points to fix 
    0,0,0,0, 320,0,320,0, 320,460,320,460, 0,460,0,460 
}; 
+0

應該是ctrlPts [24],是嗎? –

+0

Cool This Worked ...'0,0,0,0,320,0,320,0,320,460,320,** 460 **,0,460,0,460'一個參數不匹配。 – DivineDesert

+0

Thanks @Dimple Panchal - fixed :) – deanWombourne