This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How can I capture and save the frame to file using DM6446?

Hi, everyone.

Now I`m studing demo 'encodedecode' with DM6446 DVEVM. But I`m in trouble of saving image files from the camera.

It`s so complecated to understand everything about edcodedeconde demo.

After Framecopy_execute() function in Display.c, I want to save every Image without codec engine.

It there any tips or examples to do it??

I hope that anyone helps me.. :D

Now i`m working on dvsdk_2_00_00_22

Thx

  • Hello,

    Saving the file to disk should be as simple as calling this below snippet after Capture_get

    fwrite(Buffer_getUserPtr(hCapBuf), Buffer_getSize(hCapBuf), 1, fptr);

    hCapBuf => DMAI buffer handle returns by Capture_get ()..

    HTH.

    Thanks

    Brijesh

  • Hello, Dongju Kim!

    I use this after encode:
    char name[15];
    sprintf(name, "test%d.jpg", i);
    FILE *fd = fopen(name, "wb");
    if (NULL == fd)   
        ERROR(MODULE, "Can't open file %s", name);
    if (NULL != fd) {
        if (1 != fwrite(Buffer_getUserPtr(hDstBuf),
                              Buffer_getNumBytesUsed(hDstBuf), 1, fd))
                 ERROR(MODULE, "Can't write file %s", name);
        fclose(fd);
    }


  • Hello, Kirill

    thx for your reply.

    I dont understand about 'sprint() ', what is the `i` variable??

    And you said you use that source code right?

    How can you make sure that the image is stored into the test.jpg file?

    I used fwite() as you said but when I try to open on Linux host it cannot be open :P...

    I`m looking forward to leaving reply.

    Best Regards,

    Dongju KIM.

  • Hello, Brijesh

    Thx for your reply.

    I already tried that way, so the file was created in current folder, but it doen`t open on Linux host.

    Can you give me any advises??

     

    And I have one more Question that I record the file using MPEG codec following encode Demo.

    The movie file can be open in DAEVM with decode Demo, but on Linux(Ubutu 10.04) it doen`t open, even Window OS.

    Please Help me T^T

    Best Regards,

    Dongju KIM.

     

  • Dongju Kim said:

    I dont understand about 'sprint() ', what is the `i` variable??

    http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/
    Variable i is a frame number, e.g. 10, 20.

    Dongju Kim said:

    How can you make sure that the image is stored into the test.jpg file?

    Image successfully saved if you don't get error message. You can check this:
    if (1 != fwrite(Buffer_getUserPtr(hDstBuf),
                              Buffer_getNumBytesUsed(hDstBuf), 1, fd))
        printf("Can't save image to file %s\n", name);
    else
        printf("Image successfully saved to file %s\n", name);

    ]

     

  • Kirill said:

    Image successfully saved if you don't get error message. You can check this:
    if (1 != fwrite(Buffer_getUserPtr(hDstBuf),
                              Buffer_getNumBytesUsed(hDstBuf), 1, fd))
        printf("Can't save image to file %s\n", name);
    else
        printf("Image successfully saved to file %s\n", name);

    ]

    Thx for reply. I tried to do that and I made Image files but it cannot open. T^T

    Which APP do you use to open the image files??

    Dongju KIM

     

  • Hmm, I don't understand yout problem Dongju Kim!

    Can you post your code and it output?

    I work with DM355 and get encoder output in MJPEG, after saving data in file I get JPEG.

    P.S. Excuse me for my bad english.