I have written a small code that works kind of like a 2D look up table. There is a 2D array of size 255*255 which holds the values. I have 2 input array of size 150*150(each is a 2D)- Array 1 and Array 2. The value of the elements are in the range of 0 - 255. I am attaching my implementation of it. Is there a better way to implement it?
The best optimizations are algorithmic.
It all depends on the exact situation. In your benchmark, you can precalculate the convolution matrix. That speeds up to 20% of the original. It depends on the situation if this is a fair comparison, the precalculation might be dynamic. But if the input arrays are small, it will be a slow down...
And obviously, you can do the subtract outside the loop.
If you make it a subVI, turn debugging off. Might even try if inlining helps. There are downsides to both (no debugging, no profiling).
I can see what you are doing, but the fact that you are asking the question makes me want to ask, "What do you want to do"? You have a square array of 255 (not 256!) entries, all 1.000, and two other (smaller) arrays, also holding Dbls. What do the two Input Arrays represent, what does the LUT Array represent, and what kind of processing do you want to do with these three arrays?
Does this have anything to do with Imaging? Might there be optimized functions in one of the LabVIEW Modules or Toolkits that "do what you are trying to do"?
Isn't this just where Variant Attributes can be used? With the updates in the IPE structure you can probably also get some more efficient read/write operations on variants too.
Hi Bob Schor,
Thank you for the reply. You are right Sir, I am working with images. Let me explain what I am doing. I need to find whether a pixel in an image is defect or not depending on its color information(saturation and intensity). I first read a few images and select the good pixels, then read their saturation and intensity values. Lets say the saturation and intensity values for a pixel is 100,57. I put a 1 in the [100,57] location of the 2D look up table that I have created. My 2D look up table will have 256 rows and 256 column(my mistake i had put 255 in the example program). So the LUT will contain either 1 or 0.
The two smaller 2D array represent the saturation and intensity values of a test image. They will contain values in the range of 0-255. I index out the saturation and intensity at each pixel and compare its value with the look up table in a 3X3 window.
I went through the Vision Development module- there is a vi called IMAQ ColorUserLookup, however, it applies a LUT on each plane individually. My requirement is to perform LUT based on two planes. I hope I have explained it better now. Do let me know if there are any more questions.