# image processing

**URL:** <https://forums.developer.nvidia.com/t/image-processing/18321>\
**Category:** CUDA Programming and Performance\
**Created:** [August 16, 2010, 12:48pm UTC](https://forums.developer.nvidia.com/t/image-processing/18321 "2010-08-16T12:48:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![migal](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@migal](https://forums.developer.nvidia.com/u/migal)\
**Post date:** [August 16, 2010, 12:48pm UTC](https://forums.developer.nvidia.com/t/image-processing/18321/1 "2010-08-16T12:48:39Z")

</div>

hello everyone,

i’m using CUDA 2.3 with C++ to perform some calculations on pictures. for some calculations i treat all pixels in parallel but in some others i’m obliged to treat line by line.  
My question is how can i put one line per thread ? and run all the lines in parallel?

thank you.

---

<div class="post-metadata">

**Author:** ![jgoffeney](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jgoffeney](https://forums.developer.nvidia.com/u/jgoffeney)\
**Post date:** [August 16, 2010, 1:31pm UTC](https://forums.developer.nvidia.com/t/image-processing/18321/2 "2010-08-16T13:31:25Z")

</div>

Set up your thread blocks and grid as 1 dimensional based on the number of rows you want to process. Then in your kernel code consider each thread id as a row index. Perform some loop to operate over the entire line.

Something like:

for(int i = threadIdx \* rowWidth; i \< (threadIdx \* rowWidth + rowWidth); i++)  
{  
//do stuff  
}

---

<div class="post-metadata">

**Author:** ![jgoffeney](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jgoffeney](https://forums.developer.nvidia.com/u/jgoffeney)\
**Post date:** [August 16, 2010, 1:31pm UTC](https://forums.developer.nvidia.com/t/image-processing/18321/3 "2010-08-16T13:31:25Z")

</div>

Set up your thread blocks and grid as 1 dimensional based on the number of rows you want to process. Then in your kernel code consider each thread id as a row index. Perform some loop to operate over the entire line.

Something like:

for(int i = threadIdx \* rowWidth; i \< (threadIdx \* rowWidth + rowWidth); i++)  
{  
//do stuff  
}
