Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving images sequentially to hard disk with imaq-1428 card

yangb182,
 
I decided to write you an example VI to help you out with your work.
 
I did not have the time to test this VI.  Although, it should work.
 
I hope this helps,
 
Lorne Hengst
Application Engineer
National Instruments
0 Kudos
Message 11 of 20
(2,242 Views)
thanks a lot for your help Mr Lorne.

I won't have the computer with the Imaq card during these chrismas holidays, so I can't test it.

But i'd like to look at it.

I f I have Labview and the IMAQ driver, can I test it? I mean, just look at the example so that I can try to understand it.

I'll tell you more about the result later.

Thank you
0 Kudos
Message 12 of 20
(2,234 Views)

yangb182,

"If I have Labview and the IMAQ driver, can I test it? I mean, just look at the example so that I can try to understand it."

Yes.

Lorne Hengst
Application Engineer
National Instruments

0 Kudos
Message 13 of 20
(2,222 Views)
Hi,

I looked at your VI and I think I undestood the main things.
But I'd like to ask you some questions.

  • Regarding the object IMAQ configure LIST.VI, I don't see what is the buffer for?
    Will the image acquired be saved in this buffer first?
    You set the number of buffer at 1. Does it mean only 1 image can be saved in this buffer?



Also, the trigger signal won't come out from a camera. I buitl an electronic card so that it can send a signal. I connected this electonic card to the trigger input on my frame grabber. If the signal from the electronic card matches those specifications below, it should work shouldn't it?
http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/acb4bd7550c4374c86256bfb0067a4bd/$FILE/TTL%20Specification.gif
or
http://digital.ni.com/public.nsf/websearch/ACB4BD7550C4374C86256BFB0067A4BD?OpenDocument


The video input on the frame grabber is connected to something like a TV screen.
Actually, I have a X-ray tube, and I can visualize the X-ray phtographies on the screen tv when I press on a button. I use the IMAQ to visualize them on the computer screen and save them into my hard disk.

to remind you my projetc:
I will visualize the X-ray photographies on the TV screen every 1 minute.

a signal comes into the trigger input, there is a 10 seconde waiting.
then the image is aquired.
then it is saved as 0.png.


another X-ray photography is seen on the tv screen
a signal comes into the trigger input, there is a 10 seconde waiting.
then the image is aquired.
then it is saved as 1.png.

another X-ray photography is seen on the tv screen
a signal comes into the trigger input, there is a 10 seconde waiting.
then the image is aquired.
then it is saved as 2.png.

and so on until 100.png


Thanks a lot for your help
Sincerely
0 Kudos
Message 14 of 20
(2,194 Views)
yangb182,
 
"Regarding the object IMAQ configure LIST.VI, I don't see what is the buffer for?"
This VI links the IMAQ Image objects you created in the VI to image acquisition so that the images can be dumped directly to memory via DMA from your frame grabber card.
 
"Will the image acquired be saved in this buffer first?"
Yes.
 
"You set the number of buffer at 1. Does it mean only 1 image can be saved in this buffer?"
I set the buffer to 1 because your image acquisition is very slow.  This means that only one image can be saved to this buffer.  You can copy this buffer to file or to other IMAQ Image objects if you want too.
 
"a signal comes into the trigger input, there is a 10 seconde waiting."
Implementing a 10 second delay is a little bit difficult.  There are two ways to do this that I am aware of...
1.  Use another NI board (preferrably a Counter board or a M Series DAQ board) to read the trigger signal and then output a new pulse 10 seconds after recieving the trigger.  To do this you would send the trigger signal to the board with the counter and then have the board with the counter send a new trigger signal (same as the original but delayed by 10 seconds) to the PCI-1405.
 
2.  Look at the attached image.  Use "IMAQ Occurance Config2.vi" to create an occurance at each rising edge of the trigger signal and then have your program wait for the occurance during each acquisition loop and then wait an additional 10 seconds before grabbing the next available image.
 
