Quantcast
Channel: Intel® Software - Intel® Integrated Performance Primitives
Viewing all articles
Browse latest Browse all 1489

Convert IplImage to CIppImage

$
0
0

 

 Hi~

 I currently use the UIC sample code.

 I want to convert IplImage to CIppImage. and to save *.jpg using the CIppImage type.

 So, i try to convert, but i can't save to *.jpg.

 For example, My sample code is

/////////////////////////////////////////////////////////////////////////////////////////////

    CIppImage         image;

    IM_TYPE           fmtIn;

    IM_TYPE           fmtOut;

    Ipp8u*            buf;

    CStdFileOutput  fo;    

    CMemBuffOutput  mo;

    

    fmtOut = IT_BMP;

    fo.Open(cmdOptions.dst);

    IplImage *img = cvLoadImage(cmdOptions.src,CV_LOAD_IMAGE_GRAYSCALE);

//    cvShowImage("test",cmdOptions.src);

//    cvSaveImage(cmdOptions.dst,img);

    

    image.Width(img->width);

    image.Height(img->height);

    image.Color(IC_GRAY);

    image.Format(IF_FIXED);

    image.Sampling(IS_444);

    image.ComponentOrder(0);

    image.NChannels(img->nChannels);    

    image.Precision(img->depth);

    image.Step(4096);

    image.DataPtr((Ipp8u*)img->imageData);    

    // Encoder

    BaseStream::TPosition pos = 0;  

    size = image.Step()*image.Height()*2;

    buf = (Ipp8u*)ippMalloc((int)size);

    mo.Open(buf, (int)size);

    res = EncodeImage(image, mo, cmdOptions, fmtOut, &encTime);

    mo.Position(pos);    

    mo.Close();

    fo.Write(buf, pos, cnt);

    ippFree(buf);

///////////////////////////////////////////////////////////////////////////////////////////////////////

   Thanks in advance for your help!


Viewing all articles
Browse latest Browse all 1489

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>