void CameraComponent::loadGUI(const ci::params::InterfaceGlRef &gui)
{
    gui->addSeparator();
    gui->addText( mContext->getName() +" : "+ getName());
    auto updateFn = std::bind(&CameraComponent::updateCameraParams, this);
    gui->addParam( mContext->getName() +" : FOV", &mFov).updateFn(updateFn);
    gui->addParam( mContext->getName() +" : Far", &mFar).updateFn(updateFn);
    gui->addParam( mContext->getName() +" : Near", &mNear).updateFn(updateFn);
    gui->addParam( mContext->getName() +" : Interest Point", &mInterestPoint);

}
void OSCComponent::loadGUI(const ci::params::InterfaceGlRef &gui)
{
    gui->addSeparator();
    gui->addText( mContext->getName() +" : "+ getName());
    auto updateFn = [&]{ mListener.setup(mListenPort); };
    gui->addParam("listen port", &mListenPort).updateFn(updateFn);
    
    ///TODO:: change osc sender gui update
    
//    auto loadFn = [&]{
//        auto tree = ec::ConfigManager::get()->retreiveComponent(ec::Controller::get()->scene().lock()->getName(), mContext->getName(), getName() );
//        auto ip = tree["send_ip"].getValue();
//        auto port = tree["send_port"].getValue<int>();
//        mSendPort = port;
//        mSendIp = ip;
//        mSender.setup(mSendIp, mSendPort);
//    };
//    gui->addButton("reload osc sender", loadFn );

}
예제 #3
0
void SegmentationApp::initInterface()
{
    interface->clear();
    
    if (guiMode == GUI_MODE::LOAD_IMAGE) {
        interface->addButton( "Open Image", std::bind( &SegmentationApp::openImage, this ) );        
    }
    else if (guiMode == GUI_MODE::LOAD_GROUNDTRUTH) {
        interface->addButton( "Open Ground Truth", std::bind( &SegmentationApp::openGroundTruth, this ) );
        //interface->addButton( "Open Doctor Image", std::bind( &SegmentationApp::openDoctorImage, this ) );
        interface->addSeparator();
        interface->addParam("filter radius", &filterRadius).min(0).max(10).step(1);
        interface->addButton( "Mean Filter", std::bind( &SegmentationApp::meanFilter, this ) );
        interface->addButton( "Median Filter", std::bind( &SegmentationApp::medianFilter, this ) );
        interface->addButton( "Min Filter", std::bind( &SegmentationApp::minFilter, this ) );
        interface->addButton( "Max Filter", std::bind( &SegmentationApp::maxFilter, this ) );
        interface->addSeparator();
        interface->addButton( "Get Hue", std::bind( &SegmentationApp::getHue, this ) );
        interface->addSeparator();
        interface->addParam("hue threshold", &hueThreshold).min(0).max(PI).step(.005).updateFn([this] () {
            thresholdHue(); });;
        interface->addParam("angle", &hueAngle).min(-PI).max(PI).step(.005).updateFn([this] () {
            thresholdHue(); });;
        interface->addButton( "threshold hue", std::bind( &SegmentationApp::thresholdHue, this ) );
        interface->addSeparator();
        interface->addParam("green weight", &greenWeight).min(0).max(5).step(.01).updateFn([this] () {
            experimentalColorDistance(); });;
        interface->addParam("blue weight", &blueWeight).min(0).max(5).step(.01).updateFn([this] () {
            experimentalColorDistance(); });;
        interface->addButton( "experimental threshold", std::bind( &SegmentationApp::experimentalColorDistance, this ) );
        interface->addSeparator();
        interface->addParam("otsus Iterations", &otsusIterations).min(1).max(5).step(1);

        interface->addButton( "otsus red", std::bind( &SegmentationApp::redOtsusThreshold, this ) );
        interface->addButton( "otsus green", std::bind( &SegmentationApp::greenOtsusThreshold, this ) );
        interface->addButton( "otsus blue", std::bind( &SegmentationApp::blueOtsusThreshold, this ) );
        interface->addButton( "otsus gray", std::bind( &SegmentationApp::grayOtsusThreshold, this ) );
        interface->addButton( "otsus best", std::bind( &SegmentationApp::multiImageOtsusThreshold, this ) );
        
        //interface->addButton( "otsus binary mask", std::bind( &SegmentationApp::otsusBinaryMask, this ) );
        //interface->addButton( "otsus color union", std::bind( &SegmentationApp::otsusColorUnion, this ) );
        interface->addSeparator();
        interface->addButton( "erode", std::bind( &SegmentationApp::erode, this ) );
        interface->addButton( "dilate", std::bind( &SegmentationApp::dilate, this ) );
        interface->addSeparator();
        interface->addButton( "get largest component", std::bind( &SegmentationApp::getLargestComponents, this ) );
        interface->addButton( "fill holes", std::bind( &SegmentationApp::fillHoles, this ) );
        interface->addSeparator();
        interface->addButton( "show result", std::bind( &SegmentationApp::showResult, this ) );

        //interface->addButton( "otsus edge intersection", std::bind( &SegmentationApp::otsusEdgeIntersection, this ) );
        //interface->addSeparator();
        //interface->addButton( "color gradient", std::bind( &SegmentationApp::getColorGradient, this ) );
        //interface->addButton( "thin edges", std::bind( &SegmentationApp::edgeThinColorGradient, this ) );
        interface->addSeparator();
        
        interface->addButton( "autoSegment", std::bind( &SegmentationApp::autoSegment, this ) );
        
        interface->addText( "Dice Coeddicient : " + std::to_string(diceCoefficientResult) );
        interface->addSeparator();
        interface->addButton( "Reset", std::bind( &SegmentationApp::reset, this ) );
        interface->addSeparator();
        interface->addButton( "Save Input", std::bind( &SegmentationApp::saveInputImage, this ) );
        interface->addButton( "Save Segmentation", std::bind( &SegmentationApp::saveSegmentedImage, this ) );
        interface->addButton( "Save Result", std::bind( &SegmentationApp::saveResultImage, this ) );
        
    }
    else if (guiMode == GUI_MODE::DO_TRAINING) {
        interface->addParam("filter radius", &filterRadius).min(0).max(10).step(1);
        interface->addButton( "Mean Filter", std::bind( &SegmentationApp::meanFilter, this ) );
        interface->addButton( "Median Filter", std::bind( &SegmentationApp::medianFilter, this ) );
        interface->addButton( "Min Filter", std::bind( &SegmentationApp::minFilter, this ) );
        interface->addButton( "Max Filter", std::bind( &SegmentationApp::maxFilter, this ) );
        interface->addSeparator();
        interface->addButton( "Open Doctor Image", std::bind( &SegmentationApp::openDoctorImage, this ) );
        interface->addSeparator();
        interface->addButton( "Train", std::bind( &SegmentationApp::trainImage, this ) );
    }
    else if (guiMode == GUI_MODE::DO_DOCTOR_TRAINING) {
        
        
        interface->addParam("filter radius", &filterRadius).min(0).max(10).step(1);
        interface->addButton( "Mean Filter", std::bind( &SegmentationApp::meanFilter, this ) );
        interface->addButton( "Median Filter", std::bind( &SegmentationApp::medianFilter, this ) );
        interface->addSeparator();
        interface->addButton( "Doctor Training", std::bind( &SegmentationApp::trainDoctorImage, this ) );
    }
    else if (guiMode == GUI_MODE::THRESHOLD) {
        interface->addButton( "Show Mean Distance", std::bind( &SegmentationApp::getColorDistance, this ) );
        interface->addButton( "Threshold Color", std::bind( &SegmentationApp::thresholdColor, this ) );
        interface->addParam("color distance", &colorThreshold).min(0.f).max(255.f).step(1).updateFn([this] () {
            thresholdColor(); });
        interface->addSeparator();
        interface->addButton( "Threshold Mahalonobis", std::bind( &SegmentationApp::thresholdMahalonobis, this ) );
        interface->addParam("mahalonobis distance", &mahalonobisThreshold).min(0.f).max(255.f).step(1);
    }
    interface->addSeparator();
    
}
void ComponentTemplate::loadGUI(const ci::params::InterfaceGlRef &gui)
{
    gui->addSeparator();
    gui->addText(getName());
}