I am not exactly sure how your tv is sending images to your frame grabber, but I think method 2 might be the way to go with your setup.
 
I hope this helps,
Lorne Hengst
Application Engineer
National Instruments
0 Kudos
Message 15 of 20
(2,186 Views)
Hi,

I tried the TriggertoFile.VI with my IMAQ 1405.
It nearly works.
When a signal comes into the trigger input, there is an acquisition.

But it looks like the acquisition is continous.
Indeed, there was just a signal which comes into trigger input, and then, I had at least 100 pictures saved in my computer. I have actually, image0.png, image1.png, image2.png an so on...
If I didn't stop the program, I looked like I would still have pictures which are still being saved in my computer.


I think it's because of the while loop, but I don't see how to change it.


I also thought it could be because of the "imaq configure list", since it was on "continous". I changed to "one-shot" but I still have the same problem.

Or maybe my signal which comes into the trigger input is not good???
I looked at it and when it sent to the trigger input, its value is around 0 V. and when it is not send it is around 3 V. So in "imaq configure Trigger2.VI", I changed the trigger polarity to falling edge.

Can you help me, please?
0 Kudos
Message 16 of 20
(2,163 Views)
Hi,

I tried the TriggertoFile.VI with my IMAQ 1405.
It nearly works.
When a signal comes into the trigger input, there is an acquisition.

But it looks like the acquisition is continous.
Indeed, there was just a signal which comes into trigger input, and then, I had at least 100 pictures saved in my computer. I have actually, image0.png, image1.png, image2.png an so on...
If I didn't stop the program, I looked like I would still have pictures which are still being saved in my computer.


I think it's because of the while loop, but I don't see how to change it.


I also thought it could be because of the "imaq configure list", since it was on "continous". I changed to "one-shot" but I still have the same problem.

Or maybe my signal which comes into the trigger input is not good???
I looked at it and when it sent to the trigger input, its value is around 0 V. and when it is not send it is around 3 V. So in "imaq configure Trigger2.VI", I changed the trigger polarity to falling edge.

Can you help me, please?
0 Kudos
Message 17 of 20
(2,163 Views)
Hi,

Sorry for my 2 identical messages, I had some troubles with the internet connection.

Right now, the delay I wanted previously is not really important.

I have some ideas about the problem in TriggertoFile.VI .
Can you tell me what you think about them?


To explain the problem:
Regarding the while loop, if there aren't any errors, then status is FALSE. And if I don't click on the stop button, then, after the "OR", there will be a FALSE.
But the while loop stops when there is a TRUE at the OR output.
As a result, the program remains in the while loop, that's why I have the same images which is saved several times to image0.png, image1.png, image2.png...
Is that correct?

1st solution
So, I was thinking about using a NOT after the status so that I have a TRUE when an image is saved. Then the program can exit the while loop and then goes to "IMAQ stop.vi", "IMAQ claso.vi", "IMAQ dispose".
But then, the program will stop running.
So, to make it go the beginning again, I was thinking about addind another while loop which will contain everything from "IMAQ ini.vi" to "simple error handler.vi".

2nd solution
I thought about another solution:
I can gather everyting from "IMAQ ini.vi" to "simple error handler.vi" in a sole while loop instead of just putting the "IMAQ extract putting.vi" and the functions which build the filepath.

But in both solutions, I have some doubts about the conditions to use to exit the loop.






0 Kudos
Message 18 of 20
(2,157 Views)

yangb182,

Actually, if you want your program to run a specfic number of times, use the iteration terminal (it is the blue "i" icon found inside the while loop).  Compare the value (using a greater than function) to the number of times you want the loop to run.  Use the resulting boolean to determine if the while loop should continue to run.  Attached is a picture of what I am talking about.

Lorne Hengst
Application Engineer
National Instruments

0 Kudos
Message 19 of 20
(2,146 Views)
Hi,

My program is finally working, adding another loop.
I don't know if it is really accurate but it's working.

thanks for your help, it was really useful.

0 Kudos
Message 20 of 20
(2,136 Views)