convolutionSeparable - Image Convolution with CUDA Victor...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
June 2007 Image Convolution with CUDA Victor Podlozhnyuk sdkfeedback@nvidia.com
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
June 2007 Page ii of 21 Document Change History Version Date Responsible Reason for Change 0.1 10/25/2006 Lee Howes Initial version 0.2 2/09/2007 Mark Harris Revised Lee’s original document 0.3 2/26/2007 Eric Young Revised document to match new SDK document format 0.8 3/21/2007 Mark Harris First release version. 1.0 06/1/2007 Victor Podlozhnyuk Adapted the whitepaper to new convolutionSeparable project.
Background image of page 2
June 2007 Page iii of 21 Table of Contents Table of Contents . .......................................................................................................................................... iii Abstract. ............................................................................................................. 1 Motivation. ........................................................................................................................................................ 2 How Does It Work?. ....................................................................................................................................... 3 A Naïve Implementation. ............................................................................................................................... 5 Shared Memory and the Apron. .................................................................................................................... 6 Avoiding idle threads. ...................................................................................................................................... 7 Separable Filters Can Increase Efficiency. ................................................................................................... 9 Optimizing for memory coalescence. ......................................................................................................... 10 Unrolling Loops. ............................................................................................................................................ 11 Implementations Details. .............................................................................................................................. 11 The Row Filter . .............................................................................................................................................. 11 The Column Filter . ........................................................................................................................................ 13 Running the Sample . ..................................................................................................................................... 14 Conclusion . ..................................................................................................................................................... 16 Bibliography. ................................................................................................................................................... 17
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
June 2007 Page 1 of 21 1 Abstract Convolution filtering is a technique that can be used for a wide array of image processing tasks, some of which may include smoothing and edge detection. In this document we show how a separable convolution filter can be implemented in NVIDIA CUDA and provide some guidelines for performance optimizations.
Background image of page 4
Image Convolution with CUDA June 2007 Page 2 of 21 Motivation Convolutions are used by many applications for engineering and mathematics. Many types of blur filters or edge detection use convolutions. This example illustrates how using CUDA can be used for an efficient and high performance implementation of a separable convolution filter. Figure 1(b) shows the effect of a convolution filter. Figure 1(a) Original Image Figure 1(b) Blur convolution filter applied to the source image from Figure 1(a) These two images show a comparison of an image convolution applied to an original source image .
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image Convolution with CUDA June 2007 Page 3 of 21 How Does It Work? Mathematically, a convolution measures the amount of overlap between two functions [1]. It can be thought of as a blending operation that integrates the point-wise multiplication of one dataset with another. = = dn n k n i s i k s i r ) ( ) ( ) )( * ( ) ( In discrete terms this can be written as: = = n n k n i s i k s i r ) ( ) ( ) )( * ( ) ( . Convolution can be extended into two dimensions by adding indices for the second dimension: ∑∑ = = nm m n k m j n i s j i k s i r ) , ( ) , ( ) , )( * ( ) ( In the context of image processing a convolution filter is just the scalar product of the filter weights with the input pixels within a window surrounding each of the output pixels. This scalar product is a parallel operation that is well suited to computation on highly parallel hardware such as the GPU. This is demonstrated below in Figure 2. Figure 2: The basic convolution method.
Background image of page 6
Image Convolution with CUDA June 2007 Page 4 of 21 Separable Filters Generally, a two-dimensional convolution filter requires n*m multiplications for each output pixel, where n and m are the width and height of the filter kernel. Separable filters are a special type of filter that can be expressed as the composition of two one- dimensional filters, one on the rows on the image, and one on the columns.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/06/2010 for the course CS 8803 taught by Professor Staff during the Spring '08 term at Georgia Institute of Technology.

Page1 / 21

convolutionSeparable - Image Convolution with CUDA Victor...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online