What is the best way to switch between multiple image buffers? AND How to synchronize saves?

Hello,
I'm trying to flip-flop between two buffers and wondering the best possible solution for this.  I'd like to acquire an image in one buffer, send that off to be processed, and then while that's being processed acquire a second image.  Right now I have a "Create IMAQ vi" in a for loop and have it creating 10 image locations.  I'm using a non-NI framegrabber (shame I know) which makes things a bit more difficult to replicate.  I have two while loops.  One while loop currently grabs images from the framegrabber and places in the 10 different locations.  The other while loop currently holds a case structure that does the processing.  I have created a local variable that holds all of the image locations and reads those to be processed.  I don't know if this is actually making things faster or if it's better to just make one image location.
I have two images attached.  One image is the Grab While loop.  Since I have an array of locations, I have to use a for loop and index each one out to my display. I then have a shift register to carry the image location info over to the next iteration of the while loop.
The second attachment is the bulk of the main while loop.  It shows what happens to the image while it's being fully processed in the left case structure.  I know it does not look like much but one of the cases (which is called by Boolean Image FFT) is a subVI that does most of the processing.  I believe that is what really slows it down because of how that program is written. 
The right case structure shows my saving mechanism.  I have two file paths. One to save the image and the other to save the processed image.  I have a sequence to make sure they save at the same time once it gets to that point. 
The problem though is the following:
In the grabwhileloop.png, you can see that I have a timing to see how fast the images are being acquired.  This value is approximately 60 fps (which is the rate of the Basler camera).  There is a similar set up in the main loop case structure. This processes very slowly and is approximately 1.04 fps.  Which would mean that the image I turn into an array in the left case structure in the main while loop image is more than likely different than the image I'm trying to save off in the right case structure since the grab is occurring at the same time.  I'd like to have the processed image to save alongside the image I am processing.
Sorry for the big bulk of text.  This code has come a long way as it is.  If you have any suggestions on making it faster or more efficient please feel free to chime in.
Thanks,
Rob
Attachments:
GrabWhileLoop.png ‏34 KB
MainWhileLoop.png ‏68 KB

Thanks for the comment.  I have looked into the producer/consumer architecture, but to be honest, I'm not quite sure how everything will work while doing that. I have seen the example codes, and I have thought about implementing (or at least attempting to) but I'm still unconvinced that it will run that much more efficiently.  There is other setup outside of the images that had to be done outside of either while loop. Also, I don't know where I would put both loops.
Last time, I attempted to put the grab while loop inside of the state machine.  Things got chopped because it took so long to go through the main while loop's "acquisition" state (which is really the processing state).  I needed both to simultaneously run.  The grab reset every time it went to the "grab" state which is not what I wanted.  The only way I can thing to have combatted this was to combine the grab and acquisition in the same state.  If that were to happen, I'd take out the for loop and grab one image at a time.  However, that would still probably make things even slower than they already are.
In terms of the doing something before an image is assigned in for loop, I don't need that pixel sum value to refresh too quickly.  As it is already, the main while loop is slow enough as it is, so I am more afraid that everything will run too slowly the more I do.  I know where the bottleneck is in my code, but I can't really see a way to "even out the flow".  Even if I moved to the other architecture, I feel it'd take the same amount of time that it does already.
From my debugging, the Image local variable in the main while loop seems to refresh as quickly as the grab while loop spits it out.  Granted once the main while loop finally completes, main images have gone by.  This is what has to be though because it just take up so much processing power to run through the main while loop state.
As a side note, does labview have an issue with acquiring images in real-time that you have heard of?  I ask because when I run the code, there is a solid white line that I'm supposed to see in my display.  Every time things either time out or something, the line moves which is not supposed to happen.  The line also moves every time I place my mouse cursor in the display or if I spin the mouse wheel to scroll.  If I don't do either of those things, it'll eventually move on its own.

