2016-04-03 95 views

回答

2

我實施了縫合眼視網膜的圖像接縫的去除。下面你可以找到最終的效果:

enter image description here

要做到這一點,我實現了this紙138頁中描述的技術。下面你可以找到解釋的僞代碼,完整的源代碼可以在my repository上找到。

算法是基於通過執行重疊在該像素的圖像的像素值的計算weighted average像素的最終值。權重基於從像素到圖像邊緣的距離。如果像素更接近它所屬圖像的中心,則更重要,重量更大。像素到圖像邊緣的距離可以通過使用由OpenCV實現的功能distanceTransform來計算。這是放在最後的鑲嵌眼睛的視網膜圖像的一個轉變距離的影響:

enter image description here

下面你可以找到僞代碼:

// Images is an array of images that the program is stitching 

// For every image (after transform) on final plane calculate distance transform 
for (image in images) { 
    // Calculate distance transform 
    image.distanceTransform = distanceTransform(image) 
} 

// For every pixel in final mosaic, calulate its value by using weighted average 
for (row in rows) { 
    for (col in cols) { 
    currentPixel = FinalMosaic(col, row) 

    // Values for weighted average 
    numeratorSum = 0 
    denominatorSum = 0 

    // Go through all images that can overlap at this pixel 
    for (image in images) { 
     // If image is not overlapping over this pixel just skip 
     isOverlapping = image.isOverlapping(currentPixel) 
     if (isOverlapping) { 
     currentPixelWeight = image.distanceTransform.valueAt(currentPixel) 
     numeratorSum += currentPixelWeight * currentPixel.value 
     denominatorSum += currentPixelWeight 
     } 
    } 

    if (denominatorSum != 0) { 
     currentPixel.value = numeratorSum/denominatorSum 
    } 
    } 
} 

如果有不清楚的地方,寫在題評論和我會盡力改善答案。

-2

你能告訴什麼是你得到最終,因爲我無法理解怎麼會被我們刪除接縫線的圖像中,如果我們參加2個圖像解決方案,我們在獲得兩個圖像之間的單個垂直線縫指向他們加入的地方。

+0

這不是答案。 – Gerriet