Standard non-max feature extractor.

@param config Configuration for extractor
@return A feature extractor.
515888
public static NonMaxSuppression nonmax( @Nullable ConfigExtract config ) {

		if( config == null )
			config = new ConfigExtract();
		config.checkValidity();

		if( BOverrideFactoryFeatureExtractor.nonmax != null ) {
			return BOverrideFactoryFeatureExtractor.nonmax.process(config);
		}

		NonMaxBlock.Search search;
		if (config.useStrictRule) {
			if( config.detectMaximums)
				if( config.detectMinimums )
					search = new NonMaxBlockSearchStrict.MinMax();
				else
					search = new NonMaxBlockSearchStrict.Max();
			else
				search = new NonMaxBlockSearchStrict.Min();
		} else {
			if( config.detectMaximums)
				if( config.detectMinimums )
					search = new NonMaxBlockSearchRelaxed.MinMax();
				else
					search = new NonMaxBlockSearchRelaxed.Max();
			else
				search = new NonMaxBlockSearchRelaxed.Min();
		}

		// See if the user wants to use threaded code or not
		NonMaxBlock alg = BoofConcurrency.USE_CONCURRENT ?
				new NonMaxBlock_MT(search) : new NonMaxBlock(search);

		alg.setSearchRadius(config.radius);
		alg.setThresholdMax(config.threshold);
		alg.setThresholdMin(-config.threshold);
		alg.setBorder(config.ignoreBorder);

		return new WrapperNonMaximumBlock(alg);
	}
672716
public static RocksDBNativeMetricOptions fromConfig(Configuration config) {
		RocksDBNativeMetricOptions options = new RocksDBNativeMetricOptions();
		if (config.getBoolean(MONITOR_NUM_IMMUTABLE_MEM_TABLES)) {
			options.enableNumImmutableMemTable();
		}

		if (config.getBoolean(MONITOR_MEM_TABLE_FLUSH_PENDING)) {
			options.enableMemTableFlushPending();
		}

		if (config.getBoolean(TRACK_COMPACTION_PENDING)) {
			options.enableCompactionPending();
		}

		if (config.getBoolean(MONITOR_BACKGROUND_ERRORS)) {
			options.enableBackgroundErrors();
		}

		if (config.getBoolean(MONITOR_CUR_SIZE_ACTIVE_MEM_TABLE)) {
			options.enableCurSizeActiveMemTable();
		}

		if (config.getBoolean(MONITOR_CUR_SIZE_ALL_MEM_TABLE)) {
			options.enableCurSizeAllMemTables();
		}

		if (config.getBoolean(MONITOR_SIZE_ALL_MEM_TABLES)) {
			options.enableSizeAllMemTables();
		}

		if (config.getBoolean(MONITOR_NUM_ENTRIES_ACTIVE_MEM_TABLE)) {
			options.enableNumEntriesActiveMemTable();
		}

		if (config.getBoolean(MONITOR_NUM_ENTRIES_IMM_MEM_TABLES)) {
			options.enableNumEntriesImmMemTables();
		}

		if (config.getBoolean(MONITOR_NUM_DELETES_ACTIVE_MEM_TABLE)) {
			options.enableNumDeletesActiveMemTable();
		}

		if (config.getBoolean(MONITOR_NUM_DELETES_IMM_MEM_TABLE)) {
			options.enableNumDeletesImmMemTables();
		}

		if (config.getBoolean(ESTIMATE_NUM_KEYS)) {
			options.enableEstimateNumKeys();
		}

		if (config.getBoolean(ESTIMATE_TABLE_READERS_MEM)) {
			options.enableEstimateTableReadersMem();
		}

		if (config.getBoolean(MONITOR_NUM_SNAPSHOTS)) {
			options.enableNumSnapshots();
		}

		if (config.getBoolean(MONITOR_NUM_LIVE_VERSIONS)) {
			options.enableNumLiveVersions();
		}

		if (config.getBoolean(ESTIMATE_LIVE_DATA_SIZE)) {
			options.enableEstimateLiveDataSize();
		}

		if (config.getBoolean(MONITOR_TOTAL_SST_FILES_SIZE)) {
			options.enableTotalSstFilesSize();
		}

		if (config.getBoolean(ESTIMATE_PENDING_COMPACTION_BYTES)) {
			options.enableEstimatePendingCompactionBytes();
		}

		if (config.getBoolean(MONITOR_NUM_RUNNING_COMPACTIONS)) {
			options.enableNumRunningCompactions();
		}

		if (config.getBoolean(MONITOR_NUM_RUNNING_FLUSHES)) {
			options.enableNumRunningFlushes();
		}

		if (config.getBoolean(MONITOR_ACTUAL_DELAYED_WRITE_RATE)) {
			options.enableActualDelayedWriteRate();
		}

		return options;
	}
