Forums - Save to bitmap

1 post / 0 new
Save to bitmap
mcflurry0
Join Date: 16 Mar 15
Posts: 3
Posted: Wed, 2015-04-01 09:34

Hello all,

 

I am trying to save an image from the Java-Android with FastCV. From the JNI part, in my c++ code, i receives and array of bytes with format

YUV NV21, and I'd like to parser it as a RGB888_u8 image in order to get a .bmp file, but i am not able to do it... ..I only get a black image...

This is my code:

    uint8_t *pToData = (uint8_t *) data;
    uint32_t *dstRGB888 = (uint32_t *)fcvMemAlloc(WIDTH*HEIGHT*sizeof(uint32_t),16);
    fcvColorYCrCb420PseudoPlanarToRGB8888u8(pToData,WIDTH,HEIGHT,0,0,dstRGB888,0);

data contains the array of bytes... (unsigned char*)

WIDTH  =  600

HEIGHT = 480

This is the function to save in a file

    inline void SaveFile (std::string filename, uint32_t * rgb888, int width, int height) {
        std::fstream file(filename, std::ios::out | std::ios::binary);
        file.write((char*)rgb888,width*height*sizeof(uint32_t));;
        file.close();
    }

I would appreciate any help... (or some code snippet to know how implement this part...)

  • Up0
  • Down0

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.