12-16-2023 02:12 AM
Hello guys, i'm making pattern matching Vi for my project.
my Vi's goal is get images through GigE camera, use pattern matching and calculate matches distance with matches coordinate.
everything is fine but, matches coordinate keep shaking even though camera and target is in fixed state.
i think if camera and target is fixed, matches coordinate also keep steady until target moves. but Unfortunately not.
this problem can be solved? i attached cropped image of my Vi.
12-16-2023 06:40 AM
Hi ticsiz,
Some remarks on your code:
- You are using the same image reference for your acquisition and processing loops, which may cause race conditions. You should initially create another image "processing" and each time before sending the image to the other loop, copy from acquisition image to processing image with function "IMAQ Copy". Even with that you will have to ensure the acquisition loop is not faster than processing loop. Another solution is to create a new IMAQ image on-the-fly with a unique name for each acquisition iteration, but be careful with memory overuse…
- You may want to use "IMAQ ExtractSingleColorPlane" with parameter "Luminance", "Value" or "Intensity" instead of an "IMAQ Cast Image", you may have a resulting grayscale image with better contrasts.
For us to help you further, you will have to be more specific when you say "matches coordinate keep shaking".
Are the coordinates themselves not stable ? Are they just oscillating around a certain value, or are all the matches occasionally not detected ?
Is the resulting image flickering / glitching (may indicate a race condition with image references) ?
Then, you will have to post your VI (max version LV2021, otherwise on your VI, click menu File->Save For Previous->21.0, then attach the created file).
You should also post some of your resulting images with the marked matches, at least one where it behaves correctly, and one where it does less well, so we can see the different outcomes of your algorithm.
Regards,
Raphaël.
12-17-2023 01:38 AM
Thank you for advice and help!
I think coordinates themselves not stable rather than oscillate.
from the picture dx, dy is distance calculated by subtract each matches coordinate x, y.
i can accept unstable state at several initial loop iteration, but matches coordinate keep unstable.
i attached my vi for detailed help.
12-17-2023 03:26 AM
Can you please share raw image instead screen capture?
12-17-2023 03:42 AM
Sure, resolution of raw image is not that good as my webcam is so cheap.
however, this problem is still in my another GigE camera with high resolution image.
i attached raw image and template image cropped from raw image.
Thanks,
12-17-2023 04:19 AM - edited 12-17-2023 04:35 AM
If image quality is so poor like this you cannot get precise results. Problem is not the pattern matching funtion but the poor image data. There is not enough feature on the image to use pattern matching. Try to use filtering, threshold and particle filter to get center of mass of the particles. And you must increase sharpness of the image. Try to adjust focus properly. If your light is not collimated, get it further from the particles or use telecentric light.