Returns a QR Code detector

@param config Configuration
@param imageType type of input image
@return the detector
329213
public static <T extends ImageGray<T>>
	QrCodePreciseDetector<T> qrcode(ConfigQrCode config, Class<T> imageType) {
		if( config == null )
			config = new ConfigQrCode();

		config.checkValidity();

		InputToBinary<T> inputToBinary = FactoryThresholdBinary.threshold(config.threshold,imageType);

		DetectPolygonBinaryGrayRefine<T> squareDetector = FactoryShapeDetector.polygon(config.polygon, imageType);
		QrCodePositionPatternDetector<T> detectPositionPatterns =
				new QrCodePositionPatternDetector<>(squareDetector,config.versionMaximum);

		return new QrCodePreciseDetector<>(inputToBinary,detectPositionPatterns, config.forceEncoding,false, imageType);
	}
277885
public static <T extends ImageGray<T>>
	InputToBinary<T> threshold( ConfigThreshold config, Class<T> inputType) {

		switch( config.type ) {
			case FIXED:
				return globalFixed(config.fixedThreshold, config.down, inputType);

			case GLOBAL_OTSU:
				return globalOtsu(config.minPixelValue, config.maxPixelValue, config.scale, config.down, inputType);

			case GLOBAL_ENTROPY:
				return globalEntropy(config.minPixelValue, config.maxPixelValue, config.scale, config.down, inputType);

			case GLOBAL_LI:
				return globalLi(config.minPixelValue, config.maxPixelValue, config.scale, config.down, inputType);

			case GLOBAL_HUANG:
				return globalHuang(config.minPixelValue, config.maxPixelValue, config.scale, config.down, inputType);

			case LOCAL_GAUSSIAN:
				return localGaussian(config.width, config.scale, config.down, inputType);

			case LOCAL_SAVOLA:
				return localSauvola(config.width, config.down, config.savolaK, inputType);

			case LOCAL_NICK:
				return localNick(config.width, config.down, config.nickK, inputType);

			case LOCAL_MEAN:
				return localMean(config.width, config.scale, config.down, inputType);

			case LOCAL_OTSU: {
				ConfigThresholdLocalOtsu c = (ConfigThresholdLocalOtsu) config;
				return localOtsu(config.width, config.scale, config.down, c.useOtsu2, c.tuning, inputType);
			}

			case BLOCK_MIN_MAX: {
				ConfigThresholdBlockMinMax c = (ConfigThresholdBlockMinMax) config;
				return blockMinMax(c.width, c.scale , c.down, c.thresholdFromLocalBlocks, c.minimumSpread,
						inputType);
			}

			case BLOCK_MEAN:
				return blockMean(config.width, config.scale , config.down,
						config.thresholdFromLocalBlocks, inputType);

			case BLOCK_OTSU: {
				ConfigThresholdLocalOtsu c = (ConfigThresholdLocalOtsu) config;
				return blockOtsu(c.width, c.scale, c.down, c.thresholdFromLocalBlocks, c.useOtsu2, c.tuning,
						inputType);
			}

		}
		throw new IllegalArgumentException("Unknown type "+config.type);
	}
605684
public static SiftDetector sift( @Nullable ConfigSiftScaleSpace configSS , @Nullable ConfigSiftDetector configDetector ) {

		if( configSS == null )
			configSS = new ConfigSiftScaleSpace();

		if( configDetector == null )
			configDetector = new ConfigSiftDetector();

		NonMaxLimiter nonmax = FactoryFeatureExtractor.nonmaxLimiter(
				configDetector.extract,configDetector.maxFeaturesPerScale);
		SiftScaleSpace ss = new SiftScaleSpace(configSS.firstOctave,configSS.lastOctave,
				configSS.numScales,configSS.sigma0);
		return new SiftDetector(ss,configDetector.edgeR,nonmax);
	}
1132194
public static <T extends ImageGray<T>>
	DenseOpticalFlow<T> hornSchunckPyramid( @Nullable ConfigHornSchunckPyramid config , Class<T> imageType )
	{
		if( config == null )
			config = new ConfigHornSchunckPyramid();

		InterpolatePixelS<GrayF32> interpolate =
				FactoryInterpolation.createPixelS(0,255,config.interpolation, BorderType.EXTENDED, GrayF32.class);

		HornSchunckPyramid<T> alg = new HornSchunckPyramid<>(config, interpolate);

		return new HornSchunckPyramid_to_DenseOpticalFlow<>(alg, imageType);
	}
114267
protected static int getBytesPerPixel(Bitmap.Config config) {
        if (config == Bitmap.Config.ARGB_8888) {
            return 4;
        } else if (config == Bitmap.Config.RGB_565) {
            return 2;
        } else if (config == Bitmap.Config.ARGB_4444) {
            return 2;
        } else if (config == Bitmap.Config.ALPHA_8) {
            return 1;
        }
        return 1;
    }
1275609
public static <T extends ImageBase<T>>ImageSuperpixels<T>
	slic( @Nullable ConfigSlic config , ImageType<T> imageType )
	{
		SegmentSlic<T> ms = FactorySegmentationAlg.slic(config, imageType);

		return new Slic_to_ImageSuperpixels<>(ms);
	}
