Natiq Posted March 19 Report Posted March 19 Hi everyone, I am trying to watch a process and record video of it sometimes. So I need a button that starts recording and then stops it. And again when I click start it should create a new file with new name. I have tried it in different ways, putting create file inside case structure and outside of structure etc. But I am either getting only 1 video(which overwrites), or just pictures. Lastly I have tried with shift register and got this error: Error -1074395995 occurred at IMAQ WriteBMPFile I would appriciate if you could help me. Basler Camera labview.vi Quote
Neil Pate Posted March 21 Report Posted March 21 You are likely getting only 1 video because you are re-using the same filename. There are a bunch of ways to solve your problem. For me the easiest would be to look to using an Event Structure as this stops you from needing to poll the button all the time. Do a bit of googling to see how the Event Structure works. (tip, you will configure an event that responds to the save button click, and in that event you will prompt for a new filename (or autogenerate with timestamp) and then open a reference to this new file). 1 Quote
Natiq Posted March 21 Author Report Posted March 21 Hi Neil, I have tried with event structure as well; what I did was put create file and path into the event structure. In this case, should close avi be outside while loop? If close vi is inside event structure I am getting an infinite number of videos. If I put close vi outside of the loop, what should I connect to the line that goes to close vi, in false case or event? Where should I place path, create, write and close vis? Quote
Neil Pate Posted March 21 Report Posted March 21 Close should be inside the loop. Before you start a new file you would close the old one. The file reference you get from opening the file would be put onto a shift register so that you can access it in the next iteration of the while loop. Can you share your code? 1 Quote
Natiq Posted March 21 Author Report Posted March 21 3 hours ago, Neil Pate said: You are likely getting only 1 video because you are re-using the same filename. There are a bunch of ways to solve your problem. For me the easiest would be to look to using an Event Structure as this stops you from needing to poll the button all the time. Do a bit of googling to see how the Event Structure works. (tip, you will configure an event that responds to the save button click, and in that event you will prompt for a new filename (or autogenerate with timestamp) and then open a reference to this new file). 31 minutes ago, Neil Pate said: Close should be inside the loop. Before you start a new file you would close the old one. The file reference you get from opening the file would be put onto a shift register so that you can access it in the next iteration of the while loop. Can you share your code? Should the path file be outside of the loop? When I new file name created I should connect it to right side shift register? Basler Camera labview (1).vi Quote
Natiq Posted March 21 Author Report Posted March 21 Yes, I will be able to go to lab and edit code next week. I dont exactly know how to use shift register in this situation, so I will connect the reference file (do I create it inside or outside of while loop? or should I put file path outside and create file inside loop?) to shift register, but I should connect it to close vi as well at the same time? Thank you for your time Quote
ensegre Posted March 21 Report Posted March 21 A bit sad to have to say this nowadays that most of the traffic on this forum is about leaked videos, money rituals and human sacrifices, but isn't this the part where someone starts to repost links to basic LabVIEW training resources on the NI site? 1 Quote
Neil Pate Posted March 21 Report Posted March 21 @Natiq this (non-functional example) should be enough to get you started. The weird arrow thing on the boundaries of the while loop is a shift register. The event structure can also be configured to have a timeout case where you can then perform other stuff, like reading your image and writing it to the reference on the the shift register. There is heaps of information out there (YouTube for example), a bit of searching will lead to some more details. 1 Quote
Natiq Posted March 26 Author Report Posted March 26 I hope I understood your point right, and made a vi based on that. But I am getting the first error even and if I press continue I get 2nd error. I checked with my previous codes where I was getting continous videos it is working again so I suppose *file not found* is not the reason. But when I use shift register I get an error. I would appriciate if you could help me. Note: I watched videos about event structure and Shift registers. But still can not solve this issue. Basler Camera labview trial 2.vi Quote
Neil Pate Posted March 26 Report Posted March 26 ok, a couple of things to address. The IMAQ close error probably happens because there is no open session the first time. It would probably be fine just to silence that error by clearing it. The first error is a bit surprising as you dont have a timeout value wired into the case-structure so I would have expect that portion of the code to never execute. Another slightly strange thing is the name of the VI in the error message does not match the name of the VI in your code (IMAQ Write BMP vs IMAQ AVI 2 Write Frame). Try wire a value into the timeout (like 1000 ms or something like that) and move your acquisition code into that event., I do not currently have the vision toolkit installed so cannot test your code. Quote
Natiq Posted March 26 Author Report Posted March 26 9 minutes ago, Neil Pate said: move your acquisition code into that event. If I do that, I will see what is in camera only that event right? But I want to be able to see camera always and record it sometimes. Quote
Natiq Posted March 26 Author Report Posted March 26 30 minutes ago, Neil Pate said: Try wire a value into the timeout (like 1000 ms or something like that) and move your acquisition code into that event. I did both of them but I get again the IMAQ Write BMP error. Quote
Neil Pate Posted March 26 Report Posted March 26 Put the acquire image and save to file in the event structure timeout case, but only write to file conditionally (i.e. if the user has clicked the button) 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.