Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
17060 Discussions

How to modify PXCCapture::Sample image in OnNewSample callback ?

ippei_i_
Beginner
394 Views

Hi,

I want to rotate capture image in PXCCapture::Sample for camera placed lengthwise, to the face detection module.

following code works fine.

pxcStatus PXCAPI OnNewSample(pxcUID, PXCCapture::Sample *sample)
{
    if(sample->color)
    {
        // modify capture image data test
        PXCImage::ImageInfo info = sample->color->QueryInfo();
        PXCImage::ImageData data;
        for(int i=0;i<34;i++)
        {
            // get original capture image data
            if(sample->color->AcquireAccess(PXCImage::ACCESS_READ_WRITE, info.format , &data) >= PXC_STATUS_NO_ERROR)
            {
                int pixelWidth = data.pitches[0]/info.width;
                for(int y=0;y<info.height;y++)
                {
                    for(int x=0;x<info.width;x++)
                    {
                        data.planes[0][y*data.pitches[0] + x*pixelWidth +0] = 0x00; // change red pixel.(test)
                    }
                }
                sample->color->ReleaseAccess(&data);
            }
            Sleep(1);
        }
    }

    // return NO_ERROR to continue, or any error to exit the loop
    if( isStopped )
        return  PXC_STATUS_EXEC_ABORTED;
    else
        return PXC_STATUS_NO_ERROR;
}

pxcStatus PXCAPI OnModuleProcessedFrame(pxcUID mid, PXCBase *module, PXCCapture::Sample *sample)
{
    if (mid==PXCFaceModule::CUID)
    {
        DrawBitmap(sample->color);
    }
}

But can't rotate rotate capture image in PXCCapture::Sample, because can't modify width and height.

How can I do?

Thanks.

0 Kudos
0 Replies
Reply