03-25-2010 01:19 AM
Hello
I am working on a system using 2 line scan camers to image a continous printing process.
I need to be able to seperate Documents and display them, there is no gap between them, and the system run fairly fast. Due to document length variation I have to use VHA (which leaves a small gap) or create a scrolling image from smaller segements and look for a repeating mark that occurs at the start of each document.
The second is my preference, and I have it working almost.
I run into speed issues which casuse the loss of segments.
The inital idea was to
1. build an image big enough to accomidate max document length
2. Shift the image up in 500 line increments and insert new segment at bottom of image
3. Look for predefined mark at top of image and at bottom of image
4. Extract image from mark to mark
5. Display image for machine operator.
found that anything more than 3-4 segments and my frame rate drops and I start missing segments of the image
can anyone sujest a more effiecent way to do this
Wolud 4 calls to insert small images into a larger image take less resources than 1 call to shift an image
03-25-2010 04:49 AM
03-26-2010 11:44 AM
I did an application like this once. I had to locate objects within a continuous scanning image. I learned a few things:
Acquire from the line scan camera in large blocks. If you only acquire a few lines at a time, a lot more CPU time is used.
Here is a rough algorithm that might help:
Create a blank image large enough to fit one full page plus a couple of sections. Fill it with black.
Acquire a section and use IMAQ ImageToImage to paste it into the image at the appropriate spot.
Search just the last two sections for the mark that indicates a new page, probably using pattern matching. If found:
Extract image from top to mark using IMAQ Extract. This is a document image. Send it off to be processed or viewed or whatever. Probably won't have enough time to save it.
Extract image from mark down using IMAQ Extract. Fill image with black. Paste the image that was just extracted at the top of the image.
Loop and acquire another section from the camera.
This algorithm works pretty well because the only time you are moving images around is at the end of each document. The rest of the time you are just pasting strips at the right place and searching a small area for the mark.
Using Extract and ImageToImage to cut and paste is much, much faster than using IMAQ Shift if I remember correctly.
Bruce
03-30-2010 11:22 PM
Thank you Bruce, your method was quicker, but I still start loosing frames when I combine both cameras, So I think I will beef up the PC I'm using.
But before I was drop to about 2/3 the actual frame rate now I'm am loosing only 1 or 2 FPS (41 with single camera and stable operation to 39 with both and intermittant problems.)
03-31-2010 12:27 AM
There are ways to improve the speed of the algorithm. The one I posted was just a rough outline. For example, if you have a range for the page length, you just need to search within that range. Perhaps filling past the max length, then do a single search in the appropriate range. Limiting your search area and frequency will greatly improve efficiency. You would need to search the entire length for the first marker, but after that they would always be in a small area, I assume.
Quad processors also can be useful in cases like these. It never hurts to have a high powered PC, and quads are cheap.
Please tell me you are using buffered acquisition so you can't lose any segments unless the buffer totally fills up. You need a little cushion when you are manipulating the image after you find the marker, since that takes a little time. You should be using a LL Loop and retrieving by frame number.
If you post your code, we might be able to suggest other improvements.
Bruce