962206
protected ImageDescriptor imageDescriptor(SarlBehavior element) {
		final JvmDeclaredType jvmElement = this.jvmModelAssociations.getInferredType(element);
		return this.images.forBehavior(
				element.getVisibility(),
				this.adornments.get(jvmElement));
	}
1134345
public static ConfigQrCode fast() {
		// A global threshold is faster than any local algorithm
		// plus it will generate a simpler set of internal contours speeding up that process
		ConfigQrCode config = new ConfigQrCode();
		config.threshold = ConfigThreshold.global(ThresholdType.GLOBAL_OTSU);
		return config;
	}
571641
public static function sort_qtype_array($qtypes, $config = null) {
        if (is_null($config)) {
            $config = self::get_config();
        }

        $sortorder = array();
        $otherqtypes = array();
        foreach ($qtypes as $name => $localname) {
            $sortvar = $name . '_sortorder';
            if (isset($config->$sortvar)) {
                $sortorder[$config->$sortvar] = $name;
            } else {
                $otherqtypes[$name] = $localname;
            }
        }

        ksort($sortorder);
        core_collator::asort($otherqtypes);

        $sortedqtypes = array();
        foreach ($sortorder as $name) {
            $sortedqtypes[$name] = $qtypes[$name];
        }
        foreach ($otherqtypes as $name => $notused) {
            $sortedqtypes[$name] = $qtypes[$name];
        }
        return $sortedqtypes;
    }
314439
public static <T extends ImageGray<T>>
	DescribeImageDense<T,TupleDesc_F64> sift(@Nullable ConfigDenseSift config , Class<T> imageType ) {
		if( config == null )
			config = new ConfigDenseSift();

		config.checkValidity();

		ConfigSiftDescribe c = config.sift;

		Class derivType = GImageDerivativeOps.getDerivativeType(imageType);

		DescribeDenseSiftAlg alg = new DescribeDenseSiftAlg(c.widthSubregion,c.widthGrid,
				c.numHistogramBins,c.weightingSigmaFraction,c.maxDescriptorElementValue,1,1,derivType);

		return new DescribeImageDenseSift(alg,config.sampling.periodX,config.sampling.periodY,imageType);
	}
125618
public static void addOptionalFeatures(ImageRequestBuilder imageRequestBuilder, Config config) {
    if (config.usePostprocessor) {
      final Postprocessor postprocessor;
      switch (config.postprocessorType) {
        case "use_slow_postprocessor":
          postprocessor = DelayPostprocessor.getMediumPostprocessor();
          break;
        case "use_fast_postprocessor":
          postprocessor = DelayPostprocessor.getFastPostprocessor();
          break;
        default:
          postprocessor = DelayPostprocessor.getMediumPostprocessor();
      }
      imageRequestBuilder.setPostprocessor(postprocessor);
    }
    if (config.rotateUsingMetaData) {
      imageRequestBuilder.setRotationOptions(RotationOptions.autoRotateAtRenderTime());
    } else {
      imageRequestBuilder
          .setRotationOptions(RotationOptions.forceRotation(config.forcedRotationAngle));
    }
  }
1287377
public function getQrImage(bool $setPngHeader = false): QrCode
    {
        if (!class_exists("Endroid\QrCode\QrCode")) {
            throw new QrPaymentException("Error: library endroid/qr-code is not loaded.", QrPaymentException::ERR_MISSING_LIBRARY);
        }

        if ($setPngHeader) {
            header("Content-type: image/png");
        }

        return new QrCode($this->getQrString());
    }
51859
public static Triangulate2ViewsMetric triangulate2ViewMetric(@Nullable ConfigTriangulation config ) {
		if( config == null )
			config = new ConfigTriangulation();

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

			case GEOMETRIC:
				return new Wrap2ViewsTriangulateGeometric();

		}
		throw new IllegalArgumentException("Unknown or unsupported type "+config.type);
	}
1246178
private AbstractInterfaceConfig getRegisterConfig(ConsumerConfig config) {
        String url = ZookeeperRegistryHelper.convertConsumerToUrl(config);
        String addr = url.substring(0, url.indexOf("?"));
        for (Map.Entry<ConsumerConfig, String> consumerUrl : consumerUrls.entrySet()) {
            if (consumerUrl.getValue().contains(addr)) {
                return consumerUrl.getKey();
            }
        }
        return null;
    }
219149
public static RenderedImage toRenderedImage(Image img) {
		if (img instanceof RenderedImage) {
			return (RenderedImage) img;
		}

		return copyImage(img, BufferedImage.TYPE_INT_RGB);
	}
872585
@SuppressWarnings("unchecked")
	public <T> Converter<T> getCustomConverter(Type type) {
		return (null == customConverterMap) ? null : (Converter<T>) customConverterMap.get(type);
	}
569136
function getFileTypeReg(type) {
    var map = [],
        ext = ""; // fis.config.get('project.fileType.' + type);
    if (type === 'text') {
        map = TEXT_FILE_EXTS;
    } else if (type === 'image') {
        map = IMAGE_FILE_EXTS;
    } else {
        xgulp.log.error('invalid file type [%s]', type);
    }
    if (ext && ext.length) {
        if (typeof ext === 'string') {
            ext = ext.split(/\s*,\s*/);
        }
        map = map.concat(ext);
    }
    map = map.join('|');
    return new RegExp('\\.(?:' + map + ')$', 'i');
}