C code need help loading picture automatically

This is a discussion on C code need help loading picture automatically within the C Programming forums, part of the General Programming Boards category; I need help. I would like someone to help me how can i make the program selecte the picture let ...

  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    2

    C code need help loading picture automatically

    I need help. I would like someone to help me how can i make the program selecte the picture let say picture 01 till picture 02 by squence on each picture it has to read a number on the picture let say 01 and then picture two 02 ....etc.

    I need to know how can i read those number without using the loading the picture it mean it will do it automatically instead each time the pop ask me to load the picture and then i have to use my OCR to read the number but my concern is just i need to able to load the picture wihtout using the pop loader as i do it now manually.

    it mean it read the number automatically without showing the picture. I included the code below maybe someone can help me and it is on C code only. thanks a lot mamashi


    int main (int argc, char *argv

    int success = 1;
    int err = 0;
    char** imagePath; Image Path
    int cancelled;
    ImageType imageType; Image Type
    Image* image; Image

    IMAQ Vision creates windows in a separate thread
    imaqSetWindowThreadPolicy(IMAQ_SEPARATE_THREAD);
    Display the Load Image dialog
    imagePath = imaqLoadImagePopup(NULL, "*.*", NULL, "Open Image", FALSE, IMAQ_BUTTON_LOAD, 0, 0, 1, 0, &cancelled, NULL);
    if (!cancelled)
    Get the type of the image file to create an image of the right type
    imaqGetFileInfo(imagePath[0], NULL, NULL, NULL, NULL, NULL, &imageType);
    Create an IMAQ Vision image
    image = imaqCreateImage(imageType, 7);
    Read the image from disk
    imaqReadFile(image, imagePath[0], NULL, NULL);
    Vision Assistant Algorithm
    success = IVA_ProcessImage(image);
    if (!success)
    err = imaqGetLastError();
    Display the image
    imaqMoveWindow(DISPLAY_WINDOW, imaqMakePoint(0,0));
    imaqSetWindowPalette(DISPLAY_WINDOW, IMAQ_PALETTE_GRAY, NULL, 0);
    imaqDisplayImage(image, DISPLAY_WINDOW, TRUE);
    Wait for a key press before exiting
    printf ("Press Enter to exit.\n");
    getchar();
    Dispose resources
    imaqDispose(image);
    imaqDispose(imagePath);
    return 0;

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,657

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,851
    Here's an idea.
    Learn how to use code tags, rather than ripping out all the braces from your code just so you can post an unformatted mess.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    looks like something i would drag in....meow

    Code:
    /* imagedisplay.c */
    
    
    
    int main (int argc, char *argv ) /* <== missing ')' */
    
    int success = 1;
    int err = 0;
    char** imagePath; Image Path
    int cancelled;
    ImageType imageType;
     Image Type          /* ?what */
    Image* image; Image
    
    /* IMAQ Vision creates windows in a separate thread */
    imaqSetWindowThreadPolicy(IMAQ_SEPARATE_THREAD);
    Display the Load Image dialog
    imagePath = imaqLoadImagePopup(NULL, "*.*", NULL, "Open Image", FALSE, IMAQ_BUTTON_LOAD, 0, 0, 1, 0, &cancelled, NULL);
    if (!cancelled)
    /*  Get the type of the image file to create an image of the right type */
    imaqGetFileInfo(imagePath[0], NULL, NULL, NULL, NULL, NULL, &imageType);
    /* Create an IMAQ Vision image */
    image = imaqCreateImage(imageType, 7);
    /* Read the image from disk */
    imaqReadFile(image, imagePath[0], NULL, NULL);
    /* Vision Assistant Algorithm */
    success = IVA_ProcessImage(image);
    if (!success)
    err = imaqGetLastError();
     /* Display the image */
    imaqMoveWindow(DISPLAY_WINDOW, imaqMakePoint(0,0));
    imaqSetWindowPalette(DISPLAY_WINDOW, IMAQ_PALETTE_GRAY, NULL, 0);
    imaqDisplayImage(image, DISPLAY_WINDOW, TRUE);
    /* Wait for a key press before exiting */
    printf ("Press Enter to exit.\n");
    getchar();
    /* Dispose resources */
    imaqDispose(image);
    imaqDispose(imagePath);
    return 0;

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,851
    And on that pointless note - closed.
    The OP hasn't bothered to return with decently formatted code, so nothing to worry about.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dialogue class code for RPG
    By ~Kyo~ in forum Game Programming
    Replies: 9
    Last Post: 07-03-2010, 07:10 AM
  2. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  3. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM
  5. Replies: 4
    Last Post: 01-16-2002, 12:04 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21