161193
public JRecordExtractor<T, LabeledPoint>
  extractWithSubsetSettingsLabeledPoint(String settings) {
    return new JRecordExtractor<>(JavaOps.extractWithSubsetSettingsLabeledPoint(self, settings));
  }
1044710
public JRecordExtractor<T, LabeledPoint>
  extractWithSettingsLabeledPoint(String settings) {
    return new JRecordExtractor<>(JavaOps.extractWithSettingsLabeledPoint(self, settings));
  }
232681
@Nonnull
    public Configuration filter(Configuration config) {
        final Map<String, Object> values = Maps.newHashMap();

        for (final ConfigurationField field : fields.values()) {
            final String name = field.getName();
            final String type = field.getFieldType();
            switch (type) {
                case BooleanField.FIELD_TYPE:
                    if (config.booleanIsSet(name)) {
                        values.put(name, config.getBoolean(name));
                    }
                    break;
                case NumberField.FIELD_TYPE:
                    if (config.intIsSet(name)) {
                        values.put(name, config.getInt(name));
                    }
                    break;
                case TextField.FIELD_TYPE:
                case DropdownField.FIELD_TYPE:
                    if (config.stringIsSet(name)) {
                        values.put(name, config.getString(name));
                    }
                    break;
                default:
                    throw new IllegalStateException("Unknown field type " + type + " for configuration field \"" + name + "\". This is a bug.");
            }
        }
        return new Configuration(values);
    }
655933
public static TriangulateNViewsMetric triangulateNViewCalibrated(@Nullable ConfigTriangulation config ) {
		if( config == null )
			config = new ConfigTriangulation();

		switch ( config.type ) {
			case DLT:
				return new WrapNViewsTriangulateMetricDLT();

			case GEOMETRIC: {
				TriangulateNViewsMetric estimator = new WrapNViewsTriangulateMetricDLT();
				TriangulateRefineMetricLS refiner = new TriangulateRefineMetricLS(config.optimization.gtol,config.optimization.maxIterations);
				return new TriangulateThenRefineMetric(estimator,refiner);
			}

		}
		throw new IllegalArgumentException("Unknown or unsupported type "+config.type);
	}
755258
@Override
    public Model read(Configuration config) {
        String name = config.getName();
        Descriptor desc = getDescriptor();
        if (IMPLEMENTATION_RULES.equals(name)) {
            return new V1RulesComponentImplementationModel(config, desc);
        } else if (OPERATION.equals(name)) {
            return new V1RulesOperationModel(config, desc);
        }
        return super.read(config);
    }
97641
@NonNull
  public RequestCreator config(@NonNull Bitmap.Config config) {
    data.config(config);
    return this;
  }
30911
public static TriangulateNViewsProjective triangulateNView( @Nullable ConfigTriangulation config ) {
		if( config == null )
			config = new ConfigTriangulation();

		switch( config.type) {
			case DLT:
				return new WrapNViewsTriangulateProjectiveDLT();

			case ALGEBRAIC:
			case GEOMETRIC: {
				TriangulateNViewsProjective estimator = new WrapNViewsTriangulateProjectiveDLT();
				TriangulateRefineProjectiveLS refiner = new TriangulateRefineProjectiveLS(config.optimization.gtol,config.optimization.maxIterations);
				return new TriangulateThenRefineProjective(estimator,refiner);
			}
		}
		throw new IllegalArgumentException("Unknown or unsupported type "+config.type);
	}
999404
public static Config getFixedConfig(@Nonnull Map<String, String> config)
    {
        return getFixedConfig(new MapConfiguration(config));
    }
821448
public JRecordExtractor<T, SparseLabeledPoint>
  extractWithSettingsSparseLabeledPoint(String settings) {
    return new JRecordExtractor<>(JavaOps.extractWithSettingsSparseLabeledPoint(self, settings));
  }
393825
public static <A, B> FeatureGenerator<A, List<B>> productFeatureGenerator(
      FeatureGenerator<A, B>... generators) {
    return FeatureGenerators.productFeatureGenerator(Arrays.asList(generators));
  }
1095374
public JRecordExtractor<T, float[]> extractWithSettingsFloat(String settings) {
    return new JRecordExtractor<>(JavaOps.extractWithSettingsFloat(self, settings));
  }
