当前位置: 首页>>代码示例>>C++>>正文


C++ ImageSet::add方法代码示例

本文整理汇总了C++中ImageSet::add方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageSet::add方法的具体用法?C++ ImageSet::add怎么用?C++ ImageSet::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageSet的用法示例。


在下文中一共展示了ImageSet::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LOG

    /* [CS478] Assignment #2
     * Add a new function performs flash/no-flash fusion using ImageStack. The form of
     * this function will be quite different from the other JNI calls above. The assignment
     * webpage has many hints to help you figure out how to implement this section.
     */
    JNIEXPORT void JNICALL Java_com_nvidia_fcamerapro_FCamInterface_enqueueMessageForFlashFusion(JNIEnv *env, jobject thiz, jstring flashOnPath, jstring flashOffPath) {
        /* [CS478]
         * Enqueue a new message that represents a request for global autofocus.
         */
        int value;
        LOG("MYFOCUS flash fusion request\n");
        //sAppData->requestQueue.produce(ParamSetRequest(PARAM_AUTO_FOCUS_FACE, &value, 0));
        const char *str1 = (const char *) env->GetStringUTFChars(flashOnPath, 0);
        const char *str2 = (const char *) env->GetStringUTFChars(flashOffPath, 0);
        LOG("MYFOCUS got path: %s\n", str1);
        LOG("MYFOCUS got path: %s\n", str2);
        ImageStack::Image imgFlashOn = ImageStack::FileJPG::load(str1);
        ImageStack::Image imgFlashOff = ImageStack::FileJPG::load(str2);

        ImageStack::JointBilateral::apply(imgFlashOff, imgFlashOn, 4.0f, 4.0f, 0.0f, 0.4f);

        ImageSet *is = writer->newImageSet(); // writer is a global instance of AsyncImageWriter already defined
        FCam::_Frame* f = new FCam::Tegra::_Frame;
        f->image = FCam::Image(imgFlashOff.width, imgFlashOff.height, FCam::RGB24);
        for (int y = 0; y < imgFlashOff.height; y++) {
            for (int x = 0; x < imgFlashOff.width; x++) {
                for (int c = 0; c < 3; c++) {
                    ((unsigned char*)f->image(x, y))[c] = (unsigned char)(255 * imgFlashOff(x, y)[c] + 0.5f);
                }
            }
        }

        is->add(FileFormatDescriptor::EFormatJPEG, FCam::Frame(f));
        writer->push(is);

    }
开发者ID:bayanbatn,项目名称:cs478assignment2,代码行数:36,代码来源:FCamInterface.cpp

示例2: OnCapture

static void OnCapture(FCAM_INTERFACE_DATA *tdata, AsyncImageWriter *writer, FCam::Tegra::Sensor &sensor,
                      FCam::Tegra::Flash &flash, FCam::Tegra::Lens &lens) {
    FCAM_SHOT_PARAMS *currentShot = &tdata->currentShot;
    FCAM_SHOT_PARAMS *previousShot = &tdata->previousShot;

    // Stop streaming and drain frames. It should not be necessary, but let's be safe.
    sensor.stopStreaming();
    while (sensor.shotsPending() > 0) {
        sensor.getFrame();
    }

    // Prepare a new image set.
    ImageSet *is = writer->newImageSet();

    // Prepare flash action.
    FCam::Flash::FireAction flashAction(&flash);
    flashAction.time = 0;
    flashAction.brightness = flash.maxBrightness();

    // Request capture for each shot.
    for (int i = 0; i < currentShot->burstSize; i++) {

        FCam::Shot shot;
        shot.exposure = currentShot->captureSet[i].exposure;
        shot.gain = currentShot->captureSet[i].gain;
        shot.whiteBalance = currentShot->captureSet[i].wb;
        shot.image = FCam::Image(CAPTURE_IMAGE_WIDTH, CAPTURE_IMAGE_HEIGHT, FCam::YUV420p);
        shot.histogram.enabled = false;
        shot.sharpness.enabled = false;
        if (currentShot->captureSet[i].flashOn != 0) {
            shot.addAction(flashAction);
        }
        sensor.capture(shot);
    }

    // Currently we pause capture while writing the file. It may be good
    // to change this in the future so that writing occurs in the background.
    FileFormatDescriptor fmt(FileFormatDescriptor::EFormatJPEG, 95);
    while (sensor.shotsPending() > 0) {
        is->add(fmt, sensor.getFrame());
    }
    writer->push(is);
}
开发者ID:bayanbatn,项目名称:cs478assignment2,代码行数:43,代码来源:FCamInterface.cpp


注:本文中的ImageSet::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。