Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

convolution speed

I am implementing an image analysis algorithm that will involve many convolutions and other mathmatical operations on the images.  A number of these operations cannot be done using IMAQ vi's (i.e. taking the square root of pixel values, etc.).  Additionally, speed in computation is very important, as we want to implement this program for real time image analysis.  A few questions:

1)  Which is faster: IMAQ convolve or the convolution functions in the full distribution of LV 8.2?

2)  In general, if an IMAQ vi is available for a computation on an image, is it faster than the LV equivalent on a matrix?

3)  What is the the relative speed penalty for switching back and forth between image and matrix representations of the data multiple times?  If all the operations cannot be performed using IMAQ functions, is it simply better to transform the initial image to a matrix and perform all analysis on the matrix before transforming back to an image?

Thanks in advance.
0 Kudos
Message 1 of 4
(3,651 Views)
These can be difficult questions.  It is hard to compare approaches without trying both and doing a direct comparison.
 
I have found that IMAQ functions are usually much faster than equivalent functions on arrays.  IMAQ also handles the edge conditions very well, which are a pain in arrays (like convolution).
 
Therefore, I would say for 1 and 2 IMAQ wins.
 
Switching back and forth can be slow.  It will depend on your algorithms which way is faster.
 
An interesting observation:  Some functions that are not directly available in IMAQ can usually be done in a short sequence of operations.  For example, if you wanted to do a filter that replaced each pixel with the sqrt of the sum of the squares of the surrounding pixels, you could do the following sequence:
 
1. Use a lookup table to replace each pixel with its squared value.  You might need to use a larger image representation for the results.
 
2. Use a convolution to sum the pixels in a 3x3 grid.
 
3. Use another lookup table to replace each pixel with the square root of its value.
 
This would probably work much faster than switching to a matrix and trying to do the sequence of operations on the matrix.
 
Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 4
(3,648 Views)
I thank you for your useful replies.  One question on lookup table-based operations:  I understand how you can create and implement a lookup table for 8 and 16 bit images (all intensities map to a specific fixed number of values).  But how does the loopup table work for floating point (single) image types?  For example, if I wanted to create lookup table that replaces pixels with their square root, how would I do this for a floating point image?
0 Kudos
Message 3 of 4
(3,626 Views)

I have never tried a lookup table on floating point images.  I don't even think they are available.

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 4
(3,607 Views)