Similar Messages

  • What is the best way to double buffer in this case and how to do it....

    currently I have
    public class Frame1 extends JFrame{
    //inside this class I call up circle class, rectangle class, etc.... to draw
    }I am making a "paint" program, and I have individual classes to handle the paint methods heres an example:
    abstract public class Shape {
        public Shape() {
        public abstract void draw(Graphics g, Color c, int x, int y, int width,int height);
    }and then....
    public class Circle extends Shape{
        public Circle() {
        public void draw(Graphics g, Color c, int oldx, int oldy, int newx, int newy) {
            g.setColor(c);
            g.drawOval(Math.min(oldx, newx), Math.min(oldy, newy), Math.abs(oldx - newx), Math.abs(oldy - newy));
    }There is also a Rectangle class, line class.... etc! So my question to you is the following... what is the best way to implement double buffer in the individual classes? And how to do it?? And also.... the drawings should be kept inside a jPanel.
    Any bit of help is much appreciated Thank you!!

    You don't need to do double-buffering. Swing
    components are double-buffered by default. Just make
    sure you override paintComponent() and not paint().
    And even if you had to, why would there be any
    difference in implementation for your classes whether
    they paint to on- or off-screen graphics?I need to override paintComponent()? what if I don't...
    I am using JBuilder2005 and they automate somethings for me. So thats how they did it when they created the application they did this....
    public class Frame1 extends JFrame{
    /*** all my code here***/
    public class Application1 {
        boolean packFrame = false;
         * Construct and show the application.
        public Application1() {
            Frame1 frame = new Frame1();
            // Validate frames that have preset sizes
            // Pack frames that have useful preferred size info, e.g. from their layout
            if (packFrame) {
                frame.pack();
            } else {
                frame.validate();
            // Center the window
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            Dimension frameSize = frame.getSize();
            if (frameSize.height > screenSize.height) {
                frameSize.height = screenSize.height;
            if (frameSize.width > screenSize.width) {
                frameSize.width = screenSize.width;
            frame.setLocation((screenSize.width - frameSize.width) / 2,
                              (screenSize.height - frameSize.height) / 2);
            frame.setVisible(true);
            try {
                jbInit();
            } catch (Exception ex) {
                ex.printStackTrace();
         * Application entry point.
         * @param args String[]
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    try {
                        UIManager.setLookAndFeel(UIManager.
                                                 getSystemLookAndFeelClassName());
                    } catch (Exception exception) {
                        exception.printStackTrace();
                    new Application1();
        private void jbInit() throws Exception {
    }

  • What is the best way to back-up my entire library, and How??

    I need to back up my library before somethings happens!!  What is the best way to do that?  Also how do you restore it back on your itunes???

    My 2 cents...
    Fast backup for iTunes library  (Windows)
    Grab SyncToy  2.1, a free tool from MS. This can be used to copy your entire iTunes library (& other important data folders) onto another hard drive or network share. You can then use SyncToy periodically to synchronise or echo your library to the backup. A preview will show which files need to be updated giving you a chance to spot unexpected changes and during the run only the new or updated files will be copied saving lots of time.
    If your media is all organised below the main iTunes folder then you should also be able to open the backup library on any system running the same version of iTunes, regardless of the drive letter or path it appears on.
    Step-by-step install guide
    You restore files simply by copying them back to where they are missing from, or copy back the entire folder in the event of a major disaster.
    tt2

  • What is the best way to switch between two sets of bookmarks, say 'work' and 'private'?

    I want to use to sets of bookmarks, so that when I'm working, I'm not distracted by my non-work bookmarks and vice versa. For the last couple of months, I've been using two user accounts to achieve this, but it's a bit of a PITA. Links from other applications, like Thunderbird mail are opened in the default profile. This means when I'm not at work and I click a link in an email, a new window is opened with my Firefox work profile.
    All I need is a trick or an extension to quickly switch bookmark sets. Or a way to switch profiles without opening a new Firefox window. Any ideas?

    You can't get Firefox to work as you are explaining you want. The Default Profile can't be changed on-the-fly to the Profile you are currently using. That message "Firefox is already running ..." comes up due to you or "something" trying to open a 2nd (or subsequent) Profile, unless that '''-no-remote''' command was used to open the additional Profile. And '''-no-remote''' won't work to open the Default Profile without causing issues with how Windows works with "calling up" the Default Browser.
    In response to your last statement - '''''"To separate my work and private stuff I only need to change the contents of my bookmarks bar, so I hoped there was some trick to maintain to groups of bookmarks."'''''
    This extension will allow you to change the Bookmarks Toolbar folder while you are using Firefox.
    https://addons.mozilla.org/en-US/firefox/addon/set-as-bookmarks-toolbar-folde/
    I just installed that extension and verified that it still works in Firefox 35.
    There is a context menu item added for '''"Set as Bookmarks Toolbar Folder"'''' that appears when the Bookmarks Menu Bar drop-down menu is used (not in the Library window or the Bookmarks Sidebar). That menu item appears when you right-click a folder in the Bookmarks Menu folder. It doesn't appear with the "Bookmarks Toolbar" folder or the "Unsorted Bookmarks" folder - only a folder that is in the "Bookmarks Menu".
    That should "solve" wanting to have two different settings for the Bookmarks Toolbar, but the Default Profile "thing" is still an issue for what you are trying to accomplish. I don't "see a fix" for that - without resorting to a 2nd Window User Account which is what I thought you were referring to by "I've been using two user accounts to achieve this" in your initial posting.
    And since the Menu Bar is hidden by default these days, you can use '''Alt''' then '''B''' to open the Bookmarks drop-down from the "revealed" Menu Bar so you can access that '''"Set as Bookmarks Toolbar Folder"''' menu item - without having to show the Menu Bar all the time.
    ''BTW, using "accounts" in lieu of "Profiles" can be confusing when discussing Firefox Profiles.''

  • What is the best way to switch off Daylight Saving Time?

    What is the best way to switch off Daylight Saving Time for a DST enabled timezone?

    I've been looking through the related classes and can't seem to find a way to disable DST in any timezone. Probably because they couldn't think of a good reason to want to know what the non-DST time was during DST.
    However, you could easily compute the time without DST if that's what you need.

  • In Acrobat Professional 8, what is the best way to insert/combine multiple pdf's together in a large

    In Acrobat Professional 8, what is the best way to insert/combine multiple pdf's together in a large volume?
    We have 300 pdf reports and need to insert a 2 page cover page infront of each report. Not sure if Batch processing is best???
    Thanks for any tips.

    Probably each cover page is different too. I would probably just bite the bullet and do each individually. I would create the 2 cover pages in WORD or other word processor and print to cover.pdf. Then open a PDF and Pages>Insert Pages or the cover.pdf to the front of the open PDF and save as to the current PDF. Then repeat 299 times. Each time you would make the appropriate change to the DOC file and print a new cover.pdf file (you might want to turn off open in Acrobat for this processing in the printer properties to save time). Probably a good idea to keep a list of the files to check off what has been done (you can generate a list in DOS by Start>cmd, change the directory to your location [cd path], and do "dir >>list.txt". That will give you a list to use.). There may be an easier way, but by the time you get it figured out you might be done this way.

  • What is the best way to do a 10.8 reinstall and keep all of my data?

    What is the best way to do a 10.8 reinstall and keep all of my data?

    Boot to the recovery disk and reinstall the os. That said you do have a back up just in case (I trust)?

  • I am getting pop ups on safari and firefox lately and am worried i may have malware or something now on my computer doing this. What is the best way to check this out for sure and remove it?

    I am getting pop ups on safari and firefox lately and am worried I may have malware or something now on my computer doing this. What is the best way to check this out for sure and remove it?

    Please review the options below to determine which method is best to remove the Adware installed on your computer.
    The Easy, safe, effective method:
    http://www.adwaremedic.com/index.php
    If you are comfortable doing manual file removals use the somewhat more difficult method:
    http://support.apple.com/en-us/HT203987
    Also read the articles below to be more prepared for the next time there is an issue on your computer.
    https://discussions.apple.com/docs/DOC-7471
    https://discussions.apple.com/docs/DOC-8071
    http://www.thesafemac.com/tech-support-scam-pop-ups/

  • What is the best way to switch from Trial to Purchased

    I have the downloaded trial version of InDesign CS3 and will purchase it.
    What is the best way to accomplish this once the credit card has been debited?
    * Delete the trial version and download the purchased file from Adobe? (I would save off any pages created in the trial version of course).
    * Just enter the serial number provided by Adobe into the trial version I have been using and dont bother downloading the link provided by Adobe?
    * Delete the downloaded trial version and have Adobe send me the box version (taking longer obviously)? Once again, I would save the pages already created?
    Thanks,
    Bob

    Just enter the serial number.
    Note: if you only downloaded InDesign but bought the full suite, you'll
    need to uninstall the trial and install the suite.
    Bob

  • What is the best way to switch to Thunderbird from Incredimail (old emails and address book)?

    I'm feeling trapped in Incredimail. What is the best way to move over to Thunderbird? I'd like to keep my old emails, attachments and the address book as well. Is this possible?
    I've seen the program "PCVARE IncrediMail Converter" at www.pcvare.com/incredimail-converter.html#dl.
    Isn't there a better way (and free) to get out and away from the Incredimail trap?

    Bonjour,
    Open the address book window of TB. By the menu Tools / Import you can discover the possibilities and files formats accepted by TB for importing.
    I don't know Incredimail, explore the menus of Incredimail to find how you can export data.
    Pierre

  • What is the best way to work on multiple songs in one long recording?

    I often record the local open-mic nights and generally just leave logic recording the entire night so i end up with lots of songs/bands in one big recording.
    What is the best way to work with such a recording? Is there a better way than just using the event marker when a new band plays?
    Also once i get home id like to save each band to a separate project but i cant seem to find an easy way to do this?
    Obviously each band needs a different mix hence needing separate projects? or am i missing a much better work method?
    any help greatly appreciated!
    many thanks

    As for your second point, just do a "save as" new file name and cut and erase any unwanted audio from the arrange window (ie. the bits that aren't in the song you want separate). You can do this for as many songs as there are and create a different mix for each one no problem. You multiple select and drag all the regions to the beginning of the arrange window (make sure you do them at the same time so's they don't go out of synch. All the separate songs and mixes can be saved in the same project folder as the original audio files are stored in (the folder structure should be there already if you started a new logic project, so no need to change that.
    I would think using markers so you know where each song begins during the show, and the above method after, would be a very good way of organizing things. You may want to stop actually recording between bands too though I expect you are already doing this.
    Its really as easy as that. Sometimes things just are.

  • What's the best way to merge, restore or reconstruct iPhoto and Aperture libraries to resolve images that are not found/offline?

    Hey there, Apple Support Communities.
    To start, I'm working on a MBP Retina 15" with a 2.3GHz i7 processor and 16 GB of RAM.  10GB free on a 256GB SS HD.  Attached are two external HDs - one 1TB Western Digital portable drive from 2011, one 2TB Porsche LaCie non-portable drive from 2013; both connected via USB.  All photo libraries in question are on the external drives.
    I have Aperture 3.5.1 and iPhoto 9.5.1.  I prefer to work in Aperture.
    The Issue(s)
    Over the years, I have accumulated a number of iPhoto libraries and Aperture libraries.  At one point, I thought my WD drive was dying so I purchased the LaCie and copied all libraries over the the LaCie drive.  (Turns out, there's probably an issue with my USB port reading drives, because I can once again see the WD drive and occasionally I can't see the LaCie drive.)
    So now I have old version of some libraries on the WD drive, and new versions on the LaCie drive.
    When I was moving things, I ran the software Gemini to de-dupe my iPhoto libraries.  Not sure what effect that may have had on my issues.
    In my main Aperture library and in some iPhoto libraries, I get the image-not-found badge or exclamation point.  I've dug through the hidden Masters folders in various libraries to find the original image.  In some cases, I have been able to find the original image, sometimes in a different version of the iPhoto library.
    My Question(s)
    1.  For Aperture libraries that have missing originals, is there some magical way to find them, or have they just disappeared into the oblivion?
    2.  For iPhoto libraries that have missing originals and I have found the original in another iPhoto library, what is the best way to proceed?
    3.  Are there quirks to merging iPhoto and Aperture libraries (by using the Import->Library) feature that I should be aware of?
    TL;DR: Too many iPhoto and Aperture libraries, and not all the original pictures can be found by the libraries anymore, though some originals still do exist in other libraries.  Steps/process to fix?
    Thank you!  Let me know if you need add'l info to offer advice.
    With appreciation,
    Christie

    That will not be an easy task, Christie.
    I am afraid, your cleaning session with Gemini may have actually removed originals. I have never used this duplicate finder tool, but other posters here reported problems. Gemini seems to replace duplicate original files in photo libraries by links, and this way, deleting images can cause the references for other images to break. And Aperture does not follow symbolic links - at least, I could never get it to find original files this way, when I experimented with this.
    1.  For Aperture libraries that have missing originals, is there some magical way to find them, or have they just disappeared into the oblivion?
    You have to find the originals yourself. If you can find them or restore them from a backup, Aperture can reconnect them. The reconnect panel can show you, where the originals are supposed to be, so youcan see the filename and make a Spotlight search.
    For iPhoto libraries that have missing originals and I have found the original in another iPhoto library, what is the best way to proceed?
    Make a copy of the missing original you found in a folder outside the iPhoto library. You can either open the iPhoto library in Aperture and use "File > Locate Referenced file" to reconnect the originals, or simply reimport them. Then Lift&Stamp all adjustments and metadata to the reimported version.
    See this manual page on how to reconnect originals:  Aperture 3 User Manual: Working with Referenced Images  (the paragraph:  Reconnecting Missing or Offline Referenced Images)
    Are there quirks to merging iPhoto and Aperture libraries (by using the Import->Library) feature that I should be aware of?
    References images will stay referenced, managed will remain managed. You need to unhide all hidden photos in iPhoto - this cannot be done in Aperture.
    and not all the original pictures can be found by the libraries anymore, though some originals still do exist in other libraries.  Steps/process to fix?
    That is probably due to Gemini's replacing duplicate originals by links, and your best cause of action is to fix this before merging the libraries. Reconnecting can be done for your iPhoto libraries in Aperture.

  • What's the best way to load balance multiple protocols on one vserver?

    Hi,
    We have a CSM blade on a 6513, in bridge mode. I'm just wondering what is the best way to serve HTTP and HTTPS (or any two or more ports) from the same group of servers. As I see it, we have two options:
    1. Don't set a port on the vserver, so it is load balancing "any" or "tcp". This is easy but I want to be sure there isn't a downside to this, other than the obvious security issue.
    2. Create multiple vservers and point them at the same serverfarm. I tried this and I got some odd results with the health checks.
    Any ideas? Thanks a lot.

    you listed the only 2 options available.
    The advantage of solution #2 is that you can apply specific config for each protocol ie: for HTTP you can turn 'persistent rebalance' if needed.
    If you want to use specific probes [not icmp], it is also a good practice to create a different serverfarm for each protocol.
    Like this, if the HTTP service goes down but not the server, you can still have other protocols loadbalanced.
    Regards,
    Gilles.
    Thanks for rating this answer.

  • What is the best way to get rid of troyan virus and safari virus?

    what is the best way to get rid of viruses on my macbook?  the viruses are causing popups and saying that the device is infected.

    ds store wrote:
    ClamXav is only a scanner, it can't remove the MacDefender malware.
    Yes, it can. ClamXav scans and quarantines it. It was updated.
    http://www.reedcorner.net/news.php/?p=98
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 

  • What is the best way to run internet explorer on Mac and IPad and is it safe to do so??

    I need to run internet explorer to access new billing software,  what is the best way to do so and is it safe to run this on macbook and ipad if possible??

    You can't run IE on an iPad and the only way to use it on a Mac, since it's been discontinued for years for the Mac OS, is to install Windows either via Boot Camp or via running Windows as a virtual machine using something such as Parallels Desktop (my personal preference).
    Clinton

Maybe you are looking for

  • The "TV Shows" category on my Ipod video menu disappeared

    I forgot when this happened but the "TV Shows" category disappeared from my ipod menu. Now my purchased tv shows is no longer in my ipod but still appears in my itunes. Does anyone know the solution for this problem?

  • ODBC Client/Server Mode, unexpected scale for non-numeric type

    When I connect to Oracle RDB via Oracle ODBC driver, I noticed the SQLBindCol for the CHAR type returns scale=0 while scaleLen=-2. This behavior is different from MS native ODBC driver and also vary from IBM DataDirect. For MS ODBC driver and IBM Dat

  • Invalid handle to path? Help!

    I dowloaded a program LOGOS and it keeps on crashing. Their tech people said it came down to this problem. Can anyone help me with this 'path'? She said it may be something with LION and not being downloaded properly? Error detail: IOException: Inval

  • ClassCastException when using javax.xml.soap.DetailEntry

    I am using the Java Web Services development pack and I'm getting a ClassCastException when trying to use a DetailEntry object. My code is basically as follows: SOAPFault fault = responseSoapBody.getFault(); Detail detail = fault.getDetail(); Iterato

  • How do I find past edits after reinstalling LR4

    I had to reinstall LR4. How do I locate and load previous raw edits? Here's what I've tried: Under the Library Module, right click on "All Photographs" under Catalogs Click on "Import From Another Catalog" Found my old Lightroom Catalog and added it.