Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The nose getting green means you have overflows in your code, but that's strange because a median filter should never generate overflows. You surely have a messed up code there, the kernel doesn't make much sense especially the lots of extra work you're doing.</p> <p>In non linear filters I suggest you try implementing Min or Max filters first to see if they work. Here's a working code for Max Filter from <a href="http://cuvilib.com/" rel="nofollow">CUVI</a> Library for CUDA. Your Median kernel should be no different than this:</p> <pre><code>__global__ void median_8u_c3( unsigned char* out, unsigned int width, unsigned int widthStep, unsigned int height){ int xIndex = blockIdx.x*BLOCK_SIZE + threadIdx.x; int yIndex = blockIdx.y*BLOCK_SIZE + threadIdx.y; int tid = yIndex * widthStep + (3*xIndex); if(xIndex&gt;=width|| yIndex&gt;=height) return; int limitX = anchorX + fHeight - 1; int limitY = anchorY + fWidth - 1; unsigned char MAX_R = 0 , MAX_G = 0, MAX_B = 0; // Instead of Max filter code in the for loops below, you can have median code for(Cuvi32s i=anchorX ; i&lt;= limitX; i++) for(Cuvi32s j=anchorY ; j&lt;= limitY; j++) { MAX_R = (tex2D(tex8,3*(xIndex + i) , yIndex + j) &gt; MAX_R) ? tex2D(tex8,3*(xIndex + i) , yIndex + j) : MAX_R; MAX_G = (tex2D(tex8,3*(xIndex + i)+1, yIndex + j) &gt; MAX_G) ? tex2D(tex8,3*(xIndex + i)+1, yIndex + j) : MAX_G; MAX_B = (tex2D(tex8,3*(xIndex + i)+2, yIndex + j) &gt; MAX_B) ? tex2D(tex8,3*(xIndex + i)+2, yIndex + j) : MAX_B; } out[tid] = MAX_R; out[tid + 1] = MAX_G; out[tid + 2] = MAX_B; } </code></pre> <p>Note: I'm using input from Textures.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload