Creates an instance of {@link BackgroundStationaryGaussian}.

@param config Configures the background model
@param imageType Type of input image
@return new instance of the background model
330274
public static <T extends ImageBase<T>>
	BackgroundStationaryGaussian<T> stationaryGaussian(@Nonnull ConfigBackgroundGaussian config , ImageType<T> imageType ) {

		config.checkValidity();

		BackgroundStationaryGaussian<T> ret;

		switch( imageType.getFamily() ) {
			case GRAY:
				ret = new BackgroundStationaryGaussian_SB(config.learnRate,config.threshold,imageType.getImageClass());
				break;

			case PLANAR:
				ret =  new BackgroundStationaryGaussian_PL(config.learnRate,config.threshold,imageType);
				break;

			case INTERLEAVED:
				ret =  new BackgroundStationaryGaussian_IL(config.learnRate,config.threshold,imageType);
				break;

			default:
				throw new IllegalArgumentException("Unknown image type");
		}

		ret.setInitialVariance(config.initialVariance);
		ret.setMinimumDifference(config.minimumDifference);
		ret.setUnknownValue(config.unknownValue);

		return ret;
	}
1152311
public static BufferedImage convertToBufferedImage(Image img) {
        BufferedImage buff = createCompatibleTranslucentImage(
                img.getWidth(null), img.getHeight(null));
        Graphics2D g2 = buff.createGraphics();

        try {
            g2.drawImage(img, 0, 0, null);
        } finally {
            g2.dispose();
        }

        return buff;
    }
804746
public static <T extends ImageBase<T>,Motion extends InvertibleTransform<Motion>>
	BackgroundMovingGaussian<T,Motion> movingGaussian( @Nonnull ConfigBackgroundGaussian config ,
													   Point2Transform2Model_F32<Motion> transform,
													   ImageType<T> imageType ) {

		config.checkValidity();

		BackgroundMovingGaussian<T,Motion> ret;

		switch( imageType.getFamily() ) {
			case GRAY:
				ret = new BackgroundMovingGaussian_SB(config.learnRate,config.threshold,
						transform,config.interpolation,imageType.getImageClass());
				break;

			case PLANAR:
				ret =  new BackgroundMovingGaussian_PL(config.learnRate,config.threshold,
						transform,config.interpolation,imageType);
				break;

			case INTERLEAVED:
				ret =  new BackgroundMovingGaussian_IL(config.learnRate,config.threshold,
						transform,config.interpolation,imageType);
				break;

			default:
				throw new IllegalArgumentException("Unknown image type");
		}

		ret.setInitialVariance(config.initialVariance);
		ret.setMinimumDifference(config.minimumDifference);
		ret.setUnknownValue(config.unknownValue);

		return ret;
	}
289185
protected void paintBackground (Graphics g)
    {
        // simply fill our background color
        g.setColor(getBackground());
        g.fillRect(0, 0, getWidth(), getHeight());
    }
703028
public static LazyGauge maxGauge(MonitorConfig config) {
    return new LazyGauge(Registry::maxGauge, registry, createId(config));
  }
336466
public static <T extends ImageGray<T>, TD extends TupleDesc>
	DetectDescribePoint<T, TD> createFromPremade( Class<T> imageType ) {
		return (DetectDescribePoint)FactoryDetectDescribe.surfStable(
				new ConfigFastHessian(1, 2, 200, 1, 9, 4, 4), null,null, imageType);
//		return (DetectDescribePoint)FactoryDetectDescribe.sift(new ConfigCompleteSift(-1,5,300));
	}
1080619
public static <T extends ImageGray<T>>
	InputToBinary<T> localGaussian(ConfigLength regionWidth, double scale, boolean down, Class<T> inputType) {
		if( BOverrideFactoryThresholdBinary.localGaussian != null )
			return BOverrideFactoryThresholdBinary.localGaussian.handle(regionWidth, scale, down, inputType);
		return new LocalGaussianBinaryFilter<>(regionWidth, scale, down, ImageType.single(inputType));
	}
1030279
public static <T extends ImageBase<T>> BlurStorageFilter<T> mean(ImageType<T> type , int radius ) {
		return new BlurStorageFilter<>("mean", type, radius);
	}
1313019
protected void drawImage(Graphics2D g) {
		// image observer generator
		Function<Integer, ImageObserver> obs = flags->{
			return (image, infoflags, x, y, width, height)->(infoflags & flags)!=flags;
		};
		ImageObserver obs_w = obs.apply(ImageObserver.WIDTH);
		ImageObserver obs_h = obs.apply(ImageObserver.HEIGHT);
		ImageObserver obs_allbits = obs.apply(ImageObserver.ALLBITS);
		
		Image img = this.img;
		if(img != null){
			Point clickPoint = this.clickPoint;
			if(clickPoint == null){
				double imgRatio = img.getWidth(obs_w)*1.0/img.getHeight(obs_h);
				double panelRatio = this.getWidth()*1.0/this.getHeight();
				if(imgRatio > panelRatio) {
					// image wider than panel
					int height = (int) (this.getWidth()/imgRatio);
					int y = (this.getHeight()-height)/2;
					g.drawImage(img, 0, y, this.getWidth(), y+height, 0, 0, img.getWidth(obs_w), img.getHeight(obs_h), obs_allbits);
				} else {
					// image higher than panel
					int width = (int) (this.getHeight()*imgRatio);
					int x = (this.getWidth()-width)/2;
					g.drawImage(img, x, 0, x+width, this.getHeight(), 0, 0, img.getWidth(obs_w), img.getHeight(obs_h), obs_allbits);
				}
			} else {
				float relX = clickPoint.x / (1.0f * this.getWidth());
				float relY = clickPoint.y / (1.0f * this.getHeight());
				int imgW = img.getWidth(obs_w);
				int imgH = img.getHeight(obs_h);
				int imgX = (int) (relX*imgW);
				int imgY = (int) (relY*imgH);
				
				int dx1,dy1,dx2,dy2, sx1,sy1,sx2,sy2;
				dx1 = dy1 = 0;
				dx2 = this.getWidth();
				dy2 = this.getHeight();
				
				sx1 = imgX-this.getWidth()/2;
				sy1 = imgY-this.getHeight()/2;
				sx2 = imgX+this.getWidth()-(this.getWidth()/2);
				sy2 = imgY+this.getHeight()-(this.getHeight()/2);
				
				// manual clipping of image drawing coordinates
				// depending on OS and window manager this may be needed
				// to prevent trail artifacts when moving the image around
				if(sx1 < 0){
					dx1-=sx1; sx1=0;
				}
				if(sy1 < 0){
					dy1-=sy1; sy1=0;
				}
				if(sx2 > imgW){
					dx2-=(sx2-imgW); sx2=imgW;
				}
				if(sy2 > imgH){
					dy2-=(sy2-imgH); sy2=imgH;
				}
				
				g.drawImage(img, 
						dx1, dy1, dx2, dy2, 
						sx1, sy1, sx2, sy2, 
						obs_allbits);
			}
		}
	}
374089
public java.awt.Image createAwtImage(Color foreground, Color background) {
        int f = foreground.getRGB();
        int g = background.getRGB();
        Canvas canvas = new Canvas();
        int barWidth = (int)x;
        if (barWidth <= 0)
            barWidth = 1;
        int barDistance = (int)n;
        if (barDistance <= barWidth)
            barDistance = barWidth + 1;
        int barShort = (int)size;
        if (barShort <= 0)
            barShort = 1;
        int barTall = (int)barHeight;
        if (barTall <= barShort)
            barTall = barShort + 1;
        int width = ((code.length() + 1) * 5 + 1) * barDistance + barWidth;
        int pix[] = new int[width * barTall];
        byte bars[] = getBarsPostnet(code);
        byte flip = 1;
        if (codeType == PLANET) {
            flip = 0;
            bars[0] = 0;
            bars[bars.length - 1] = 0;
        }
        int idx = 0;
        for (int k = 0; k < bars.length; ++k) {
            boolean dot = (bars[k] == flip);
            for (int j = 0; j < barDistance; ++j) {
                pix[idx + j] = ((dot && j < barWidth) ? f : g);
            }
            idx += barDistance;
        }
        int limit = width * (barTall - barShort);
        for (int k = width; k < limit; k += width)
            System.arraycopy(pix, 0, pix, k, width);
        idx = limit;
        for (int k = 0; k < bars.length; ++k) {
            for (int j = 0; j < barDistance; ++j) {
                pix[idx + j] = ((j < barWidth) ? f : g);
            }
            idx += barDistance;
        }
        for (int k = limit + width; k < pix.length; k += width)
            System.arraycopy(pix, limit, pix, k, width);
        Image img = canvas.createImage(new MemoryImageSource(width, barTall, pix, 0, width));
        
        return img;
    }
549551
public static <T extends ImageBase<T>>
	DescribeImageDense<T,TupleDesc_F64> hog(@Nullable ConfigDenseHoG config , ImageType<T> imageType ) {
		if( config == null )
			config = new ConfigDenseHoG();

		config.checkValidity();

		ImageType actualType;
		if( imageType.getDataType() != ImageDataType.F32 ) {
			actualType = new ImageType(imageType.getFamily(),ImageDataType.F32,imageType.getNumBands());
		} else {
			actualType = imageType;
		}

		BaseDenseHog hog;
		if( config.fastVariant ) {
			hog = FactoryDescribeImageDenseAlg.hogFast(config, actualType);
		} else {
			hog = FactoryDescribeImageDenseAlg.hog(config, actualType);
		}

		DescribeImageDenseHoG output = new DescribeImageDenseHoG(hog);

		// If the data type isn't F32 convert it into that data type first
		if( actualType != imageType ) {
			return new DescribeImageDense_Convert<>(output, imageType);
		} else {
			return output;
		}
	}
378543
public static <D extends ImageGray<D>>
	OrientationHistogramSift<D> sift(ConfigSiftOrientation config , Class<D> derivType ) {
		if( config == null )
			config = new ConfigSiftOrientation();
		config.checkValidity();

		return new OrientationHistogramSift(config.histogramSize,config.sigmaEnlarge,derivType);
	}
1248992
protected BufferedImage create_BACKGROUND_Image(final int WIDTH, final String TITLE, final String UNIT_STRING) {
        return create_BACKGROUND_Image(WIDTH, TITLE, UNIT_STRING, null);
    }
348938
public JawrConfigManagerMBean getConfigMgr(String resourceType) {

		JawrConfigManagerMBean configMgr = null;
		if (resourceType.equals(JS_TYPE)) {
			configMgr = jsMBean;
		} else if (resourceType.equals(CSS_TYPE)) {
			configMgr = cssMBean;
		} else if (resourceType.equals(BINARY_TYPE)) {
			configMgr = binaryMBean;
		}

		return configMgr;
	}
713774
public static Config createConfig(Config config) {
    try {
      // We cannot use the libraries layer as the nf-archaius2-platform-bridge
      // will delegate the Config binding to archaius1 and the libraries layer
      // then wraps that. So anything added to the libraries layer will not get
      // picked up by anything injecting Config.
      //
      // Instead we just create a composite where the injected config will override
      // the prop files. If no config binding is present use the environment and
      // system properties config.
      CompositeConfig cc = new DefaultCompositeConfig(true);
      cc.addConfig("ATLAS", loadPropFiles());
      cc.addConfig("ENVIRONMENT", EnvironmentConfig.INSTANCE);
      cc.addConfig("SYS", SystemConfig.INSTANCE);

      if (config != null) {
        LOGGER.debug("found injected config, adding as override layer");
        cc.addConfig("INJECTED", config);
      } else {
        LOGGER.debug("no injected config found");
      }

      return cc;
    } catch (ConfigException e) {
      throw new IllegalStateException("failed to load atlas config", e);
    }
  }
223870
protected function createBackgroundImageFromType($backgroundImage, $imageType)
    {
        switch ($imageType) {
            case 'image/jpeg':
                $image = imagecreatefromjpeg($backgroundImage);
                break;
            case 'image/png':
                $image = imagecreatefrompng($backgroundImage);
                break;
            case 'image/gif':
                $image = imagecreatefromgif($backgroundImage);
                break;

            default:
                throw new Exception('Not supported file type for background image!');
                break;
        }

        return $image;
    }
325333
public static <T extends ImageBase<T>> BlurStorageFilter<T> gaussian(ImageType<T> type , double sigma , int radius ) {
		return new BlurStorageFilter<>("gaussian", type, sigma, radius);
	}