I have a microscope system that can image a large sample by moving and imaging it in x and y directions and then create a mosaic image. The process is like this: take one image --> move one step --> check if moving is completed --> take another image --> move one step -->......
I am using IMAQ Create --> IMAQ Array to Image --> IMAQ Write File 2 --> IMAQ Dispose to save the images in a tiff format (attached a screenshot of the code).
The problem is, if I save the images, they will give me some artifacts that look like a " motion blur", as if the sample is not moving as a unit from top to bottom which is not possible, and are random in time and space (attached one example of the normal and the "motion blur" images cropped from the same position of two images took with different delay time). However, if I am using live mode (without saving the images), the images are quite smooth. I tried to add delay when saving images; it helped when I increased the delay time to 1 second, but that was too slow and wouldn't solve it throughly. The artifacts still happened.
I am pretty sure the xy movement has been finished before each image acquisition, but I am not sure how to check if the acquistion has been finished before the movement. Could it be the speed of writing file that causes this issue? If so, is there any way to solve it without sacrificing the speed?
Other information that may needed:
Software: Labview 2014 Windows 64bit
Acquistion card: NI PCI 6255
Camera: Hamamatsu ORCA Flash 4.0
Image size: 2048*2048, 16bit (about 8MB per image)
Thanks for the reply. I found a vi called "IMAQ Copy Overlay" and added it to my previous code (attached the revised code). I am not sure if it is what you were refering to, but it doesn't change the artifacts. Am I using the vi in the wrong way?
You haven't provided full code of how the acuisition is happening.
-IMAQ Create creates reference to the image with String you give Image name and it should be unique.
-Now i am guessing, during writing the image to disk, acquistion part is overwriting that image and hence you are seeing the artifacts.
-To avoid that, you have to use proper User buffer(IMAQ Create) mehanism.
-One way is to use IMAQ Copy along with new IMAQ Create at the file saving part.
-The better approach would be to have enough user buffers or unique buffers at the acquisition part to avoid overwriting and dispose when writing is done.
Thanks for the reply. I attaced the snippet of the full sub vi here. This sub vi is put in a while loop. I use the loop index as part of the image name so it should be unique for each image since I only take one image at one loop. I have the same guess with you -- the overwriting might happen because of the low speed of hard disk writing compared to image acquisition. I added a IMAQ Copy Overlay vi and diospose vi as you can see in the snippet. Still it is not working. I will check into the buffer thing to see if it will work. Thanks!
It must be the memory overwrite problem.
Since you didn't show us the code, I assumed you use IMAQ to acquire the image. Why not ?
So I suggested IMAQ Copy. Not Copy Overlay!
From the diagram image, we still don't know how you acquire the image.
I could only assume that the buffer is alocated by the external code.
How fast is the acquisition rate? How fast your camera can produce an image?
Forget the Copy Overlay.
Insert "Always Copy" to the 2D array.
The time delay could be a problem.
Try a few different value: 0, 50, 100, 300, 500.
Sorry I thought the acquisition part wasn't important. I am not using IMAQ to acquire the image, but VIs from Hamamatsu video capture library. They have a collection of VIs designed to control and aquire images from the camera. It is easier and more straightforward for me to use. The only thing is to figure out how to save the images to disk correctly.
For the buffer allocation, I couldn't see their VI code, but based on their instruction, one of the VIs called "Prepare capture" will create a buffer of maybe 3 frames, and then "Get Frame" VI will retrieve the frame in the buffer at the specified frame index.
The camera can perform at up to 100 frame/s, which is 800MB/s, but right now I can only run at 2 frames/s because of the artifacts.
I tried the "Always Copy", inserting it between the 2D image array and the "IMAQ ArraytoImage", and also tried different delay time, however, the issue still exists.
I can also try IMAQ acquisition if necessary, but I am not sure if there is an easy way to communicate with the camera.
Writing an image will certainly not create blur. Your image is blurred to begin with, and you have to track down the reason for this. Most likely, as you mention, this is because the stage is still moving when you instruct your camera to take a snapshot. This isn't surprising if you indeed try to build a mosaic image where each "step" of your stage is about the size of a full field of view. I wouldn't be surprised that the stage takes a few 10 ms to settle down. This being said, it is also possible that your code is written in such a way that there is no guarantee of when the stage motion takes place with respect to the image snapshot (think parallelism). It might very well happen that in case you don't have a write function in the code, things are well (but somewhat randomly) synch'ed, but not anymore when you add that function. It is hard to tell without seeing your code for motion control (actually the whole combo motion + acquisition).
As a note, you don't need to create and dispose the image over and over again. Just create it at the beginning and dispose it at the end.
Post you complete code and then someone may be able to help.
@X. Taking image when camera is moving shouldn't be a problem as long as the exposure time is short. In one of our motion-vision project, the camera never stop when taking picture, not even slow down.