All Products
Search
Document Center

:Feature description

Last Updated:Sep 05, 2024

Sample code of Queen SDK

  1. Initialize QueenEngine.

    // Build the OpenGL environment. You can skip this step if an OpenGL environment exists.
    queen::GlfwWindow* glWindow = new queen::GlfwWindow();// The OpenGL environment.
    if (!glWindow->Init(width, height, false))// A GPU driver may be not installed on your computer.
    {
     return;
    }
    // Create QueenEngine.
    // Replace rootPath with the parent directory where the queen_res folder resides. If you do not specify this parameter, the exe directory is used.
    queen_engine_t handle_beauty;
    if (QUEEN_RESULT_CODE_OK != queen_engine_create(&handle_beauty, rootPath,
    "123456"))
    {
     return;
    }
  2. Enable effects and set effect parameters.

    // Enable skin smoothing.
    queen_engine_enableBeautyType(handle_beauty, kQueenBeautyTypeSkinBuffing,
    true);
    // Set the parameters for skin smoothing and image sharpening.
    queen_engine_setBeautyParams(handle_beauty,
    kQueenBeautyParamsSkinBuffing, 0.6f); // The level of skin smoothing. Valid values: [0,1].
    queen_engine_setBeautyParams(handle_beauty, kQueenBeautyParamsSharpen,
    0.8f); //// The level of image sharpening. Valid values: [0,1].
  3. Process the frame image data.

    // Process the frame image data and return the processed data to the bufferOut parameter.
    if (QUEEN_RESULT_CODE_OK != queen_engine_render_with_i420(handle_beauty,
    bufferIn, width, height, bufferOut))
    {
     return;
    }
  4. Destroy QueenEngine.

    // Release the engine. Make sure that the thread for processing the frame image data is used to release the engine.
    queen_engine_destory(handle_beauty);
    // Remove the OpenGL environment.
    delete glWindow;