From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-28-2021 02:01 PM
Hi Vision cracks 😉
It would be great if you could help me!
I've worked with the NI Vision Development Toolkit for a long time. So far I have only used the build in filter functions.
I now have a special problem and I still have no idea how I could solve it, or whether it is even possible with vision.
I have an initial image from which I want to create a new filtered image.
The results of the calculations with the center pixel on image A should be written into the pixel at the same position in the new image.
Pixel by Pixel Processing:
The calculation should run pixel by pixel like a sliding window, calculate all pixels in the image and create a new image from the results.
Is that possible?
Best
Peter
Solved! Go to Solution.
02-28-2021 03:03 PM
Sure it is possible. Have you started it?
Think of a set of loops where you act on the original array pixel by pixel, and put the results in a new array.
03-01-2021 03:29 AM
NIVision does support a custom kernel operation, although IIRC it's hidden and hard to use. Probably documented here: Convolution Kernels - NI Vision 2019 for LabVIEW Help
A kernel of all 1's, divided by the number of 1's should give the average.
I'm pretty sure running two build-in kernel operations and then dividing the results will be faster than any DIY solution. But maybe not... Less work for sure.
DIY (performant) kernel operations are much trickier than you'd think.
03-01-2021 05:13 AM
Thanks for your answer.
That it works with array operations is clear.
But I wanted to avoid that. However, this is time-consuming and is not as precise as when I do it directly with Vison. Do you still have an idea how to solve it with vision?
Best
Peter
03-01-2021 05:40 AM
Thanks for your help.
I know the document about convolution kernels. I use them very often.
It is also very easy to use an average filter.
The problem here, however, is to average two different areas around the center pixel in the image, to divide the 2 mean values and to write the result in a new image and that in one work step, from one pixel to the next.
Maybe you have an example how to do it?
Best
Peter
03-01-2021 09:10 AM
Calculate the 2 kernels in 2 images. Then use the IMAQ Divide VI to divide the two.
Of course care should be taken to use the correct data types.
I can't make an example, I don't have IMAQ installed at the moment.
03-01-2021 09:26 AM - edited 03-01-2021 09:29 AM
Something like this should work. Be careful with divisions by zero with SGL images, the image indicator can slow down LabVIEW.
*Edit: reading your reply you want to create a new image so a new buffer should be connected to the Image DST input for IMAQ Divide vi.
03-05-2021 01:00 AM
Thanks a lot. I will try it out!
03-08-2021 05:55 AM
Hi Ramon,
thanks a lot.
It works good and its fast!
Peter
03-08-2021 06:09 AM
Thank you all for your help!
I learned a lot. Kernels are very powerful and versatile.
Creating a convoltion kernel for averaging is easy!
But what about the maximum value?
If I want to calculate a maximum value from the 9 pixels and the 16 surrounding pixels.
Is that possible with vision?
Pixel by Pixel Processing: