Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any Temporal Median filter vi available or how to implement that in LabView

Hi All,

 

I am looking  for a "Temporal Median filter" vi or example, I have a case in which I require to do Temporal Median filtering to reduce the noise(spots) , I previously used Nth order filter vi but I require to do a Temporal median filter on atleast 5 frame of data. did any one knows if there is any such vi or example available, if not can anyone help me out on how to implement that in LabView.

 

Thanks,

AG

0 Kudos
Message 1 of 6
(5,043 Views)

I think you are going to have to build your own.  Here are the steps I would use:

 

Create a 3D buffer array to hold five images in array format.  The images in the buffer will be replaced on a rotating basis.

 

Convert the image to an array.  Replace the oldest image in the buffer.  Loop through the X and Y coordinates and calculate the median of each stack of 5 pixels.  Convert this array back in to an image.

 

I wouldn't expect to be able to do this live unless you have a slow frame rate.  It is going to take a while to do all the median calculations every frame.

 

You can experiment with the order of the indices to see what is most efficient.  I would think being able to autoindex the X and Y coordinates would be the most efficient, but I am sometimes wrong.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 6
(5,035 Views)

@BruceAmmons wrote:

I think you are going to have to build your own.  Here are the steps I would use:

 

Create a 3D buffer array to hold five images in array format.  The images in the buffer will be replaced on a rotating basis.

 

Convert the image to an array.  Replace the oldest image in the buffer.  Loop through the X and Y coordinates and calculate the median of each stack of 5 pixels.  Convert this array back in to an image.

 

I wouldn't expect to be able to do this live unless you have a slow frame rate.  It is going to take a while to do all the median calculations every frame.

 

You can experiment with the order of the indices to see what is most efficient.  I would think being able to autoindex the X and Y coordinates would be the most efficient, but I am sometimes wrong.

 

Bruce


Hi Bruce,

 

Thanks a lot , 

 

I didnt understand as in how to create the 3d buffer and replace on a rotating basis? how to know the the oldest image which is to be replaced?

 

Thanks,

 

AG

0 Kudos
Message 3 of 6
(5,018 Views)

Hello,

 

if I am not mistaken, Mr. Ammons was reffering to a ring/circular buffer. A simple way to implement this would be something like:

 

// Initialization

 

BufferSize = 5

i = 0

 

// Fill buffer

 

Function FillBuffer {

  if(i > (BufferSize-1)) {

    set i to 0

  }

  ImageBuffer at index i equals to NewImage;

  increment i by 1

}

 

 

In this way, the oldest image gets replaced with every new incoming image.

 

Best regards,

K

 


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 4 of 6
(5,014 Views)

@Klemen wrote:

Hello,

 

if I am not mistaken, Mr. Ammons was reffering to a ring/circular buffer. A simple way to implement this would be something like:

 

// Initialization

 

BufferSize = 5

i = 0

 

// Fill buffer

 

Function FillBuffer {

  if(i > (BufferSize-1)) {

    set i to 0

  }

  ImageBuffer at index i equals to NewImage;

  increment i by 1

}

 

 

In this way, the oldest image gets replaced with every new incoming image.

 

Best regards,

K

 


Thanks, I got the 3d array part, but how to now extract the data from that 3d array and do the median filtering , can you give me an example or something.

I wired the 3d array to an index array whose output gives me an 2d array but I am unable to figure out how to proceed further.

 

thanks,

 

AG

0 Kudos
Message 5 of 6
(5,010 Views)

You have three indices for the array, X Y Z.  X and Y are image dimensions, and Z is the number of images (5).  You use the Z dimension when you replace the oldest image.

 

Two nested loops that loop (size X) and (size Y).  Don't autoindex your array, and use the loop indices to index the array.

 

If you put them in the right order, you can just do two nested loops with autoindexing.  I can never remember what order that needs to be.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 6 of 6
(4,998 Views)