10-07-2014 09:46 AM
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
10-07-2014 11:12 AM
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
10-08-2014 07:50 AM
@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
10-08-2014 08:05 AM
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
10-08-2014 12:13 PM
@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
10-08-2014 04:00 PM
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