camera / snapshot...

I scoured the forums, found several "solutions" to this problem, but not a single 'solution' of the works of threaded discussion. Because I'm new, I have the newest of the current SDK to run on Eclipse, the steps that I'm trying to figure is as follows:

(1) display of the user interface, initialize the object camera full screen (not in a domain)

(2) that the user can take a picture, then immediately close the camera after taking the photo

(3) add a thumbnail preview to the current form of screen UI (FIELD), which is simple and shows the photo

(4) save the captured image in the memory of the device in a folder that I created or on the SD card in a folder that I created

(5) get the name of this file when it has been recorded in the folder, the file name must be unique similar GUID and returned at the time where the file was saved

I worked on this for the past few days, the code I still does not work as follows:

private void initCamera()
{
  try
   {
     //Create a player for the Blackberry's camera.
     Player player = javax.microedition.media.Manager.createPlayer( "capture://video" );

     //Set the player to the REALIZED state (see Player docs.)
     player.realize();

     //Grab the video control and set it to the current display.
     vc = (VideoControl)player.getControl( "VideoControl" );

     if (vc != null)
     {
          //Create the video field as a GUI primitive (as opposed to a
          //direct video, which can only be used on platforms with
          //LCDUI support.)
          _videofeed = (Field) vc.initDisplayMode (VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
          //Display the video control
          vc.setVisible(true);
      }

      //Set the player to the STARTED state (see Player docs.)
      player.start();
  }
  catch(Exception e)
  {
      log( "ERROR " + e.getClass() + ":  " + e.getMessage() );
  }
}

private void setupSnapshot()
{
  encoding = "encoding=jpeg&width=640&height=480&quality=normal";

  snapshotButton = new ButtonField("Capture", ButtonField.CONSUME_CLICK | ButtonField.NEVER_DIRTY | ButtonField.HCENTER);
  listenerSnapshot = new FieldChangeListener() {
    public void fieldChanged(Field field, int context) {
         log(encoding);
             snapShot();
    }
  };
  snapshotButton.setChangeListener(listenerSnapshot);
  add(snapshotButton);
}

private void cleanSnapshot()
{
  Manager m;
  try
  {
    if(snapshotButton != null)
    {
      m=snapshotButton.getManager();
      if(m != null)
        m.delete(snapshotButton);
    }
  }
  catch(Exception ex)
  {
    log("Error: " + ex.toString());
  }
}

When you capture instant, it will not create an image file and save it to memory. It returns an array of raw image data and you will need to create image from data line and save it in the file system. You already create image of row data.

byte[] imageBytes = vc.getSnapshot(encoding);
      Bitmap image = Bitmap.createBitmapFromBytes(imageBytes, 0, imageBytes.length, 5);

Now you need to save this image using the FileConnection API to the memory of the device or SD card. Here you must assign the unique image name which may be the current date & time.

public static String dateFormat()
{
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
    return sdf.format(Calendar.getInstance().getTime());
}

Here is Snap from sample RIM, which saves the image.

/**
    * A listener used for the "Save" button
    */
    private class SaveListener implements FieldChangeListener
    {
        /** A byte array representing an image */
        private byte[] _raw;

       /**
        * Constructor.
        * @param raw A byte array representing an image
        */
        SaveListener(byte[] raw)
        {
            _raw = raw;
        }

       /**
        * Saves the image as a file in the BlackBerry filesystem
        */
        public void fieldChanged(Field field, int context)
        {
            try
            {
                // Create the connection to a file that may or
                // may not exist.
                FileConnection file = (FileConnection)Connector.open( FILE_NAME + _counter + EXTENSION );

                // If the file exists, increment the counter until we find
                // one that hasn't been created yet.
                while( file.exists() )
                {
                    file.close();
                    ++_counter;
                    file = (FileConnection)Connector.open( FILE_NAME + _counter + EXTENSION );
                }

                // We know the file doesn't exist yet, so create it
                file.create();

                // Write the image to the file
                OutputStream out = file.openOutputStream();
                out.write(_raw);

                // Close the connections
                out.close();
                file.close();
            }
            catch(Exception e)
            {
                CameraDemo.errorDialog("ERROR " + e.getClass() + ":  " + e.getMessage());
            }

            // Inform the user where the file has been saved
            Dialog.inform( "Saved to " + FILE_NAME + _counter + EXTENSION );

            // Increment the image counter
            ++_counter;

            // Return to the main camera screen
            UiApplication.getUiApplication().popScreen( _imageScreen );
        }
    }

in your case, you can replace

FILE_NAME + _counter + EXTENSION

with

String fileName = dateFormat + EXTENSION;

that will give the unique name of the image.

I hope this will solve your problem, if not you can always come here

Tags: BlackBerry Developers

Similar Questions

  • How to take snapshots of two usb camera at the same time

    Hello

    I have a project where I have to take still photos of two usb camera at the same time repeatedly and save the in a particular direcltory. I am received using a camera by using "Camera Grab vi", but I can't make it work with 2 cameras, I use the flat sequence and 2 "Camerra Grab vi: with particular camera in a sequence, but each time when I run the program I get only pic of a camera, its seems a camera dominates the other.»

    Please is it possible to use the two camera simultaneously. Attached are the snapshot of my vi.

    Thank you

    Ankit G

    Looks like you are using the same reference at the same time grabbing the camera. The two camera snaps happen but the second camera clamp is written on the first so it seems alone is slam. Try to run the VI executiong highlighted arbitrary mode (select icon icons four bulb to the right of the button run on the schema). This will allow you to see the data stream. In order to get both of these Snap you'll need separate references. You can try to watch one of our examples in the example Finder OR give you some direction (LabVIEW > help > find examples > Browse tab > Input and Output material > IMAQdx > high level > Snap.vi). You can break the two cameras at the same time if you just copy this code and double of the code.
    (Note: If you change the examples, always save as copy in another location so that you do not save on the packed example)

  • I installed photoshop CS4 on a new PC with the original CD. Camera Raw does not show the 'Snapshots' tool and the tool "setting of the target". Thanks for your help!

    I installed photoshop CS4 on a new PC with the original CD.

    Camera Raw does not show the 'Snapshots' tool and the tool "setting of the target".

    Thanks for your help!

    As you can see, you are using version 5.0, who can't stand still not instant in it.

    Please check for updates in Photoshop > help.

    Concerning

    Sarika

  • Satellite P205-S6287 - webcam only takes snapshots using Win 7

    Hello.

    I recently updated my laptop from Windows Vista to Windows 7 Ultimate (32 bit).
    When I did, I went through the typical rigmarole of updating my drivers and reinstall some programs or games lost. What I wasn't expecting, it was for my camera to completely stop working.

    I reinstalled the software of the camera, and it seemed to work until I tried to take a snapshot with the software after that. Now, the camera records video and audio recording, but it will not instant (I mainly use for).

    If I click on the Snapshot button, she acts like I clicked it, but no preview image and no new photos are saved in the folder my pictures.

    Any ideas? Or advice? Or help? Thank you!

    Hello

    Perhaps you should again check the path to the photo folder?
    Maybe the webcam records the images to another location on the HARD drive

  • Satellite P200 - 10 c: camera does not work after upgrade to Vista ultimate

    After the full vista upgrade webcam did not work. After some research, I found that I had to change the driver for usb video camera I did.

    Everything works fine now except the snap button of the camera software. Record audio and video works fine. Snapshot button does not work after you have clicked on it. Can someone help me solve this problem too.

    Hello

    you have reinstalled the software of the camera (not only the drivers) that controls the special features snapshot-thing like that?

    It should contribute to reinstall everything because vista is confusing every driver/software maximally... :)
    Would appreciate comments on your success.

    See you soon

  • Rigging diff. cam movements as presets for use in FCPX?

    Say, I would like to create a simple generator, for example a Cube.

    And I would like to allow the user to select from a menu drop-dwn a few 'options of movement', of the camera (!)

    for example "scanning l/r", "Overview", "hero Shot"...

    So, I do all keyframes, but different movements are available via a platform...

    How to accomplish this?

    Hi Karsten!

    I've tried a few things. Here's an easy way:

    Create a new pop up rig.

    Add the camera Position and Rotation to the test.

    The value of Snapshot 1

    Move the playhead to the beginning of the project (or the starting position)

    Activate the button Save in the playback controls.

    Select the object, the camera will focus on in the layers list.

    REPEAT: Move the playback cursor and use the controls of the camera on the screen to adjust the display.

    Disable the button Save.

    Set the next snapshot...

    You can clean the movement in the keyframe Editor. Select the snapshot. Right click on the parameter names in the bench and show in key Editor.

    If you must start over on a snapshot, click the parameter names in the bench and select Reset settings.

    HTH

  • Equium A300D: Software of the camera shows the last picture I took 6 months ago

    Hello

    Just started to use the built in camera on my Equium A300D after a long break (6 months). The software seems to work very well I see that it is in front of the camera in preview and everything seems good. However, when I press the snapshot button it shows the last picture I took 6 months ago. The video feature works very well!

    I uninstalled the software and installed the latest version but the problem remains.

    Any ideas?

    Ron

    Hello

    Sorry, but I really don't understand your problem.
    The last picture shows the cam that Vos took several months ago. And?
    It's a problem?

    I mean the image has been saved in the folder somewhere on the HARD drive and so you can see the photos, I guess that the images have not been removed and that's why they are still available.

    Is not a friend of the problem. Take a look in the webcam folder and delete the photos easy. Isn t it?

  • Satellite A300-15 has - black screen preview using the builtin camera

    I just bought a new computer laptop Toshiba Satellite, but built in camera is not working well.
    Whenever I open the camera assistant software, it shows me a black preview, but when I take a snapshot he takes the picture...

    I tried with msn and Skype, but it shows the black screen.
    I searched Toshiba forums and all the troubleshooting guides and impossible to find a solution to my problem.

    Help, please?

    Try to reinstall the webcam software.
    This should help you.

    Latest software for webcam can be downloaded from the page of European driver of Toshiba.

    Then remove the preinstalled software, restart the laptop and install the downloaded software.

    Good luck

  • How to save an imaq image starting from a continuous stream, like a snapshot

    Hello

    I spent hours trying to find a solution for this on the internet for what I think should be really simple:

    I have a camera that gives me a stream of images, which I show in a chart of the image.

    Now, when the user clicks a button 'save', I want that picture that was shown at the moment where the user was hit 'save' is recorded. However, the user is prompted for a file location and name, so some time passes between hitting 'save' and write the image to disk.

    Meanwhile, the new images will be at the position of the pointer in the image that I wanted to save.

    It is clear to me why this happens, but how about him?

    I tried to make a copy copy Imaq, but this will give me just a new pointer that is always related to the old.

    I tried to convert it to an array, the same effect.

    I also tried writing a queue that contains a single element that has a buffer of image. The queue was not in a loop (which of course would replace the picture there), but again, the queue also just seemed to save the position of the pointer, while creating a new blank image in advance and I copied the image that I want with Imaq copy in this image buffer.

    So, how to store the actual image (not pointer) in memory to save a few seconds later?

    Basically I want something similar to what does the 'snapshot' of the curve of the image function.

    Any ideas?

    Thank you very much!
    Philipp

    Hello

    Thank you very much.

    I consider your solution already, however, I thought it's kinda an overdose.

    For some reason any, I don't know, he now works as I wanted. See example below (really just, I always wanted a picture).

    The only difference from what I tried earlier, is that now I did not specify the data type and the size of the new image... do not know if this is the reason why it did not work.

    Uday thank you very much for your help!

    Philipp

    PS: How did you make the image you posted in your message visible? Mine is just a link.

  • 3.0.98 (2.1) camera problem: not shown on the big screen after taking photo

    It's strange to me that no one has noticed this earlier. Here's what's happening. When I take a picture, after the message "Capture."... "on the screen that will briefly dark, unlike in 1.5 (or any other phone or camera non-telephone), it is no more that 3-4 seconds while you can see the last picture taken. The captured image will immediately in the small tile in the corner of the screen. Whereas, on the backflip (even with the review of photo 1, 5), the last photo you see and the image that is actually taken can be very different, I see this as potentially troublesome for users. It is if they need to click on the thumbnail of each time they want to check if the picture is good because the thumbnail does not provide any information on sharpness.

    Someone else can also try to take a picture and check if this is the case for all phone?

    Not confirmed - there is no setting to photo review in camera and the photo taken just does not control when you take a picture.

    Edit: just looked at my original phone and it doesn't have a framework of control of the image, it just makes.

    I know that when I use my digital camera still disable the functionality of review when I need take snapshots of back to back quickly. A setting to turn this power would provide the best user experience.

  • Screenshot or image of the camera in front panel

    Im trying to take a snapshot of a CCD image in my front panel every time my program iterates. CCD image is updated of my camera which is connected online. Ideally, I want just to save an image in .jpg of this image of the camera of each iteration, but I can't do with the invoke node option. Any ideas?

    Is attached a screenshot of the front part, let me know if you need the real VI

    Hi Manderson13,

    Norbert is absolutely right that you can record images using the NI Vision software. What kind of camera you have, and how you currently gain to display images on your front? Documentation on how that here you can use our vision software to record images to the file.

    Thank you!

  • How to make still photos of my camera of Lenovo to the appropriate library to upload on a social networking site (Facebook, not)?

    First of all, I'm 50 years old and I grew up in the time before the PC, so I am very naïve.

    I have a laptop from Lenovo and it has a camera in it. I recently discovered that it can take still pictures, so I took some pictures of me.

    Now I want to download pictures to an online community, I belong to where I have a profile. But the photos are not in my images on Microsoft Word, or in Windows Media Player or any library I can find.  They are in the box in the photo section.  How can I get them on the part of the camera on the computer in a place where I can then download them to my profile online? Where should I store, and how to make them here?
    I appreciate your help.

    Hi James,

    I see you want to download photos of the Lenovo built in webcam for a social networking site still. I'll help you with this problem.

    1. what operating system is installed on the computer?

    2. what security software is installed on the computer?

    Please follow these steps and let us know the status.

    1 - click on "Start" and start the webcam software. Every computer manufacturer take its computers ready webcam with a specific software for the control of the camera.

    2 - Click on 'Snapshot' or 'Take picture' (or similar) in the program to capture still images. Most of the programs of webcam show you what see your webcam, as soon as the program is open. When you move, the webcam image also moves. Specific commands vary from one program to a program and manufacturer in the manufacturers, but the standard webcam software has a "snapshot" command to take a picture.

    3 - Click on 'Tools' and 'Settings' (once again, or similar) to change the way the webcam records still images. You can configure the quality of the photos up to a preset maximum resolution. A webcam software allows you to save a series of images or to add digital effects to the pictures. That depends on the camera photo and its software by default, too. While in the 'Settings' window, find out where the pictures are stored. Each program stores pictures in a different location.

    4 - Click 'Start' and 'Computer' to open a file browser. Find the folder where the webcam stores its photos of step 3 to change the photos with a graphics program or to delete and rename files. To send photos to your friends and family, open your email and attach photos to this folder. Webcams store photos in smaller resolutions, so you never get hurt to send these files as attachments, even with a very slow Internet connection.

    Let us know if you need assistance with any windows problem. We will be happy to help you.

  • Define the attributes of the camera in BD

    Hello

    There are a number of attributes in my camera that needs to be addressed while the camera is running.

    These attributes are available through 'Measurement and Automation Explorer' (for example 'Gain', please see the snapshot 1).

    Also some of them may be adjusted if the device is configured with the "Vision Acquisition Express" (please, see picture 2).

    My question is: how to define a particular attribute without having to use the "Vision Acquisition Express."

    Thanks in advance.

    Looks like you can set attributes of USB camera through two properties CameraAttributes.ActiveAttribute and CameraAttribute.Value as described in this knowledge base.

    http://digital.NI.com/public.nsf/allkb/E50864BB41B54D1E8625730100535E88

  • PCI-1422 and RS 232 control of a camera Hamamatsu ORCA-HR (HR C4742-95-12)

    Hello

    I'll have some incompatible problems when I try to control a camera Orca-HR (Hamamatsu C4742-95-12 HR) via RS232.

    I have a feeling that the problem comes from how the RS232 port emmbedded (emulated?) in the PCI-1422 is used or recognized by the various software that I've tested.

    So first, this port emulated/integrated should appear in the series, Max & list parallel port? I don't think, but he's not here, that's for sure. I have 'only' the projection of card PCI-1422.

    Case where I can access some of the attributes (accessible from limited functionality) camera:

    -By MAX I can change some settings so the snapshots of controller and make.

    -I can access these functions by IMAQ ('IMAQ camera set attributes.vi', etc. see Appendix vi example).

    -J' have a full control of the camera via the Hamamatsu Hipic 8.0 software, but only if I use the internal drivers and a different com port than those incorporated in the card PCI-1422 (Hipic offers not only port com in any case perhaps because there is no by saying?)

    Case where I can't access the camera at all:

    -If I try to use VI to a Hamamatsu (the most recent in sample screws & DLL or older version), it does not work: calls to any function of the 'tmcamcon.dll' return errors, pointing to the fact that there is no camera detected: the first sub_Vi (tm_initialize.vi) will return no error but zero connected camera and other screws return errors saying there is no camera using this handle, or no camera can be activated at using this handle.

    -I have NO camera control via the Hamamatsu Hipic 8.0 software if I use the DCAM API drivers no matter what com port (incorporated in the card PCI-1422 or other).

    Does make any sense to you?

    I just thought that the Hamamatsu screws cannot access the camera via emulation RS-232 of the PCI-1422. Is there a configuration setting, that I could use to those who do work and do not have to restart from scratch with IMAQ and with only limited functionality?

    Thanks in advance for your answers.

    Hello

    In fact, you can have access to the serial port integrated on the PCI-1422 map only with IMAQ functions.

    This explains that you cannot see in the section "Series and parallel" in MAX.

    I have not really well know PCI-1422, but there's probably a way to access the serial port on the card PCI-1422 in MAX.

    Camera attributes, you are able to access with IMAQ, y then the camera assigns the has camera driver.

    If you are able to access more attributes with Hamamatsu driver, it is the manufacturer who decided to restricted access to other drivers.

    But if you are not able to use the screw manufacturer, you should probably call him to find out why it works badly. Perhaps a version control problem or a update of the firmware?

  • big blur on dvd still snapshots

    Running XP Pro on laptop Lenovo X 60

    I have vob on hard drive files. To use Windows Movie Maker, I had to modify the extension to .mpg. When I play the movie, then go to freeze or even create a snapshot of executives he always fuzzy. It's NOT blur of camera movement. When you play the movie, there is no blur. When you stop it or you try to save an image, it is blurred in the picture. He goes in and out of blur. I also tried Media Player Classic. It seems that it is taking several images and combining them maybe. I tried searching for accelerators or some kind of interlacing to turn off. Does not work so far. I don't see a response through google.

    Running XP Pro on laptop Lenovo X 60

    I have vob on hard drive files. To use Windows Movie Maker, I had to modify the extension to .mpg. When I play the movie, then go to freeze or even create a snapshot of executives he always fuzzy. It's NOT blur of camera movement. When you play the movie, there is no blur. When you stop it or you try to save an image, it is blurred in the picture. He goes in and out of blur. I also tried Media Player Classic. It seems that it is taking several images and combining them maybe. I tried searching for accelerators or some kind of interlacing to turn off. Does not work so far. I don't see a response through google.

    =================================
    Fact is... video captures are never as strong as always
    a good digital camea coups.

    Try to make your freeware screen capture
    VLC Media Player. (FWIW, it can also record segments
    video... See article below)

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    VLC Media Player
    http://www.videolan.org/

    For the installer for your screen Capture... Open VLC and
    Reach... Tools / Preferences / video button / video
    Instant image section.

    In the directory field... Search for and select a folder
    to save your captures po (for example... you could
    Create a new folder on your desktop and select)

    TO... Prefix... check the box... Sequential numbering.

    TO... Format, choose JPEG or PNG.

    Finally... on the left, click on the Save"" button.

    Now... Play the video and pause by pressing on your
    SPACEBAR when you see a screen you want to capture.

    To capture the screen... type...  SHIFT + S

    Press space to advance to the next photo...
    ect... etc...

    VLC 1.0 records video of the DVD
    http://Lifehacker.com/5318807/VLC-10-records-video-from-DVDs

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

Maybe you are looking for

  • Why Flash player crash with the edition instentally developer of Firefox?

    So I use the most resent the Developer Edition of Firefox and Flash Player seems to hang as soon as it is trying to load any flash element. I tried everything I can, relocations and others without success. The only thing I have not done is disable ha

  • PGIA

    Hello I acquire a signal using USB-6281, which comes with a programmable gain. I wanted to know how to change the gain. I looked in the DAQmx help channel that I can put AI Max and Min. Is the gain set when I change these values? Thank you Navi

  • Windows XP works offline error

    When I connect my computer at work, I get an error saying "work offline". I'm online (it's a desktop computer) and none of my network drives work until I "sync now". Then everything works fine.  But what is happening daily.  Just me, no one else. It

  • Computer background and icons problem

    The background and the icons on the screen of my computer changed to offshore and the greatest by itself after the uninstall, it looks like a 'big boy' and very strange.  I don't know how to chang, this return to normal.  I would really appreciate if

  • WordPad exe-application error - the application failed inialize correctly 0xc000007b

    WordPad does not print