1098186
public static Configuration loadFromString(String config)
    throws IOException, SAXException {
    ConfigurationImpl cfg = new ConfigurationImpl();

    XMLReader parser = XMLReaderFactory.createXMLReader();
    parser.setContentHandler(new ConfigHandler(cfg, null));
    Reader reader = new StringReader(config);
    parser.parse(new InputSource(reader));
    return cfg;
  }
797762
public static <A, B> FeatureGenerator<A, B> combinedFeatureGenerator(
      FeatureGenerator<A, B>... generators) {
    return FeatureGenerators.combinedFeatureGenerator(Arrays.asList(generators));
  }
1364850
private static Object[] extractExtendedFeatures(Configuration configuration, int length)
    {
        Object[] featureMap = new Object[length];

        State state = configuration.state;
        Sentence sentence = configuration.sentence;

        int b0Position = 0;
        int b1Position = 0;
        int b2Position = 0;
        int s0Position = 0;

        long svr = 0; // stack right valency
        long svl = 0; // stack left valency
        long bvl = 0; // buffer left valency

        long b0w = 0;
        long b0p = 0;

        long b1w = 0;
        long b1p = 0;

        long b2w = 0;
        long b2p = 0;

        long s0w = 0;
        long s0p = 0;
        long s0l = 0;

        long bl0p = 0;
        long bl0w = 0;
        long bl0l = 0;

        long bl1w = 0;
        long bl1p = 0;
        long bl1l = 0;

        long sr0p = 0;
        long sr0w = 0;
        long sr0l = 0;

        long sh0w = 0;
        long sh0p = 0;
        long sh0l = 0;

        long sl0p = 0;
        long sl0w = 0;
        long sl0l = 0;

        long sr1w = 0;
        long sr1p = 0;
        long sr1l = 0;

        long sh1w = 0;
        long sh1p = 0;

        long sl1w = 0;
        long sl1p = 0;
        long sl1l = 0;

        long sdl = 0;
        long sdr = 0;
        long bdl = 0;

        int[] words = sentence.getWords();
        int[] tags = sentence.getTags();

        if (0 < state.bufferSize())
        {
            b0Position = state.bufferHead();
            b0w = b0Position == 0 ? 0 : words[b0Position - 1];
            b0w += 2;
            b0p = b0Position == 0 ? 0 : tags[b0Position - 1];
            b0p += 2;
            bvl = state.leftValency(b0Position);

            int leftMost = state.leftMostModifier(state.getBufferItem(0));
            if (leftMost >= 0)
            {
                bl0p = leftMost == 0 ? 0 : tags[leftMost - 1];
                bl0p += 2;
                bl0w = leftMost == 0 ? 0 : words[leftMost - 1];
                bl0w += 2;
                bl0l = state.getDependent(leftMost);
                bl0l += 2;

                int l2 = state.leftMostModifier(leftMost);
                if (l2 >= 0)
                {
                    bl1w = l2 == 0 ? 0 : words[l2 - 1];
                    bl1w += 2;
                    bl1p = l2 == 0 ? 0 : tags[l2 - 1];
                    bl1p += 2;
                    bl1l = state.getDependent(l2);
                    bl1l += 2;
                }
            }

            if (1 < state.bufferSize())
            {
                b1Position = state.getBufferItem(1);
                b1w = b1Position == 0 ? 0 : words[b1Position - 1];
                b1w += 2;
                b1p = b1Position == 0 ? 0 : tags[b1Position - 1];
                b1p += 2;

                if (2 < state.bufferSize())
                {
                    b2Position = state.getBufferItem(2);

                    b2w = b2Position == 0 ? 0 : words[b2Position - 1];
                    b2w += 2;
                    b2p = b2Position == 0 ? 0 : tags[b2Position - 1];
                    b2p += 2;
                }
            }
        }

        if (0 < state.stackSize())
        {
            s0Position = state.stackTop();
            s0w = s0Position == 0 ? 0 : words[s0Position - 1];
            s0w += 2;
            s0p = s0Position == 0 ? 0 : tags[s0Position - 1];
            s0p += 2;
            s0l = state.getDependent(s0Position);
            s0l += 2;

            svl = state.leftValency(s0Position);
            svr = state.rightValency(s0Position);

            int leftMost = state.leftMostModifier(s0Position);
            if (leftMost >= 0)
            {
                sl0p = leftMost == 0 ? 0 : tags[leftMost - 1];
                sl0p += 2;
                sl0w = leftMost == 0 ? 0 : words[leftMost - 1];
                sl0w += 2;
                sl0l = state.getDependent(leftMost);
                sl0l += 2;
            }

            int rightMost = state.rightMostModifier(s0Position);
            if (rightMost >= 0)
            {
                sr0p = rightMost == 0 ? 0 : tags[rightMost - 1];
                sr0p += 2;
                sr0w = rightMost == 0 ? 0 : words[rightMost - 1];
                sr0w += 2;
                sr0l = state.getDependent(rightMost);
                sr0l += 2;
            }

            int headIndex = state.getHead(s0Position);
            if (headIndex >= 0)
            {
                sh0w = headIndex == 0 ? 0 : words[headIndex - 1];
                sh0w += 2;
                sh0p = headIndex == 0 ? 0 : tags[headIndex - 1];
                sh0p += 2;
                sh0l = state.getDependent(headIndex);
                sh0l += 2;
            }

            if (leftMost >= 0)
            {
                int l2 = state.leftMostModifier(leftMost);
                if (l2 >= 0)
                {
                    sl1w = l2 == 0 ? 0 : words[l2 - 1];
                    sl1w += 2;
                    sl1p = l2 == 0 ? 0 : tags[l2 - 1];
                    sl1p += 2;
                    sl1l = state.getDependent(l2);
                    sl1l += 2;
                }
            }
            if (headIndex >= 0)
            {
                if (state.hasHead(headIndex))
                {
                    int h2 = state.getHead(headIndex);
                    sh1w = h2 == 0 ? 0 : words[h2 - 1];
                    sh1w += 2;
                    sh1p = h2 == 0 ? 0 : tags[h2 - 1];
                    sh1p += 2;
                }
            }
            if (rightMost >= 0)
            {
                int r2 = state.rightMostModifier(rightMost);
                if (r2 >= 0)
                {
                    sr1w = r2 == 0 ? 0 : words[r2 - 1];
                    sr1w += 2;
                    sr1p = r2 == 0 ? 0 : tags[r2 - 1];
                    sr1p += 2;
                    sr1l = state.getDependent(r2);
                    sr1l += 2;
                }
            }
        }
        int index = 0;

        long b0wp = b0p;
        b0wp |= (b0w << 8);
        long b1wp = b1p;
        b1wp |= (b1w << 8);
        long s0wp = s0p;
        s0wp |= (s0w << 8);
        long b2wp = b2p;
        b2wp |= (b2w << 8);

        /**
         * From single words
         */
        if (s0w != 1)
        {
            featureMap[index++] = s0wp;
            featureMap[index++] = s0w;
        }
        else
        {
            featureMap[index++] = null;
            featureMap[index++] = null;
        }
        featureMap[index++] = s0p;

        if (b0w != 1)
        {
            featureMap[index++] = b0wp;
            featureMap[index++] = b0w;
        }
        else
        {
            featureMap[index++] = null;
            featureMap[index++] = null;
        }
        featureMap[index++] = b0p;

        if (b1w != 1)
        {
            featureMap[index++] = b1wp;
            featureMap[index++] = b1w;
        }
        else
        {
            featureMap[index++] = null;
            featureMap[index++] = null;
        }
        featureMap[index++] = b1p;

        if (b2w != 1)
        {
            featureMap[index++] = b2wp;
            featureMap[index++] = b2w;
        }
        else
        {
            featureMap[index++] = null;
            featureMap[index++] = null;
        }
        featureMap[index++] = b2p;

        /**
         * from word pairs
         */
        if (s0w != 1 && b0w != 1)
        {
            featureMap[index++] = (s0wp << 28) | b0wp;
            featureMap[index++] = (s0wp << 20) | b0w;
            featureMap[index++] = (s0w << 28) | b0wp;
        }
        else
        {
            featureMap[index++] = null;
            featureMap[index++] = null;
            featureMap[index++] = null;
        }

        if (s0w != 1)
        {
            featureMap[index++] = (s0wp << 8) | b0p;
        }
        else
        {
            featureMap[index++] = null;
        }

        if (b0w != 1)
        {
            featureMap[index++] = (s0p << 28) | b0wp;
        }
        else
        {
            featureMap[index++] = null;
        }

        if (s0w != 1 && b0w != 1)
        {
            featureMap[index++] = (s0w << 20) | b0w;
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = (s0p << 8) | b0p;
        featureMap[index++] = (b0p << 8) | b1p;

        /**
         * from three words
         */
        featureMap[index++] = (b0p << 16) | (b1p << 8) | b2p;
        featureMap[index++] = (s0p << 16) | (b0p << 8) | b1p;
        featureMap[index++] = (sh0p << 16) | (s0p << 8) | b0p;
        featureMap[index++] = (s0p << 16) | (sl0p << 8) | b0p;
        featureMap[index++] = (s0p << 16) | (sr0p << 8) | b0p;
        featureMap[index++] = (s0p << 16) | (b0p << 8) | bl0p;

        /**
         * distance
         */
        long distance = 0;
        if (s0Position > 0 && b0Position > 0)
            distance = Math.abs(b0Position - s0Position);
        if (s0w != 1)
        {
            featureMap[index++] = s0w | (distance << 20);
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = s0p | (distance << 8);
        if (b0w != 1)
        {
            featureMap[index++] = b0w | (distance << 20);
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = b0p | (distance << 8);
        if (s0w != 1 && b0w != 1)
        {
            featureMap[index++] = s0w | (b0w << 20) | (distance << 40);
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = s0p | (b0p << 8) | (distance << 28);

        /**
         * Valency information
         */
        if (s0w != 1)
        {
            featureMap[index++] = s0w | (svr << 20);
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = s0p | (svr << 8);
        if (s0w != 1)
        {
            featureMap[index++] = s0w | (svl << 20);
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = s0p | (svl << 8);
        if (b0w != 1)
        {
            featureMap[index++] = b0w | (bvl << 20);
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = b0p | (bvl << 8);

        /**
         * Unigrams
         */
        if (sh0w != 1)
        {
            featureMap[index++] = sh0w;
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = sh0p;
        featureMap[index++] = s0l;
        if (sl0w != 1)
        {
            featureMap[index++] = sl0w;
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = sl0p;
        featureMap[index++] = sl0l;
        if (sr0w != 1)
        {
            featureMap[index++] = sr0w;
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = sr0p;
        featureMap[index++] = sr0l;
        if (bl0w != 1)
        {
            featureMap[index++] = bl0w;
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = bl0p;
        featureMap[index++] = bl0l;

        /**
         * From third order features
         */
        if (sh1w != 1)
        {
            featureMap[index++] = sh1w;
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = sh1p;
        featureMap[index++] = sh0l;
        if (sl1w != 1)
        {
            featureMap[index++] = sl1w;
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = sl1p;
        featureMap[index++] = sl1l;
        if (sr1w != 1)
        {
            featureMap[index++] = sr1w;
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = sr1p;
        featureMap[index++] = sr1l;
        if (bl1w != 1)
        {
            featureMap[index++] = bl1w;
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = bl1p;
        featureMap[index++] = bl1l;
        featureMap[index++] = s0p | (sl0p << 8) | (sl1p << 16);
        featureMap[index++] = s0p | (sr0p << 8) | (sr1p << 16);
        featureMap[index++] = s0p | (sh0p << 8) | (sh1p << 16);
        featureMap[index++] = b0p | (bl0p << 8) | (bl1p << 16);

        /**
         * label set
         */
        if (s0Position >= 0)
        {
            sdl = state.leftDependentLabels(s0Position);
            sdr = state.rightDependentLabels(s0Position);
        }

        if (b0Position >= 0)
        {
            bdl = state.leftDependentLabels(b0Position);
        }

        if (s0w != 1)
        {
            featureMap[index++] = (s0w + "|" + sdr);
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = (s0p + "|" + sdr);
        if (s0w != 1)
        {
            featureMap[index++] = s0w + "|" + sdl;
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = (s0p + "|" + sdl);
        if (b0w != 1)
        {
            featureMap[index++] = (b0w + "|" + bdl);
        }
        else
        {
            featureMap[index++] = null;
        }
        featureMap[index++] = (b0p + "|" + bdl);
        return featureMap;
    }
110787
public static <II extends ImageGray<II>>
	FastHessianFeatureDetector<II> fastHessian( @Nullable ConfigFastHessian config ) {

		if( config == null )
			config = new ConfigFastHessian();
		config.checkValidity();

		// ignore border is overwritten by Fast Hessian at detection time
		NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(
				new ConfigExtract(config.extractRadius, config.detectThreshold, 0, true));
		return new FastHessianFeatureDetector<>(extractor, config.maxFeaturesPerScale,
				config.initialSampleSize, config.initialSize, config.numberScalesPerOctave,
				config.numberOfOctaves, config.scaleStepSize);
	}