EricLarsen Posted August 6, 2013 Report Share Posted August 6, 2013 I've got an application that is processing some fairly large images. They are typically 4800x1280 pixels, 32 bit images. As part of the processing, I resample the image to adjust the aspect ratio. The IMAQ Resample (bi-linear option) function is fast at this, typically around 50-60 ms on my development computer. Unfortunately, this application is going to be distributed to multiple customer sites, and the IMAQ Resample is part of the Vision Development Module, which requires a run-time license for each client computer. That's not acceptable to our customer, especially since resampling is the only Vision Development function I use, the rest are custom fuctions. To get around this I wrote my own solution in G. It uses the Resample Waveform.vi function to do a row-by-row, then colum-by-column resample. It works, but it's fairly slow, around 3-4 seconds (sometimes up to 10s, depending on what mood my computer is in). Not bad, but I'd like to do better. Admittedly I haven't tried to optimize it yet, it's not a high priority. So before I dive into this, has anybody got some code or link to an efficent algorithm they would be willing to share that can do this? Quote Link to comment
GregSands Posted August 7, 2013 Report Share Posted August 7, 2013 Have you looked at using the built-in Interpolate 2D routine from the Mathematics/Interpolation palette? Dive into that and rework the core to hard-code as much as possible (if your parameters are all constant). What is the resulting image size? Quote Link to comment
EricLarsen Posted August 8, 2013 Author Report Share Posted August 8, 2013 I busted out my 30 year old copy of Numerical Recipes and programmed up a quick 2D bilinear routine that works pretty well. I got the resample time down to ~300 ms. Still not as good as the IMAQ function, but good enough. I had looked at the built in 2D interpolate routine in the past, and for reasons I can't remember I'd rejected it. I took another look at it today and didn't get very good results (~15s). It does some data tweaking and massaging that slows it down. But the core interpolation code looks exactly like the Numerical Recipes code, so I doubt it can do much better than mine. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.