What is the best way to capture RGB8 image to memory for later write to disk?

HI-
I have been using the code below for some time now but wonder if an expert can take a look and let me kown if there are ways to improve it.  Problem I run into is that I preallocate the memory beforehand (camera.buffering[]), and with a 5 MP camera, this takes up a lot of RAM.  It seems like when I am running this program in debug mode all day and constantly start/stop it without allowing it to free the memory gracefully, i eventually bog the system and start getting Out of Memory error -12, in other places in my code such as DisplayBitmap or GetBitmapfrom File.  Is this all related to how much memory I am trying to allocate prior to begining the camera capture routine below?  Am I not allocating and free-ing it properly?
Code is below for how I grab the image and then send to memory usign memcpy.  Is there a better, more efficient or faster method?  I have removed error checking/etc from code below simply to save space. This operates at 15 fps.   
I also included my allocation and free-ing code, too. 
Thanks in advance.
Blue
//caemra capture loop//
camera.dxerror = IMAQdxGrab (camera.session, camera.image, 1, &camera.bufNum);          
stat = imaqRotate2 (rotateimage, camera.image, camera.rotate_image, pixval, IMAQ_BILINEAR, TRUE);    
stat = imaqScale (scaledimage, rotateimage, 4, 4, IMAQ_SCALE_SMALLER,IMAQ_NO_RECT);          
stat = imaqGetImageInfo(camera.image,&camera.info);
stat = imaqDisplayImage (scaledimage, 0, FALSE);         
memcpy (camera.buffering[camera.count], camera.info.imageStart, camera.info.pixelsPerLine*camera.CAMY*camera.bytesperpixel);   
//memory allocation code//
 camera.buffering = (int **)malloc(camera.maxcount*sizeof(int*));
 for(i=0;i<camera.maxcount;i++)
      camera.buffering[i] = (int *)malloc(camera.info.pixelsPerLine*camera.CAMY*camera.bytesperpixel); 
// free allocated memory code//
 for(x=0;x<camera.maxcount;x++)
         free(camera.buffering[x]);
free(camera.buffering);

How many images are you storing in RAM?  Typically when I need to work with tens, hundreds, or even thousands of images, I save them to the hard drive after I capture them as a PNG with 1000 quality.  Sometimes I process them before saving, sometimes I process them offline from the saved images depending on the application.  If you don't need all of the images simultaneously in memory at once, just save them to PNG.  If you only process one image at a time, only allocate enough memory for the processing you need to perform on a single image.
www.movimed.com - Custom Imaging Solutions

