Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Nonlinear sampling

Hello

 

I'm using PCIe-1433, and I acquire 8000x1000 sized image.

After I acquire image, I need to resample the image to make 2000x1000 pixel image.

But, the sampling pixels are not linear, for example sinusoidal sampling pixels.

 

Here, I attached my test program.

The original image shows 8000x1000 acquired iimage, and Resampled image is also shown.

The sampling pixel is shown in chart (not linear).

 

I use the "IMAQ ImageToArray" function and then resample pixels. Then, use "IMAQ ArrayToImage".

I think this functino is inefficient.

 

Someone know IMAQ function for this kind nonlinear sampling?

 

Thanks, Any comment will be welcomed.

 

Mr. Fah.

0 Kudos
Message 1 of 6
(3,598 Views)

Apart from the extra memory usage, ImageToArray and ArrayToImage are not inefficient.  The main reason your program is slow appears to be that you use Delete From Array to sample your new image - if you change that to Index Array, it speeds up by ~100x!!

0 Kudos
Message 2 of 6
(3,583 Views)

Hi GregS

 

Thanks GregS. I just fixed it.

It is really faster than before. Thanks again.

 

But, I'm still finding some faster function for nonlinear sampling IMAQ function.

The function "ImageToArray" take about 12msec for 8000x1000 images.

 

Anybody know have any comment for faster nonlinear sampling?

 

Thanks

0 Kudos
Message 3 of 6
(3,561 Views)

You might want to experiment with the Calibration functions. You could define some custom points to pass in to "IMAQ Learn Micro Plane" to define a custom calibration template.

 

Another option you could try, since you seem to know the mapping that you want to use, is to take all of your measurements on the uncorrected image, then map the uncalibrated coordinates into your calibrated space. This will work for point measurements, but not area or distance measurements. I could offer a better example if I knew more about your application.

 

Kevin C.

0 Kudos
Message 4 of 6
(3,553 Views)

This code does the resampling on the image directly without converting to an array, and is about 5x faster (for me).  It simply extracts the appropriate columns from the original image, and puts them into sequential columns of the new image.

 

NonlinearResampling_BD.png

 

0 Kudos
Message 5 of 6
(3,550 Views)

Thank you all guys

 

Dear GregS

I tried your code, but is is little slower than that using "index array" for large image size.

Thank you.

 

 

Dear Kevin C.

Yes, I tried the calibration function with calibration coordinates.

But, I couldn't finish the coding.

If you can show me some example, it is very helpful.

 

I acquire image from frame grabber, I need to resample to smaller image size.

But, the sampling frequency is not uniform, as mentioned above.

Yes, I know the mapping positon.

My application is scanning microscope, one sanner is scanning in a sinusoidal waveform.

So, I want to resample to make the sinusoidal waveform to linear waveform.

 

Thanks in advance.

0 Kudos
Message 6 of 6
(3,523 Views)