Hi !

I have problems applying a 3D LUT using "FileTransformRcPtr".


1 - I load my image using OpenImageIO :

_____________________________________________________________________________________________________________________



ImageInput *srcImg = ImageInput::open(filename);
ImageSpec *srcSpec = new ImageSpec(srcImg->spec());
unsigned char* srcRGBpixelData = (unsigned 
char*)malloc(srcSpec->width*srcSpec->height*3 );

srcImg->read_scanlines( srcSpec->y, srcSpec->y+srcSpec->height, 0, 0, 3, 
TypeDesc::UINT8, srcRGBpixelData );

ImageSpec srcBufSpec = ImageSpec ( srcSpec->width, srcSpec->height, 3, 
TypeDesc::UINT8 );
ImageBuf srcBuf = ImageBuf( srcBufSpec );
ROI srcRoi = get_roi_full (*srcSpec);
srcBuf.set_pixels( srcRoi, TypeDesc::UINT8, srcRGBpixelData );



srcImg->close();


______________________________________________________________________________________________________________________



2 - store my image in RAM as "unsigned char*"



I would like to apply a 3D LUT to this "raw data" (unsigned char*) and return the result 
as "unsigned char*" since this is what Qt supports for QImage data.

Here is what I came up with, it's currently crashing on the 
"m_processor->apply(luttedImg); line"



______________________________________________________________________________________________________________________



        OCIO::PackedImageDesc luttedImg(reinterpret_cast<float*>(imgCache[curFrame]), 
seqSpec->width, seqSpec->height, 3);

        try
        {
            OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();

            // Create File Transform
            const char *lutPath = "C:/temp/049x050_lut.3dl";
            OCIO::FileTransformRcPtr transform = OCIO::FileTransform::Create();
            transform->setSrc(lutPath);
            transform->setDirection(OCIO::TRANSFORM_DIR_FORWARD);
            transform->setInterpolation(OCIO::INTERP_LINEAR);

            OCIO::ConstProcessorRcPtr m_processor = 
config->getProcessor(transform, OCIO::TRANSFORM_DIR_FORWARD);

            // Apply transform
            m_processor->apply(luttedImg);
        }
        catch(OCIO::Exception &e)
        {
            qDebug() << e.what();
        }


      // not sure how to go back to "unsigned char*" after transform is applied. 
reinterpret_cast<unsigned char*> ????

__________________________________________________________________________________________________________________________



As usual, any help would be greatly appreciated.

Thanks,



Renaud
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to