Similar Messages

  • What's the best way to capture speech as text in live or recorded Adobe Connection sessions?

    Hi
    What's the best way to capture speech as text in live or recorded Adobe Connection sessions?
    We would like to have a transcript of the presentation. Is Adobe Connect compatible with Dragon speech recognition software - or is there a preferred Adobe product or method?
    We use PCs running Windows 7 Enterprise.
    thanks

    The class java.util.Date is not itself deprecated, however several of its methods are.
    For converting string -> date, you should use the class java.text.SimpleDateFormat. That allows you to specify format strings such as MM-dd-yyyy hh:mm:ss for converting date -> string -> date.
    If you are wanting to set day/month/year on the date object directly, instead of the Date methods setDay, setMonth, setYear, you should instead use the java.util.Calender class:
    calendar.set(Calendar.MONTH, 4);
    The calendar can then be converted to a Date object by calling calendar.getTime().
    If you are going to use the date as part of a sql query, I would recommend using a Prepared statement, and the java.sql.Date/java.sql.Timestamp class as well.
    To convert from java.util.Date to java.sql.Date)
    jva.util.Date utilDate = Calendar.getInstance().getTime();
    java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());cheers,
    evnafets

  • What is the best way to set up an external drive for video storage

    What is the best way to set up an external drive for video storage?

    Check the formatting. It need to be formatted as Mac OS Extended (journaled). This is also known as HFS+.
    FAT32 and NTFS formatting will not work with iMovie.
    If necessary, you can reformat using Disk Utility.
    Make one large partition. No need for multiple partitions.
    Do moves or copies to the external drive through iMovie as detailed in iMovie Help. If you move Events in the Finder, they may become unlinked from the projects that use them.

  • What is the best way to record a video(not big) for free on a mac w/isight?

    What is the best way to record a video(not big) for free on a mac w/isight? I need to just make a short (less than 5 minute, no special effects) video, but I can't figure out any programs that will make this possible for me.
    Thanks.

    Hi Carolyn,
    you can use iMovie to record a video for free on a Mac with iSight.
    1. Open iMovie HD
    2. Choose “Create a new project”
    3. Name the project for example “iSight Movie” (first field). In the second field, let the default location “Sequences”, in the third one, video format, choose “iSight”. Push “Create”
    4. iMovie window opens, next to the scissors, choose the camera (Camera mode), then iSight. Now you appear on the screen, right?
    5. Press “Record with iSight” in the main picture window.
    6. Press the same button to stop. Your new clip appears now in the clip panel at the right.
    7. You are done!
    iMac G5 PPC 2,1 Ghz   Mac OS X (10.4.8)  

  • What is the best way to make a list of addresses for envelopes or labels?  Address book, numbers or pages?

    What is the best way to make a list of addresses for envelopes and labels?  Address book, Pages or Numbers?

    I liek your idea of having multiple images in a grid. I think
    that would be the best bet as you mentioned. Having one big picture
    would be hard to distinguish the sub-areas with mouse coordinates.
    I think checking the coordinates for the mouse would be very
    tedious because I would have to check for the left boundary, the
    right, top, and bottom for each sub-area!
    What do you mean by using button components and reskinning.
    Is this simply using buttons and changing the way they look? I'm
    just trying to save time and memory, because if I had a 10 by 10
    grid, thats a hundred buttons. Wouldn't that slow down the machine
    alot? And for that matter wouldn't having a grid of 10 by 10 images
    also by the same deal?
    Thanks for the input, I'm just trying to find the most
    efficient way to do it.

  • What is the best way to detect peak to peak voltage for the following waveform ?

    I have two channels of waveform train ( ie W1 & W2 ), each of them is of frequency 64KHz.
    Each channel of waveform train consists of sinewaves of 64KHz of fixed amplitude, say 2 V pk to pk, running for 100 cycles, and then rest for 0.15 sec continue with a sinewave of 64KHz of another fixed amplitude, say 1 V pk to pk running for 100 cycles as well, and then rest for 0.15 sec. The above cycle considered as a complete waveform cycle.
    The above complete waveform cycle repeat for 10 cycles and rest for 1.3 sec and repeated itself.
    From the two simulated waveforms (ie W1 & W2), I need to detect and measure the peak to peak voltage of each of the 100 cycles sinewaves.
    What is th
    e best way to achieve that ?

    The waveform is free running as described above, ie sinewave running at approximate 64 KHz for about 100 cylce at fixed amplitude, say 2V ( actual number of cylce unknown, could slightly more or sightly less, depanding on the machine ) then rest for approximately 0.15sec, another sinewave running at approx. 64KHz at fixed amplitude, say 1.5V ( actual number of cylce unknown, could slightly more or sightly less, depanding on the machine ) running for approx 100 cycles continue...then rest for approx. 0.15 sec .....the above waveform repeated itself and free running .....I would like to capture or trigger each of the 100 cycles sinewave (rest time of 0.15 sec between each approx100 cycles of sinewave) to measure the peak to peak voltage and st
    ore them in array for analysis purpose....what is the best way to achieve that as I do not have time reference, I only know that the waveform is running at the pattern described above.
    Thanks for your help !

  • [Flex 4.5.1] What is the best way of adopting a flex built website for mobile "as is"?

    What is the best way of adopting a flex 4.5.1 built website for mobile "as is"?
    I have a website built with flex 4.5.1 which I want to be working on mobile as it should - meaning that touch style of interactions should be working not mouse.
    The question is: Do I HAVE TO recode all of my website from Application into Mobile Application in order to be a more lightweight version of the original one, which includes: remove some functionality, pages, animation, build a separate backend and cms to control it etc.?
    OR
    Can I just define mobile skins, for my existing components to use when in mobile mode, in which I could have done some tweaking by removing some unnecessary parts and changing component interactionMode to Touch ?
    Are both options which I see possible and if yes - which one would you recommend?
    Thanks in advance!

    Thanks for the answer. Yeah I bet you figured out what I want the answer to be, but is it ? That's why I am asking here. I can see my website on my HTC Desire HD and it's working pretty well. If I reskin the parts that need a bigger hit area or the scrollers to work with touch so I don't have to scroll the actual scrollbars with my finger, remove some complex animations - everything will work just fine... The problem is that I am not sure if that is the right way to do it or if it is possible at all.
    I do get your point about not designed for mobile stuff, but while with html 5 you get the job done for web and mobile with little differences at the same time, in flash you need double time cause you'll have to build 2 projects. And since the framework is one for both web and mobile.. why not...
    I want to see the pros and cons of the both approaches I suggested. In a complex modular architecture I could easily swap one web module with a mobile module for example or change skins or components if I need more lightweight ones, but do I have to copy all that logic in to a MobileApplication, can't I do it with Application and use the MobileComponents (which are simplier and less functional) if the project actually needs them...
    I do hope you get why I am asking these questions, and I can't believe I haven't found a guide or something like that "why this and not that" when it comes to mixing web with mobile development and flex... If you have, please share the link, I would be happy to read. Or someone with the experience in what I am talking about shares some knowledge, that would be great!
    Thanks.

  • What is the best way to keep high res when saving "for web"

    the files i'm saving for web so i can get them in jpg (or gif) format are coming out very pixelated.  this is when i print the image. 
    what is the best way to save for web an image and keep the resolution good. 
    using for a business card template.  avery template will let me attach images i want to the project.  to do this..  i "get file from computer" and it drops the image in but real small... then you are supposed to enlarge it onto your work however you want.  well when i enlarge this image file, it gets pixelated badly.  i'm thinking it's the way i'm saving it.  i do not adjust anything when i save.  maybe i should.  this is where i need guidance. 
    this is what avery template notes about the images i am allowed to use - When uploading the image, the maximum size allowed is 4 MB.  You can only upload JPG and PNG images either as RGB or CMYK.  so when you recommend things, can you please keep this in mind
    thank you for oyur time.

    Aida,
    When you save with the default template using save for web it is generally a very low settings.
    While in the save window you can define the pixel size of the image you want with quality as well as resolution too.
    Refer to tv.adobe.com video save for web or Adobe help file for detailed instructions.
    Mandhir

  • What's the best way to master an MPEG 2 file for DVD Studio Pro.

    In version 4.5 of FCP I was able to use QuickTime conversion to encode to MPEG2. Now that option is not there. I hate using compressor 2 to create MPEG 2 because when I do the MPEG 2 files always seem to studder and I don't know why. I shot my project in HDV. It is about 64 minutes long. Any suggestions on the BEST way to master an MPEG 2 file for DVD Studio pro? Thanks in advance!
    Peter
    PS - I'm using FCP 5

    Some people have reported a field reversal problem with HDV to SD DVD encodes. There's an Apple technical document on this issue somewhere, but the problem was supposed to be addressed by a Pro Applications update a couple of years ago... This site might help you get to the bottom of the problem.
    http://www3.telus.net/bonsai/Step-by-Step.html

  • What is the best way to capture off of an AVCHD Camera in final cut?

    Im kinda new to final cut pro so, please don't flame me. I was hoping to capture some extra footage on to my system through my AVCHD camcorder. And i want to know the best way to do so? Thanks for the answers.

    I was not successful using mpegstreamclip for this. However, I found VoltaicHD from ShedWorx and it works great. Simply load all the clips you want to convert, assign a location and walk away. The result is beautiful HD .movs ready to be imported into FCP. I paid about $35 for it and it was well worth it.

  • What is the best way to capture the Form data Temporarly

    Hi,
    I have a form with lot of validations.
    Suppose user entered some of the fields and he decided to fill rest of the field later on.
    So he now want to save the record temporarly without applying any validation and next time when user logs in, the form should be populated with those invalid data and then he continues to fill up the rest of the fields, now once he SUBMIT the page..all the business validations should apply and record is commited.
    What is the best approach to acheive this??
    Have any one has the done this kind of requirement.
    Thanks,
    Deepak

    This is a little more complex as well because you'll need to save this data in a "temporary" table. Not temporary like global temporary, but just a staging table that has no constraints. In a real application, your table would not have NOT NULL constraints, but your user may not use them.
    Along with the previous post, you may need to follow this logic:
    1) If the save as draft button is clicked, you save to the table with no constraints.
    2) When someone tries to navigate to the form, you first check the "draft" table and if there is a record there, pull it. Otherwise pull from your production table.
    3) When the person clicks the commit/submit/etc button, save the data back to your "draft" table, copy the information over to the production table, and delete the temporary record.
    It's a lot of coordination honestly - my client asked for the same thing and when I explained the complexity involved for a form that only had 5 or 6 fields, they agreed. And when I say complex, I tell them it will cost them more money, yet provide little benefit. That usually solves it quickly.

  • What is the best way to share music wirelessy at home using a external hard disk?

    We would like to find the best way we can access wirelessly our music track stored on a external hard disk at home?  We would it to be able to access them by using MAC, PCs, iPads, Android and iphones.

    Personally, I use MobileMe and let my family watch the movies on line. It is easy to share this way. I share the movie in Large (960x540) or Medium to iTunes. Then I share to Mobile Me.
    For personal viewing, I use the Apple TV.
    You can also burn a data DVD of your finished movie, and let them copy the file to iTunes from their data DVD.
    You can upload the movie to other video sharing services such as YouTube or Vimeo.
    You can burn a blu-ray disk if you have Toast and a BluRay burner. You can burn a short movie to regular DVD media using Toast and a regular DVD burner that is playable on most BluRay Players.

  • What is the best way to capture CUCM configurations?

    Rather than clicking though the drop down menus in CUCM, what is the most efficient way to capture a complete configuration settings in CUCM?  I know some of the settings can be done using BAT, but what about other settings like Enterprise Parameters, DHCP server/subnet, etc.?  If the captured configurations are in human readable format will be even better.

    [+5] to Rob and Brandon for sharing more info.
    Hi Brandon,
    I downlaoded the latest software  cipinventory-v0.11 from the site and unzipped it .I could find four files and not any exe .I have attached the snapshot.
    when I click on .pl file it asks which program to be used for opening.
    Am I following the correct procedure or missing something?
    regds,
    aman

  • HTML form Date field - what's the best way to capture it on the backend?

    Hi,
    What would be a good way to capture a text field that contains a date string?
    In my app I have a page with several text fields, that are populated by a calendar pop-up. On the server side I can capture them into a java.util.Date object, but Date is dperecated.
    Should I still use Date or is there a better way?
    I intend to use the date as part of an SQL query.
    Thanks.

    The class java.util.Date is not itself deprecated, however several of its methods are.
    For converting string -> date, you should use the class java.text.SimpleDateFormat. That allows you to specify format strings such as MM-dd-yyyy hh:mm:ss for converting date -> string -> date.
    If you are wanting to set day/month/year on the date object directly, instead of the Date methods setDay, setMonth, setYear, you should instead use the java.util.Calender class:
    calendar.set(Calendar.MONTH, 4);
    The calendar can then be converted to a Date object by calling calendar.getTime().
    If you are going to use the date as part of a sql query, I would recommend using a Prepared statement, and the java.sql.Date/java.sql.Timestamp class as well.
    To convert from java.util.Date to java.sql.Date)
    jva.util.Date utilDate = Calendar.getInstance().getTime();
    java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());cheers,
    evnafets

  • What is the best way to export to achieve clear video for the internet?

    Is it best to just use a preset? or are there other ways to get that clear look that you get when you watch the high def mp4 straight out of the app...?
    I notice that some video is much more detailed and higher res looking...but when i upload to youtube it doesnt quite look as good...blurry... especially with smaller sizes...
    Any suggestions?
    Thx in advance.

    i agree with you Jim.
    but i didnt do that.
    shot at 24p. never went anywhere near 30 for any of it. i exported at 23.987 because i read somewhere that that might be better for web video...cant even remember where...also my exports from AE were all 24p. i guess i will just keep it the same across the board.
    i just wander if i use the animation codec out of after effects, full on lossless, if it would improve anythiing for the final render. I used an avid codec for export out of after effects for a better file size for the clips i put into premiere. seemed to work alright. then use h264 playback codec when i exported the final.
    there is just such a difference in quality for some of the reels i see. i want that quality. clarity.

Maybe you are looking for