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


C++ ImageProcessor::GetFilteredImage方法代码示例

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


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

示例1: Execute

void CameraTest::Execute() {
    cameraLEDsSubsystem->GreenOn();
    cameraLEDsSubsystem->BlueOff();

    // Allow time for the LEDs to light up
    if(!timer->HasPeriodPassed(0.1)) { return; }   // min tested was 80ms

    Preferences * prefs = Preferences::GetInstance();

    // Capture an image from the camera and save it to flash
    timer->Reset();
    ColorImage * image;
    if (prefs->GetInt("image_retain", 1) == 1) {
        cameraSubsystem->RetainImage("/cameratest.jpg");
        image = cameraSubsystem->CaptureImage();
        cameraSubsystem->RetainImage(NULL);  // stop retaining
        printf("[CAMERA] Captured image and wrote to /cameratest.jpg in %.1f ms\n", timer->Get() * 1000);
    } else {
        image = cameraSubsystem->CaptureImage();
        printf("[CAMERA] Captured image in %.1f ms\n", timer->Get() * 1000);
    }

    // Load preferences for filtering threshold image
    Threshold threshold = Threshold(prefs->GetInt("hue_low", 100), prefs->GetInt("hue_high", 140),
                                    prefs->GetInt("sat_low", 90), prefs->GetInt("sat_high", 255),
                                    prefs->GetInt("lum_low", 20), prefs->GetInt("lum_high", 255));

    // Process the captured image
    timer->Reset();
    ImageProcessor * ip = new ImageProcessor();
    ip->SetThreshold(threshold);
    ip->Process(image);
    printf("[CAMERA] Image processed in %.1f ms\n", timer->Get() * 1000);

    // Write the processed images to flash
    if (prefs->GetInt("image_retain", 1) == 1) {
        timer->Reset();
        ip->WriteImages("/cameratest");
        printf("[CAMERA] Processed images written to /cameratest.*.bmp in %.1f ms\n", timer->Get() * 1000);
    }

    // Generate a target report
    timer->Reset();
    TargetReport * tr = new TargetReport(ip->GetThresholdImage(), ip->GetFilteredImage());
    tr->Generate();
    printf("[CAMERA] Target report generated in %.1f ms\n", timer->Get() * 1000);

    tr->OutputScores();

    finished = true;

    delete tr;
    delete ip;
}
开发者ID:team3499,项目名称:2013,代码行数:54,代码来源:CameraTest.cpp


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