Move a jpeg image within a picture control

I am having problems moving a jpeg image inside a picture control with my arrow buttons.
any help would be great thanks
Harold Timmis
[email protected]
Orlando,Fl
*Kudos always welcome
Solved!
Go to Solution.
Attachments:
picfun.vi ‏17 KB
ball.jpg ‏2 KB

Hi Harold,
Things are hooked up wrong....
(Also, you don't really want to read the same file with each repeat. Once is enough! )
LabVIEW Champion . Do more with less code and in less time .
Attachments:
picfunMOD.vi ‏13 KB

Similar Messages

  • How can I Manually Insert an Image into a Picture Control?

    Hi,
            I am able to insert an image programmatically into a picture control. But I want to insert an image into the picture control without any code that is manually. How can I Do that?
    Thanks in Advance
    Regars,
    Malleswari

    malli wrote:
    Hi,
            I am able to insert an image programmatically into a picture control. But I want to insert an image into the picture control without any code that is manually. How can I Do that?
    Thanks in Advance
    Regars,
    Malleswari
     You may also drag and drop a picture directly to your front panel. You can also use paint, or some other tools,  to copy a part of a picture and past it into your front panel. This actually works for the block diagram also. Se example 
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)
    Attachments:
    pic example.vi ‏157 KB

  • Scaling JPEGs to fit into picture control

    Hallo NG,
    I have a frontpanel with a fixed sized picture-control where I want to
    display a JPEG-Image.
    I use the ReadJPEG and DrawFlattenedPixmap to display. Now, if my JPEG is of
    bigger size than my picture control, the rest of the image gets clipped.
    How can I scale a JPEG image to fit it into the control. If the control and
    the image have different aspect ratios, that's OK, I could scale it down
    with fixed ratio, and leave parts of the control blank.
    So again: How can I scale the images, is it possible with those two VIs
    mentioned above or do I have to make it more low-level and complex ?
    Oliver

    A solution I prefer to use involves .NET and a GDI Resize, this method supports many file formats, and bit depths, and seems pretty quick when .NET can be used.
    http://forums.ni.com/t5/LabVIEW/Net-image-resize-how-to-convert-to-format-labview-can-use/m-p/219902...
    I used it in my quick drop show VIs, to scale VI icons to fill the window size.
    https://decibel.ni.com/content/docs/DOC-31302
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • PDA example: Reading a jpeg file into a picture control

    Hi
    Does anybody have a simple PDA example of how to read a .jpg file and show it in a picture control. The jpg examples I've found does not compile for PDA.

    Evan wrote in message news:<[email protected]>...
    > In LabVIEW for windows there are VIs to read in JPEGs, however the PDA
    > module does not support those VIs, so I do not believe there is a way
    > to display JPEGs.
    The hard way would be to write your own JPEG -> Bitmap / Array
    de-compression routine. You will probably find example (C++) code at
    the JPEG web site.
    http://www.jpeg.org/jpeg_about.html

  • How limit the movement of the slider within the picture?

    Hi Guys,
    I have a before/after slider but divider is moving outside the image. How can i fix this - stop the slider near right and left border of the image?
    Any ideas?
    Many thanks!

    I'm nor sure what you used to zip your files..
    I can open WinRAR files and regular zip files on my pc but when I try to download your file it does not look like what you show in pic.
    This is what I see:

  • How to get a jpeg image to a movie with best possible quality

    I've got a jpeg image from my 2 megapixel digital camera and I'm playing around with converting it to a movie. Yes, its a one image movie.
    +QuickTime Pro+ does a superb job when I choose H.264, 1024 kb/s, but I can't get iMovie 5.0.2 to give me the same quality. This is what I have done:
    1. Create a new movie as type MPEG-4.
    2. Imported the jpeg image and adjust the time from 5 seconds to about 2 seconds.
    3. Select Share, choose H.264, 1024 kb/s from the relevant option and after the movie making happens, the quality is obviously inferior to that from +QT Pro+.
    *QUES 1*: Why is the quality inferior?
    I have been to iMovie help and noticed this comment:
    "When you import clips in a format different from your project, they are converted to the video format of your movie."
    *QUES 2*: Is this why my jpeg image is losing quality? Is iMovie converting it to something else?
    Further, when the jpeg image is first imported, it is assigned a clip time of 5 seconds. When I move one of the sliders to reduce the time to just a few seconds, I notice that a black band appears at the top of the image in the iMovie window and as I make the time smaller, the image zooms in and the black band becomes wider. Letterboxing at the top seems to be occuring. This I can't fathom.
    *QUES 3*: Why does iMovie zoom in when I adjust time?
    Any comments most appreciated, especially those that tell me if iMovie can make a movie from jpeg images with the same quality as QT Pro -- and how to do that.

    Re the quality -- I think I have answered this one myself. Correct me if I'm wrong, but it seems to me that when I select a video option (DV, HD 1080 and so on), iMovie sets up a frame size to suit, and the frame size that iMovie sets up for MPEG-4 happens to be 640 x 480, thus the poor quality of my jpegs when I selected that option. The poor quality had nothing to do with the MPEG-4 format.
    Now the interesting things is, MPEG-4 is not limited to 640 x 480. It can be any size. So my question is:
    Ques: Can I set up a movie within iMovie that is any size I want? QT Pro gave better results because it allows any size movie at all, and thus adjusted the movie size to my jpeg size (1800 x 1200 pixels) when I imported an image from my digital camera.
    As it stands, not even the highest quality option in +iMovie 5.0.2+ (HD 1080) can handle the images from my piddly-little 2 megapixel camera.
    Message was edited by: Guy Burns

  • How do I get picture control to display PNG images with transparent background?

    I have an image of a robot arm looking from the top with a transparent background and saved as PNG. When I drag the image directly to LabVIEW front panel, the image shows properly with the transparent background, but I want to manipulate it such as rotate the image. I used the Read from PNG.vi to read the image to a picture control, but the background isn't transparent anymore. Am I missing something?
    Please help.

    unclebump gets 5 stars for referring you to a document that I wrote. 
    Incidentally, I wrote it years back, for LabVIEW 7.0.  A couple of notes to summarize:
    The picture control doesn't "really" support transparency.  However, the image data type supports masking, and stores the alpha channel, if present in your image data.  So you use the "Create Mask By Alpha.vi" referenced in that document to mask out pixels whose transparency is above a certain level.  It does not support partial transparency.  You could try to implement your own blending algorithm based on the picture control's current pixel values, and the image data's RGB value and transparency value, but it would probably be very slow.
    Also, that VI ships with 8.0 and later.  I don't know if it's on the palettes but it lives here:  vi.lib\picture\picture.llb\Create Mask By Alpha.vi
    Good luck!

  • Movies To JPEG

    Is there anyway of using the jmf api to extract all frames of an input movie to jpeg images (i.e. without using the robot class)?

    I copied the code for DataSourceReader exactly and made the changes mentioned in this forum. However, my code only captures the first frame of the movie and makes 17 jpg copies of it. How do you make it capture every frame of the movie and make jpg copies of each one?
    Here is my code:
    import java.awt.*;
    import java.io.*;
    import java.util.*;
    import javax.media.*;
    import javax.media.format.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.datasink.*;
    import javax.media.control.MonitorControl;
    import javax.media.control.*;
    import javax.media.util.*;
    import java.awt.image.*;
    import javax.imageio.*;
    import javax.imageio.stream.*;
    * Sample program to read data from an output DataSource of a Processor.
    public class DataSourceReader
    extends Frame
    implements ControllerListener, DataSinkListener {
    Processor p;
    Object waitSync = new Object();
    boolean stateTransitionOK = true;
    static boolean monitorOn = false;
    * Given a DataSource, create a processor and hook up the output
    * DataSource from the processor to a customed DataSink.
    public boolean open(DataSource ds) {
    System.err.println("create processor for: " + ds.getContentType());
    if (monitorOn) {
    // If monitoring is on, we'd like to enable synchronization
    // by enabling the use of the RawSyncBufferMux. The default
    // is RawBufferMux which does not perform sychronization.
    enableSyncMux();
    try {
    p = Manager.createProcessor(ds);
    catch (Exception e) {
    System.err.println(
    "Failed to create a processor from the given DataSource: " + e);
    return false;
    p.addControllerListener(this);
    // Put the Processor into configured state.
    p.configure();
    if (!waitForState(p.Configured)) {
    System.err.println("Failed to configure the processor.");
    return false;
    // Get the raw output from the processor.
    p.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW));
    TrackControl tc[] = p.getTrackControls();
    for (int i = 0; i < tc.length; i++) {
    if (tc.getFormat()instanceof VideoFormat) {
    tc[i].setFormat(new VideoFormat(VideoFormat.RGB));
    else {
    tc[i].setEnabled(false);
    p.realize();
    if (!waitForState(p.Realized)) {
    System.err.println("Failed to realize the processor.");
    return false;
    // Get the output DataSource from the processor and
    // hook it up to the DataSourceHandler.
    DataSource ods = p.getDataOutput();
    DataSourceHandler handler = new DataSourceHandler();
    try {
    handler.setSource(ods);
    catch (IncompatibleSourceException e) {
    System.err.println(
    "Cannot handle the output DataSource from the processor: " + ods);
    return false;
    handler.addDataSinkListener(this);
    handler.start();
    // Prefetch the processor.
    p.prefetch();
    if (!waitForState(p.Prefetched)) {
    System.err.println("Failed to prefetch the processor.");
    return false;
    if (monitorOn) {
    // If monitor is on, try to obtain any monitor controls
    // from the processor and display them.
    setLayout(new BorderLayout());
    Control controls[] = p.getControls();
    Panel monitorPanel = null;
    Component monitorComp = null;
    for (int i = 0; i < controls.length; i++) {
    if (controls[i] instanceof MonitorControl) {
    MonitorControl mc = (MonitorControl) controls[i];
    monitorComp = mc.getControlComponent();
    if (monitorPanel == null) {
    monitorPanel = new Panel();
    monitorPanel.setLayout(new GridLayout(0, 1));
    if (monitorComp != null) {
    monitorPanel.add(monitorComp);
    mc.setEnabled(true);
    if (monitorPanel != null) {
    add("Center", monitorPanel);
    // Display the processor's control component.
    Component cc;
    if ( (cc = p.getControlPanelComponent()) != null) {
    add("South", cc);
    // Start the processor.
    p.start();
    setVisible(true);
    return true;
    public void addNotify() {
    super.addNotify();
    pack();
    * Change the plugin list to disable the default RawBufferMux
    * thus allowing the RawSyncBufferMux to be used.
    * This is a handy trick. You wouldn't know this, would you? :)
    void enableSyncMux() {
    Vector muxes = PlugInManager.getPlugInList(null, null,
    PlugInManager.MULTIPLEXER);
    for (int i = 0; i < muxes.size(); i++) {
    String cname = (String) muxes.elementAt(i);
    if (cname.equals("com.sun.media.multiplexer.RawBufferMux")) {
    muxes.removeElementAt(i);
    break;
    PlugInManager.setPlugInList(muxes, PlugInManager.MULTIPLEXER);
    * Block until the processor has transitioned to the given state.
    * Return false if the transition failed.
    boolean waitForState(int state) {
    synchronized (waitSync) {
    try {
    while (p.getState() < state && stateTransitionOK) {
    waitSync.wait();
    catch (Exception e) {}
    return stateTransitionOK;
    * Controller Listener.
    public void controllerUpdate(ControllerEvent evt) {
    if (evt instanceof ConfigureCompleteEvent ||
    evt instanceof RealizeCompleteEvent ||
    evt instanceof PrefetchCompleteEvent) {
    synchronized (waitSync) {
    stateTransitionOK = true;
    waitSync.notifyAll();
    else if (evt instanceof ResourceUnavailableEvent) {
    synchronized (waitSync) {
    stateTransitionOK = false;
    waitSync.notifyAll();
    else if (evt instanceof EndOfMediaEvent) {
    p.close();
    else if (evt instanceof SizeChangeEvent) {
    * DataSink Listener
    public void dataSinkUpdate(DataSinkEvent evt) {
    if (evt instanceof EndOfStreamEvent) {
    System.err.println("All done!");
    evt.getSourceDataSink().close();
    System.exit(0);
    * Inner class
    * This DataSourceHandler class reads from a DataSource and display
    * information of each frame of data received.
    class DataSourceHandler
    implements DataSink, BufferTransferHandler {
    DataSource source;
    PullBufferStream pullStrms[] = null;
    PushBufferStream pushStrms[] = null;
    // Data sink listeners.
    private Vector listeners = new Vector(1);
    // Stored all the streams that are not yet finished (i.e. EOM
    // has not been received.
    SourceStream unfinishedStrms[] = null;
    // Loop threads to pull data from a PullBufferDataSource.
    // There is one thread per each PullSourceStream.
    Loop loops[] = null;
    Buffer readBuffer;
    * Sets the media source this <code>MediaHandler</code>
    * should use to obtain content.
    public void setSource(DataSource source) throws IncompatibleSourceException {
    // Different types of DataSources need to handled differently.
    if (source instanceof PushBufferDataSource) {
    pushStrms = ( (PushBufferDataSource) source).getStreams();
    unfinishedStrms = new SourceStream[pushStrms.length];
    // Set the transfer handler to receive pushed data from
    // the push DataSource.
    for (int i = 0; i < pushStrms.length; i++) {
    pushStrms[i].setTransferHandler(this);
    unfinishedStrms[i] = pushStrms[i];
    else if (source instanceof PullBufferDataSource) {
    pullStrms = ( (PullBufferDataSource) source).getStreams();
    unfinishedStrms = new SourceStream[pullStrms.length];
    // For pull data sources, we'll start a thread per
    // stream to pull data from the source.
    loops = new Loop[pullStrms.length];
    for (int i = 0; i < pullStrms.length; i++) {
    loops[i] = new Loop(this, pullStrms[i]);
    unfinishedStrms[i] = pullStrms[i];
    else {
    // This handler only handles push or pull buffer datasource.
    throw new IncompatibleSourceException();
    this.source = source;
    readBuffer = new Buffer();
    * For completeness, DataSink's require this method.
    * But we don't need it.
    public void setOutputLocator(MediaLocator ml) {
    public MediaLocator getOutputLocator() {
    return null;
    public String getContentType() {
    return source.getContentType();
    * Our DataSink does not need to be opened.
    public void open() {
    public void start() {
    try {
    source.start();
    catch (IOException e) {
    System.err.println(e);
    // Start the processing loop if we are dealing with a
    // PullBufferDataSource.
    if (loops != null) {
    for (int i = 0; i < loops.length; i++) {
    loops[i].restart();
    public void stop() {
    try {
    source.stop();
    catch (IOException e) {
    System.err.println(e);
    // Start the processing loop if we are dealing with a
    // PullBufferDataSource.
    if (loops != null) {
    for (int i = 0; i < loops.length; i++) {
    loops[i].pause();
    public void close() {
    stop();
    if (loops != null) {
    for (int i = 0; i < loops.length; i++) {
    loops[i].kill();
    public void addDataSinkListener(DataSinkListener dsl) {
    if (dsl != null) {
    if (!listeners.contains(dsl)) {
    listeners.addElement(dsl);
    public void removeDataSinkListener(DataSinkListener dsl) {
    if (dsl != null) {
    listeners.removeElement(dsl);
    protected void sendEvent(DataSinkEvent event) {
    if (!listeners.isEmpty()) {
    synchronized (listeners) {
    Enumeration list = listeners.elements();
    while (list.hasMoreElements()) {
    DataSinkListener listener =
    (DataSinkListener) list.nextElement();
    listener.dataSinkUpdate(event);
    * This will get called when there's data pushed from the
    * PushBufferDataSource.
    public void transferData(PushBufferStream stream) {
    try {
    stream.read(readBuffer);
    catch (IOException e) {
    System.err.println(e);
    sendEvent(new DataSinkErrorEvent(this, e.getMessage()));
    return;
    printDataInfo(readBuffer);
    // Check to see if we are done with all the streams.
    if (readBuffer.isEOM() && checkDone(stream)) {
    sendEvent(new EndOfStreamEvent(this));
    * This is called from the Loop thread to pull data from
    * the PullBufferStream.
    public boolean readPullData(PullBufferStream stream) {
    try {
    stream.read(readBuffer);
    catch (IOException e) {
    System.err.println(e);
    return true;
    printDataInfo(readBuffer);
    if (readBuffer.isEOM()) {
    // Check to see if we are done with all the streams.
    if (checkDone(stream)) {
    System.err.println("All done!");
    close();
    return true;
    return false;
    * Check to see if all the streams are processed.
    public boolean checkDone(SourceStream strm) {
    boolean done = true;
    for (int i = 0; i < unfinishedStrms.length; i++) {
    if (strm == unfinishedStrms[i]) {
    unfinishedStrms[i] = null;
    else if (unfinishedStrms[i] != null) {
    // There's at least one stream that's not done.
    done = false;
    return done;
    void printDataInfo(Buffer buffer) {
    //System.err.println("Read from stream: " + stream);
    if (buffer.getFormat()instanceof AudioFormat) {
    System.err.println("Read audio data:");
    else {
    System.err.println("Read video data:");
    System.err.println(" Time stamp: " + buffer.getTimeStamp());
    System.err.println(" Sequence #: " + buffer.getSequenceNumber());
    System.err.println(" Data length: " + buffer.getLength());
    BufferToImage bufferToImage = new BufferToImage( (VideoFormat) buffer.
    getFormat());
    Image image = bufferToImage.createImage(buffer);
    try {
    BufferedImage outImage = new BufferedImage(400, 300,
    BufferedImage.TYPE_INT_RGB);
    Graphics og = outImage.getGraphics();
    og.drawImage(image, 0, 0, 400, 300, null);
    //prepareImage(outImage,rheight,rheight, null);
    Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
    ImageWriter writer = (ImageWriter) writers.next();
    //Once an ImageWriter has been obtained, its destination must be set to an ImageOutputStream:
    File f = new File(buffer.getSequenceNumber() + ".jpg");
    ImageOutputStream ios = ImageIO.createImageOutputStream(f);
    writer.setOutput(ios);
    //Finally, the image may be written to the output stream:
    //BufferedImage bi;
    //writer.write(imagebi);
    writer.write(outImage);
    ios.close();
    catch (IOException e) {
    System.out.println("Error :" + e);
    if (buffer.isEOM()) {
    System.err.println(" Got EOM!");
    public Object[] getControls() {
    return new Object[0];
    public Object getControl(String name) {
    return null;
    * A thread class to implement a processing loop.
    * This loop reads data from a PullBufferDataSource.
    class Loop
    extends Thread {
    DataSourceHandler handler;
    PullBufferStream stream;
    boolean paused = true;
    boolean killed = false;
    public Loop(DataSourceHandler handler, PullBufferStream stream) {
    this.handler = handler;
    this.stream = stream;
    start();
    public synchronized void restart() {
    paused = false;
    notify();
    * This is the correct way to pause a thread; unlike suspend.
    public synchronized void pause() {
    paused = true;
    * This is the correct way to kill a thread; unlike stop.
    public synchronized void kill() {
    killed = true;
    notify();
    * This is the processing loop to pull data from a
    * PullBufferDataSource.
    public void run() {
    while (!killed) {
    try {
    while (paused && !killed) {
    wait();
    catch (InterruptedException e) {}
    if (!killed) {
    boolean done = handler.readPullData(stream);
    if (done) {
    pause();
    * Main program
    public static void main(String[] args) {
    if (args.length == 0) {
    prUsage();
    System.exit(0);
    // Parse the arguments.
    int i = 0;
    String inputURL = null;
    while (i < args.length) {
    if (args[i].equals("-monitor")) {
    monitorOn = true;
    } else {
    inputURL = args[i];
    i++;
    if (inputURL == null) {
    System.err.println("No input url is specified");
    prUsage();
    MediaLocator ml;
    if ( (ml = new MediaLocator(inputURL)) == null) {
    System.err.println("Cannot build media locator from: " + inputURL);
    prUsage();
    System.exit(0);
    DataSource ds = null;
    // Create a DataSource given the media locator.
    try {
    ds = Manager.createDataSource(ml);
    catch (Exception e) {
    System.err.println("Cannot create DataSource from: " + ml);
    System.exit(0);
    DataSourceReader dsr = new DataSourceReader();
    if (!dsr.open(ds)) {
    System.exit(0);
    static void prUsage() {
    System.err.println("Usage: java DataSourceReader [-monitor] <url>");

  • Lose Jpeg images when editing an existing PDF Form in Acrobat X - All other edits update OK

    Have just upgraded to Acrobat X and am having problems trying to update an existing PDF Form which includes jpeg images.    After all edits are done and I save, previewing the PDF identifies that all of the existing jpeg images within the form no longer display.  Unable to figure out what to do to retain these images from the existing PDF.

    Hi,
    Based on your other post, the original form was developed in LiveCycle Designer. Therefore you would need to edit the form in LC Designer, to reestablish the link to the image files.
    Niall

  • Moving images within Grid View in LR3beta2

    Frustrated. In LR3Beta1 I could manually move and place images within Grid View or from the slide view at bottom for purposes of sorting "similar subject" content within a specified Text/Attribute naming. All of this was accomplished from the Parent folder, with no need for drilling down the Tree.
    Now, since installing LR3Beta2 I can no longer manually move (sort) within Grid View...unless I am in the lower most folder of the tree. This change is not practical since a tree folder may not match the relevance of my specified Text/Attributes.
    Can anyone tell me what I may be doing wrong, or is the ability to manually sort from Parent folder no longer an option?

    Here's an example of how I catalog/label/sort my images...
    Architectural images project - 3 locations of shootng, 4 areas of focus: Doors, Windows, Facades, Walls
    So, I may have 20 images w/both a door and a facade in the shot, 20 images with a window and a door, etc. I prefer to Keyword all of the images as Architectural, and then Keyword those applicable to Doors, Windows, Facades, Walls, etc.
    Now, suppose those all go into a folder labeled Architecture.
    The next week I get an assignment for Urban settings. It may include shops, churches, etc. However, within those, I decide to Keyword (where appropriate) Doors, Windows, Churches, Shops, etc. That project goes into a folder labeled Urban Settings.
    Now, let's say I have a request specifically for "Doors". Now, those Doors are spread across multiple folders at this point so I have no opportunity to manually sort all of the doors my similar content if they fall into multiple folders. Doesn't matter that I have pulled up Doors through Text, I still cannot sort them by similar style, shape, color, etc since they are spread across multiple folders.
    In the 1st beta, I could slice and dice a hundred ways to arrive at a final view and then...sort those so that they always appeared that way whenever I called them up again. Didn't matter that they were in multiple folders. That was extremely useful and...sweet.
    Any ideas?

  • View Aquired Image in a Tab control

    In order to conserve space I would like to view a live image, aquired from a 1409 board,in a page of a tab control. Also to decrease cpu usage I have set up a Low Level ring. I have tried sending the image to a picture control, but the image is choppy (even if I slow down the loop). My image is perfect in a Vision Window, but this cannot be used as a control on a page. Any suggestions?

    Terry,
    Bruce has the right idea, try making a child panel and use WindShow to hide or show the display....Attached is an example I wrote using multiple boards and displaying two images on the pages of a tab control...I hope this helps.
    Best Regards,
    Chris D
    NI Applications Engineer
    Attachments:
    IMAQ_Grab_in_Tab_Control_2.vi ‏126 KB

  • Iplimage to picture control

    Dear Guys,
    While integration of opencv libraries in LabVIEW i had struck with this.. I can able to display the processed images in the window handle. i want to display it on the same iplimage(opencv image) to .NET Picture control or LabVIEW Picture in the front panel.. How can i do this. Can someone help me to sort out this issue...
    Waiting for your reply.
    Sasi.
    Certified LabVIEW Associate Developer
    If you can DREAM it, You can DO it - Walt Disney

    Hi
     You can convert IplImage to Bitmap image to show in .Net Control or Convert IplImage to 2D array to display on to the Picture control of labview.
    May this code will help you .
    #include "extcode.h"
    #include "cv.h" //main OpenCV header
    #include "highgui.h" //GUI header
    #pragma pack(1)
    /*typedef struct {
    uint8_t v1;
    uint8_t v2;
    uint8_t v3;
    } TD2;
    typedef struct {
    int32_t dimSizes[2];
    TD2 Cluster[1];
    } TD1;
    typedef TD1 **TD1Hdl;*/
    typedef struct
    char status;
    int code;
    uChar *source;
    } er;
    typedef struct {
    int32_t dimSizes[2];
    uint32_t elt[1];
    } TD1;
    typedef TD1 **TD1Hdl;
    #include "lv_epilog.h"
    #pragma pack()
    _declspec(dllexport) void ColorImageToRGBHexArray( IplImage*a,TD1Hdl Pt,er *error);
    _declspec(dllexport) void ColorImageToRGBHexArray( IplImage*a,TD1Hdl Pt,er *error)
    if (!a)
    error->code =-10002;
    error->status=TRUE;
    if (error->source == NULL)
    error->code =1234;
    else
    else
    if (a->nChannels == 3)
    int R,G,B;
    int i;
    int j;
    for(i=0;i<(a->height); i++)
    for(j=0;j<(a->width);j++)
    B=((uchar *)(a->imageData + i*a->widthStep))[j*a->nChannels + 0];
    G =((uchar *)(a->imageData + i*a->widthStep))[j*a->nChannels + 1];
    R =((uchar *)(a->imageData + i*a->widthStep))[j*a->nChannels + 2];
    (*Pt)->elt[i*a->width +j] = R*65536 +G*256 +B;
    else
    error->code =-10003;
    error->status=TRUE;
    Warm Regard
    Orooj Ahmed

  • Problem while executing the code( that covert jpeg images to movie)

    http://java.sun.com/products/java-media/jmf/2.1.1/solutions/JpegImagesToMovie.html
    here is the code:
    * @(#)JpegImagesToMovie.java     1.3 01/03/13
    * Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
    * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
    * modify and redistribute this software in source and binary code form,
    * provided that i) this copyright notice and license appear on all copies of
    * the software; and ii) Licensee does not utilize the software in a manner
    * which is disparaging to Sun.
    * This software is provided "AS IS," without a warranty of any kind. ALL
    * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
    * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
    * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
    * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
    * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
    * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
    * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
    * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
    * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
    * POSSIBILITY OF SUCH DAMAGES.
    * This software is not designed or intended for use in on-line control of
    * aircraft, air traffic, aircraft navigation or aircraft communications; or in
    * the design, construction, operation or maintenance of any nuclear
    * facility. Licensee represents and warrants that it will not use or
    * redistribute the Software for such purposes.
    import java.io.*;
    import java.util.*;
    import java.awt.Dimension;
    import javax.media.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.datasink.*;
    import javax.media.format.VideoFormat;
    * This program takes a list of JPEG image files and convert them into
    * a QuickTime movie.
    public class JpegImagesToMovie3 implements ControllerListener, DataSinkListener {
    public boolean doIt(int width, int height, int frameRate, Vector inFiles, MediaLocator outML) {
         ImageDataSource ids = new ImageDataSource(width, height, frameRate, inFiles);
         Processor p;
         try {
         System.err.println("- create processor for the image datasource ...");
         p = Manager.createProcessor(ids);
         } catch (Exception e) {
         System.err.println("Yikes! Cannot create a processor from the data source.");
         return false;
         p.addControllerListener(this);
         // Put the Processor into configured state so we can set
         // some processing options on the processor.
         p.configure();
         if (!waitForState(p, p.Configured)) {
         System.err.println("Failed to configure the processor.");
         return false;
         // Set the output content descriptor to QuickTime.
         p.setContentDescriptor(new ContentDescriptor(FileTypeDescriptor.QUICKTIME));
         // Query for the processor for supported formats.
         // Then set it on the processor.
         TrackControl tcs[] = p.getTrackControls();
         Format f[] = tcs[0].getSupportedFormats();
         if (f == null || f.length <= 0) {
         System.err.println("The mux does not support the input format: " + tcs[0].getFormat());
         return false;
         tcs[0].setFormat(f[0]);
         System.err.println("Setting the track format to: " + f[0]);
         // We are done with programming the processor. Let's just
         // realize it.
         p.realize();
         if (!waitForState(p, p.Realized)) {
         System.err.println("Failed to realize the processor.");
         return false;
         // Now, we'll need to create a DataSink.
         DataSink dsink;
         if ((dsink = createDataSink(p, outML)) == null) {
         System.err.println("Failed to create a DataSink for the given output MediaLocator: " + outML);
         return false;
         dsink.addDataSinkListener(this);
         fileDone = false;
         System.err.println("start processing...");
         // OK, we can now start the actual transcoding.
         try {
         p.start();
         dsink.start();
         } catch (IOException e) {
         System.err.println("IO error during processing");
         return false;
         // Wait for EndOfStream event.
         waitForFileDone();
         // Cleanup.
         try {
         dsink.close();
         } catch (Exception e) {}
         p.removeControllerListener(this);
         System.err.println("...done processing.");
         return true;
    * Create the DataSink.
    DataSink createDataSink(Processor p, MediaLocator outML) {
         DataSource ds;
         if ((ds = p.getDataOutput()) == null) {
         System.err.println("Something is really wrong: the processor does not have an output DataSource");
         return null;
         DataSink dsink;
         try {
         System.err.println("- create DataSink for: " + outML);
         dsink = Manager.createDataSink(ds, outML);
         dsink.open();
         } catch (Exception e) {
         System.err.println("Cannot create the DataSink: " + e);
         return null;
         return dsink;
    Object waitSync = new Object();
    boolean stateTransitionOK = true;
    * Block until the processor has transitioned to the given state.
    * Return false if the transition failed.
    boolean waitForState(Processor p, int state) {
         synchronized (waitSync) {
         try {
              while (p.getState() < state && stateTransitionOK)
              waitSync.wait();
         } catch (Exception e) {}
         return stateTransitionOK;
    * Controller Listener.
    public void controllerUpdate(ControllerEvent evt) {
         if (evt instanceof ConfigureCompleteEvent ||
         evt instanceof RealizeCompleteEvent ||
         evt instanceof PrefetchCompleteEvent) {
         synchronized (waitSync) {
              stateTransitionOK = true;
              waitSync.notifyAll();
         } else if (evt instanceof ResourceUnavailableEvent) {
         synchronized (waitSync) {
              stateTransitionOK = false;
              waitSync.notifyAll();
         } else if (evt instanceof EndOfMediaEvent) {
         evt.getSourceController().stop();
         evt.getSourceController().close();
    Object waitFileSync = new Object();
    boolean fileDone = false;
    boolean fileSuccess = true;
    * Block until file writing is done.
    boolean waitForFileDone() {
         synchronized (waitFileSync) {
         try {
              while (!fileDone)
              waitFileSync.wait();
         } catch (Exception e) {}
         return fileSuccess;
    * Event handler for the file writer.
    public void dataSinkUpdate(DataSinkEvent evt) {
         if (evt instanceof EndOfStreamEvent) {
         synchronized (waitFileSync) {
              fileDone = true;
              waitFileSync.notifyAll();
         } else if (evt instanceof DataSinkErrorEvent) {
         synchronized (waitFileSync) {
              fileDone = true;
              fileSuccess = false;
              waitFileSync.notifyAll();
    public static void main(String args[]) {
         if (args.length == 0)
         prUsage();
         // Parse the arguments.
         int i = 0;
         int width = -1, height = -1, frameRate = 1;
         Vector inputFiles = new Vector();
         String outputURL = null;
         while (i < args.length) {
         if (args.equals("-w")) {
              i++;
              if (i >= args.length)
              prUsage();
              width = new Integer(args[i]).intValue();
         } else if (args[i].equals("-h")) {
              i++;
              if (i >= args.length)
              prUsage();
              height = new Integer(args[i]).intValue();
         } else if (args[i].equals("-f")) {
              i++;
              if (i >= args.length)
              prUsage();
              frameRate = new Integer(args[i]).intValue();
         } else if (args[i].equals("-o")) {
              i++;
              if (i >= args.length)
              prUsage();
              outputURL = args[i];
         } else {
              inputFiles.addElement(args[i]);
         i++;
         if (outputURL == null || inputFiles.size() == 0)
         prUsage();
         // Check for output file extension.
         if (!outputURL.endsWith(".mov") && !outputURL.endsWith(".MOV")) {
         System.err.println("The output file extension should end with a .mov extension");
         prUsage();
         if (width < 0 || height < 0) {
         System.err.println("Please specify the correct image size.");
         prUsage();
         // Check the frame rate.
         if (frameRate < 1)
         frameRate = 1;
         // Generate the output media locators.
         MediaLocator oml;
         if ((oml = createMediaLocator(outputURL)) == null) {
         System.err.println("Cannot build media locator from: " + outputURL);
         System.exit(0);
         JpegImagesToMovie3 imageToMovie3 = new JpegImagesToMovie3();
         imageToMovie3.doIt(width, height, frameRate, inputFiles, oml);
         System.exit(0);
    static void prUsage() {
         System.err.println("Usage: java JpegImagesToMovie -w <width> -h <height> -f <frame rate> -o <output URL> <input JPEG file 1> <input JPEG file 2> ...");
         System.exit(-1);
    * Create a media locator from the given string.
    static MediaLocator createMediaLocator(String url) {
         MediaLocator ml;
         if (url.indexOf(":") > 0 && (ml = new MediaLocator(url)) != null)
         return ml;
         if (url.startsWith(File.separator)) {
         if ((ml = new MediaLocator("file:" + url)) != null)
              return ml;
         } else {
         String file = "file:" + System.getProperty("user.dir") + File.separator + url;
         if ((ml = new MediaLocator(file)) != null)
              return ml;
         return null;
    // Inner classes.
    * A DataSource to read from a list of JPEG image files and
    * turn that into a stream of JMF buffers.
    * The DataSource is not seekable or positionable.
    class ImageDataSource extends PullBufferDataSource {
         ImageSourceStream streams[];
         ImageDataSource(int width, int height, int frameRate, Vector images) {
         streams = new ImageSourceStream[1];
         streams[0] = new ImageSourceStream(width, height, frameRate, images);
         public void setLocator(MediaLocator source) {
         public MediaLocator getLocator() {
         return null;
         * Content type is of RAW since we are sending buffers of video
         * frames without a container format.
         public String getContentType() {
         return ContentDescriptor.RAW;
         public void connect() {
         public void disconnect() {
         public void start() {
         public void stop() {
         * Return the ImageSourceStreams.
         public PullBufferStream[] getStreams() {
         return streams;
         * We could have derived the duration from the number of
         * frames and frame rate. But for the purpose of this program,
         * it's not necessary.
         public Time getDuration() {
         return DURATION_UNKNOWN;
         public Object[] getControls() {
         return new Object[0];
         public Object getControl(String type) {
         return null;
    * The source stream to go along with ImageDataSource.
    class ImageSourceStream implements PullBufferStream {
         Vector images;
         int width, height;
         VideoFormat format;
         int nextImage = 0;     // index of the next image to be read.
         boolean ended = false;
         public ImageSourceStream(int width, int height, int frameRate, Vector images) {
         this.width = width;
         this.height = height;
         this.images = images;
         format = new VideoFormat(VideoFormat.JPEG,
                        new Dimension(width, height),
                        Format.NOT_SPECIFIED,
                        Format.byteArray,
                        (float)frameRate);
         * We should never need to block assuming data are read from files.
         public boolean willReadBlock() {
         return false;
         * This is called from the Processor to read a frame worth
         * of video data.
         public void read(Buffer buf) throws IOException {
         // Check if we've finished all the frames.
         if (nextImage >= images.size()) {
              // We are done. Set EndOfMedia.
              System.err.println("Done reading all images.");
              buf.setEOM(true);
              buf.setOffset(0);
              buf.setLength(0);
              ended = true;
              return;
         String imageFile = (String)images.elementAt(nextImage);
         nextImage++;
         System.err.println(" - reading image file: " + imageFile);
         // Open a random access file for the next image.
         RandomAccessFile raFile;
         raFile = new RandomAccessFile(imageFile, "r");
         byte data[] = null;
         // Check the input buffer type & size.
         if (buf.getData() instanceof byte[])
              data = (byte[])buf.getData();
         // Check to see the given buffer is big enough for the frame.
         if (data == null || data.length < raFile.length()) {
              data = new byte[(int)raFile.length()];
              buf.setData(data);
         // Read the entire JPEG image from the file.
         raFile.readFully(data, 0, (int)raFile.length());
         System.err.println(" read " + raFile.length() + " bytes.");
         buf.setOffset(0);
         buf.setLength((int)raFile.length());
         buf.setFormat(format);
         buf.setFlags(buf.getFlags() | buf.FLAG_KEY_FRAME);
         // Close the random access file.
         raFile.close();
         * Return the format of each video frame. That will be JPEG.
         public Format getFormat() {
         return format;
         public ContentDescriptor getContentDescriptor() {
         return new ContentDescriptor(ContentDescriptor.RAW);
         public long getContentLength() {
         return 0;
         public boolean endOfStream() {
         return ended;
         public Object[] getControls() {
         return new Object[0];
         public Object getControl(String type) {
         return null;
    on executing with the command:
    java JpegImagesToMovie -w <width> -h <height> -f <frame rate per sec.> -o <output URL> <input JPEG file 1> <input JPEG file 2> ...
    comes this......
    Exception in thread"JMF thread:SendEventQueue:com.sun.media.processor.unknown Handler" java.lang.NullPointerException"
    plz help

    Don't forget to use the "Code Formatting Tags",
    see http://forum.java.sun.com/help.jspa?sec=formatting,
    so the posted code retains its original formatting.

  • Using QuickTime Pro to convert a series of JPEG images into a QT movie?

    Can I use QuickTime Pro to convert a series of JPEG images into a QT (uncompressed) movie? Thanks...
      Windows XP  

    Yes.
    One of the features of the QuickTime Pro upgrade is "Open Image Sequence". It imports your sequencially named (1.jpg, 2.jpg) liked sized images (any format that QT understands) and allows you to set a frame rate.
    http://www.apple.com/quicktime/tutorials/slideshow.html
    You can also adjust the frame rate by adding your image .mov file to any audio clip. Simply "copy" (Command-A to select all and then Command-C to copy) and switch to your audio track.
    Select all and "Add to Selection & Scale". Open the Movie Properties window and "Extract" your new (longer or shorter) file and Save As.
    As you've posted in the Mac Discussion pages but your profile says XP you'll need to subsitute Control key where I reference Command key.

  • Generating a Movie File from a List of (JPEG) Images

    Hi All!
    I was trying this example:
    Generating a Movie File from a List of (JPEG) Images
    http://java.sun.com/products/java-media/jmf/2.1.1/solutions/JpegImagesToMovie.java
    I was using the following command line with the following output:
    root - /home/robertmarkbram/java/jmf/classes
    $java JpegImagesToMovie -w 320 -h 240 -f 1\
    -o file:///home/robertmarkbram/CoolCampus/media/jpgOut.mov\
    file:///BigBrain3/pics/breakfast.jpg\
    file:///BigBrain3/pics/eating.jpg\
    file:///BigBrain3/pics/howto.jpg\
    file:///BigBrain3/pics/jupiterp_cassini_full.jpg\
    file:///BigBrain3/pics/jupiterp_cassini.jpg\
    file:///BigBrain3/pics/spocamok.jpg- create processor for the image datasource ...
    Setting the track format to: JPEG
    - create DataSink for: file:///home/robertmarkbram/CoolCampus/media/jpgOut.mov
    start processing...
    - reading image file: file:///BigBrain3/pics/breakfast.jpg
    - reading image file: file:///BigBrain3/pics/eating.jpg
    - reading image file: file:///BigBrain3/pics/howto.jpg
    - reading image file: file:///BigBrain3/pics/jupiterp_cassini_full.jpg
    - reading image file: file:///BigBrain3/pics/jupiterp_cassini.jpg
    - reading image file: file:///BigBrain3/pics/spocamok.jpg
    Done reading all images.
    java.lang.NullPointerException
    at com.sun.media.multiplexer.video.QuicktimeMux.writeVideoSampleDescription(QuicktimeMux.java:936)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeSTSD(QuicktimeMux.java:925)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeSTBL(QuicktimeMux.java:905)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeMINF(QuicktimeMux.java:806)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeMDIA(QuicktimeMux.java:727)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeTRAK(QuicktimeMux.java:644)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeMOOV(QuicktimeMux.java:582)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeFooter(QuicktimeMux.java:519)
    at com.sun.media.multiplexer.BasicMux.close(BasicMux.java:142)
    at com.sun.media.BasicMuxModule.doClose(BasicMuxModule.java:172)
    at com.sun.media.PlaybackEngine.doClose(PlaybackEngine.java:872)
    at com.sun.media.BasicController.close(BasicController.java:261)
    at com.sun.media.BasicPlayer.doClose(BasicPlayer.java:229)
    at com.sun.media.BasicController.close(BasicController.java:261)
    at JpegImagesToMovie.controllerUpdate(JpegImagesToMovie.java:215)
    at com.sun.media.BasicController.dispatchEvent(BasicController.java:1254)
    at com.sun.media.SendEventQueue.processEvent(BasicController.java:1286)
    at com.sun.media.util.ThreadedEventQueue.dispatchEvents(ThreadedEventQueue.java:65)
    at com.sun.media.util.ThreadedEventQueue.run(ThreadedEventQueue.java:92)
    Can anyone tell me what this error message means?
    Thanks for any advice!
    Rob
    :)

    I think it does that for QuickTime if you don't define the lineStride value in the VideoFormat (lineStride = pixelStride * width).

Maybe you are looking for

  • Self Assigned IP Address with Airport Extreme

    I just changed my router from an Asus to AIrport Extreme.   The Airport Extreme is connected to an ATT DSL modem.  I know the modem works because I can connect to the internet when I connect it directly to my IMac.  However, when I try to access the

  • SAMPLE PERCENT option in oracle 8i

    Hi OTN members Has anyone used the SAMPLE option in the select statementin oracle 8i I was looking for PERCENT option in the SAMPLE option.i wanted to know how it works ? Thanks in advance Vinny null

  • JMS messages lost

    Hi, I´ve a JMS example put into a Weblogic 9.2 system. I´ve a persistent store to store my messages, I´m using a Queue. I´ve a message listener to write my message into a specific table in my BD. The creation of the messages work great, the messages

  • ZCM 10.3.4 on Oracle 11

    Anyone running 10.3 on Oracle 11g? Does it function ok?

  • Extracting XML for PDF

    Hi, I was wondering if anyone could possibly help me, I need to be able to extract specific information from PDFs in the XML markup language. I was wondering how I would go about doing such a thing, I was thinking of constructing an algorithm which w