當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageProcessor.getWidth方法代碼示例

本文整理匯總了Java中ij.process.ImageProcessor.getWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageProcessor.getWidth方法的具體用法?Java ImageProcessor.getWidth怎麽用?Java ImageProcessor.getWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ij.process.ImageProcessor的用法示例。


在下文中一共展示了ImageProcessor.getWidth方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getmaxpositions

import ij.process.ImageProcessor; //導入方法依賴的package包/類
/** Gets x and y coordinates of maximum intensity pixel on image. */	
int [] getmaxpositions(ImageProcessor ipp)
{
	int [] results = new int [2];
	results[0]=0;
	results[1]=0;

	double s;
	double smax=Double.MIN_VALUE;
	
	for (int i=0;i<ipp.getWidth();i++)
	{
		for (int j=0;j<ipp.getHeight();j++)
		{
			s=ipp.get(i, j);	
			if (s>smax)
			{
				smax=s;
				results[0]=i;
				results[1]=j;
			}
		}
	}
	return results;		
}
 
開發者ID:ekatrukha,項目名稱:Correlescence,代碼行數:26,代碼來源:Correlescence2D.java

示例2: pad

import ij.process.ImageProcessor; //導入方法依賴的package包/類
/** 
* some parts from ij.plugin.FFT code
*  
* */
  ImageProcessor pad(ImageProcessor ip) 
  {
      int originalWidth = ip.getWidth();
      int originalHeight = ip.getHeight();
      int maxN = Math.max(originalWidth, originalHeight);
      int i = 2;
      while(i<maxN) i *= 2;
      if (i==maxN && originalWidth==originalHeight) 
      {
      
          return ip;
      }
      maxN = i;
 
      ImageStatistics stats = ImageStatistics.getStatistics(ip, ImageStatistics.MEAN, null);
      ImageProcessor ip2 = ip.createProcessor(maxN, maxN);
      ip2.setValue(stats.mean);
      ip2.fill();
      ip2.insert(ip, 0, 0);

      Undo.reset();
      //new ImagePlus("padded", ip2.duplicate()).show();
      return ip2;
  }
 
開發者ID:ekatrukha,項目名稱:Correlescence,代碼行數:29,代碼來源:ImCrossCorrelation.java

示例3: padzeros

import ij.process.ImageProcessor; //導入方法依賴的package包/類
ImageProcessor padzeros(ImageProcessor ip) 
{
    int originalWidth = ip.getWidth();
    int originalHeight = ip.getHeight();
    int maxN = Math.max(originalWidth, originalHeight);
    int i = 2;
    while(i<maxN) i *= 2;
    if (i==maxN && originalWidth==originalHeight) 
    {
    
        return ip;
    }
    maxN = i;
   
    ImageProcessor ip2 = ip.createProcessor(maxN, maxN);
    ip2.setValue(0);
    ip2.fill();
    ip2.insert(ip, 0, 0);
  
    Undo.reset();
    //new ImagePlus("padded", ip2.duplicate()).show();
    return ip2;
}
 
開發者ID:ekatrukha,項目名稱:Correlescence,代碼行數:24,代碼來源:ImCrossCorrelation.java

示例4: applyTo

import ij.process.ImageProcessor; //導入方法依賴的package包/類
public void applyTo(ImageProcessor ip) {
	M = ip.getWidth();
	N = ip.getHeight();
	FilterOperator fm = null;
	if (ip instanceof ColorProcessor) {
		switch (params.colorMode) {
		case SeparateChannels : 	fm = new FilterColorSeparate(); break;
		case BrightnessGradient : 	fm = new FilterColorBrightnessGradient(); break;
		case ColorGradient : 	  	fm = new FilterColorColorGradient(); break;
		}
	}
	else {
		fm = new FilterScalar();
	}
		fm.filter(ip);
}
 
開發者ID:imagingbook,項目名稱:imagingbook-common,代碼行數:17,代碼來源:PeronaMalikFilter.java

示例5: draw

import ij.process.ImageProcessor; //導入方法依賴的package包/類
/**
 * This is a brute-force drawing method which simply marks all
 * image pixels that are sufficiently close to the HoughLine hl.
 * The drawing color for ip must be previously set.
 * @param ip The ImageProcessor to draw to.
 * @param thickness The thickness of the lines to be drawn.
 */
public void draw(ImageProcessor ip, double thickness) {
	final int w = ip.getWidth();
	final int h = ip.getHeight();
	final double dmax = 0.5 * thickness;
	for (int u = 0; u < w; u++) {
		for (int v = 0; v < h; v++) {
			// get the distance between (u,v) and the line hl:
			double d = Math.abs(this.getDistance(u, v));
			if (d <= dmax) {
				ip.drawPixel(u, v);
			}
		}
	}
	
}
 
開發者ID:imagingbook,項目名稱:imagingbook-common,代碼行數:23,代碼來源:HoughTransformLines.java

示例6: extractImage

import ij.process.ImageProcessor; //導入方法依賴的package包/類
/**
 * Fills the image {@code R} from the source image 
 * {@code I} (referenced by {@code this} object).
 * The image {@code R} is extracted from a quadrilateral patch of the source image,
 * defined by the transformation of the boundary of {@code R} by {@code T(x)}.
 * Grayscale and color images my not be mixed (i.e., {@code R} must be of the same type as {@code I}).
 * @param R the image to be filled.
 * @param T a {@link LinearMapping} object.
 */	
public void extractImage(ImageProcessor R, LinearMapping T) {
	int prevInterpolationMethod = I.getInterpolationMethod();
	// save current interpolation method
	I.setInterpolationMethod(interpolationMethod);
	
	ImageAccessor iaI = ImageAccessor.create(I);
	ImageAccessor iaR = ImageAccessor.create(R);

	int wT = R.getWidth();
	int hT = R.getHeight();
	for (int u = 0; u < wT; u++) {
		for (int v = 0; v < hT; v++) {
			Point2D uv = new Point(u, v);
			Point2D xy = T.applyTo(uv);
			float[] val = iaI.getPix(xy.getX(), xy.getY());
			iaR.setPix(u, v, val);
		}
	}
	// restore interpolation method
	I.setInterpolationMethod(prevInterpolationMethod);
}
 
開發者ID:imagingbook,項目名稱:imagingbook-common,代碼行數:31,代碼來源:ImageExtractor.java

示例7: moment

import ij.process.ImageProcessor; //導入方法依賴的package包/類
public static double moment(ImageProcessor I, int p, int q) {
	double Mpq = 0.0;
	for (int v = 0; v < I.getHeight(); v++) { 
		for (int u = 0; u < I.getWidth(); u++) { 
			if (I.getPixel(u, v) != BACKGROUND) {
				Mpq+= Math.pow(u, p) * Math.pow(v, q);
			}
		}
	}
	return Mpq;
}
 
開發者ID:imagingbook,項目名稱:imagingbook-common,代碼行數:12,代碼來源:BinaryMoments.java

示例8: centralMoment

import ij.process.ImageProcessor; //導入方法依賴的package包/類
public static double centralMoment(ImageProcessor I, int p, int q) {
	double m00  = moment(I, 0, 0);	// region area
	double xCtr = moment(I, 1, 0) / m00;
	double yCtr = moment(I, 0, 1) / m00;
	double cMpq = 0.0;
	for (int v = 0; v < I.getHeight(); v++) { 
		for (int u = 0; u < I.getWidth(); u++) {
			if (I.getPixel(u, v) != BACKGROUND) { 
				cMpq+= Math.pow(u - xCtr, p) * Math.pow(v - yCtr, q);
			}
		}
	}
	return cMpq;
}
 
開發者ID:imagingbook,項目名稱:imagingbook-common,代碼行數:15,代碼來源:BinaryMoments.java

示例9: applyTo

import ij.process.ImageProcessor; //導入方法依賴的package包/類
/**
 * Transforms the source image (contained in "srcInterpol") to the "target"
 * image using this geometric mapping and the specified pixel interpolator.
 * 
 * @param sourceAcc accessor to the source image
 * @param targetAcc accessor to the target image
 */
public void applyTo(ImageAccessor sourceAcc, ImageAccessor targetAcc) {
	Mapping invMap = this.getInverse(); // get inverse mapping
	ImageProcessor target = targetAcc.getProcessor();
	final int w = target.getWidth();
	final int h = target.getHeight();
	for (int v = 0; v < h; v++) {
		for (int u = 0; u < w; u++) {
			Point2D sourcePt = invMap.applyTo(new Point(u, v));
			float[] val = sourceAcc.getPix(sourcePt.getX(),sourcePt.getY());
			targetAcc.setPix(u, v, val);
		}
	}
}
 
開發者ID:imagingbook,項目名稱:imagingbook-common,代碼行數:21,代碼來源:Mapping.java

示例10: initialize

import ij.process.ImageProcessor; //導入方法依賴的package包/類
private void initialize(ImageProcessor ip) {
		M = ip.getWidth(); 
		N = ip.getHeight(); 
		K = (ip instanceof ColorProcessor) ? 3 : 1;
		I  = new float[K][M][N];
		Dx  = new float[K][M][N];
		Dy  = new float[K][M][N];
		G = new float[3][M][N];
		A = new float[3][M][N];
		B = new float[K][M][N];
//		Hk = new float[3][M][N];

		if (ip instanceof ColorProcessor) {
			final int[] pixel = new int[K];	
			for (int u = 0; u < M; u++) {
				for (int v = 0; v < N; v++) {
					ip.getPixel(u, v, pixel);
					for (int k = 0; k < K; k++) {
						float c = pixel[k];
						I[k][u][v] = params.useLinearRgb ? srgbToRgb(c) : c;
					}
				}
			}
		}
		else {	// 8-bit, 16-bit or 32-bit (float) processor
			for (int u = 0; u < M; u++) {
				for (int v = 0; v < N; v++) {
					I[0][u][v] = ip.getf(u,v);
				}
			}
		}
		getImageMinMax();
	}
 
開發者ID:imagingbook,項目名稱:imagingbook-common,代碼行數:34,代碼來源:TschumperleDericheFilter.java

示例11: CannyEdgeDetector

import ij.process.ImageProcessor; //導入方法依賴的package包/類
public CannyEdgeDetector(ImageProcessor I, Parameters params) {
		if (params.isInValid()) throw new IllegalArgumentException();
		this.params = params;
//		this.I = I;
		M = I.getWidth();
		N = I.getHeight();
		makeGradientsAndMagnitude(I);
	}
 
開發者ID:imagingbook,項目名稱:imagingbook-common,代碼行數:9,代碼來源:CannyEdgeDetector.java

示例12: ImageAccessor

import ij.process.ImageProcessor; //導入方法依賴的package包/類
private ImageAccessor(ImageProcessor ip, OutOfBoundsStrategy obs, InterpolationMethod ipm) {
	this.width  = ip.getWidth();
	this.height = ip.getHeight();
	this.outOfBoundsStrategy = (obs != null) ? obs : DefaultOutOfBoundsStrategy;
	this.interpolationMethod = (ipm != null) ? ipm : DefaultInterpolationMethod;
	this.indexer = PixelIndexer.create(width, height, outOfBoundsStrategy);
}
 
開發者ID:imagingbook,項目名稱:imagingbook-common,代碼行數:8,代碼來源:ImageAccessor.java

示例13: drawLine

import ij.process.ImageProcessor; //導入方法依賴的package包/類
private void drawLine(int x, int y, int x2, int y2, ImageProcessor ip, long time) {
    int w = x2 - x ;
    int h = y2 - y ;
    int dx1, dy1, dx2, dy2;

    dx1 = (w < 0) ? -1 : 1;
    dy1 = (h < 0) ? -1 : 1;
    dx2 = (w < 0) ? -1 : 1;
    dy2 = (h < 0) ? -1 : 1;

    int longest = Math.abs(w) ;
    int shortest = Math.abs(h) ;
    if (!(longest > shortest)) {
        longest = Math.abs(h) ;
        shortest = Math.abs(w) ;
        dy2 = h < 0 ? -1: 1;
        dx2 = 0 ;
    }
    int numerator = longest >> 1;
    for (int i = 0; i <= longest; i++) {
        if(x > 0 && y > 0 && x < ip.getWidth() && y < ip.getHeight())
            ip.setf(x,y, ip.getf(x, y) + time);
        numerator += shortest ;
        if (!(numerator<longest)) {
            numerator -= longest ;
            x += dx1 ;
            y += dy1 ;
        } else {
            x += dx2 ;
            y += dy2 ;
        }
    }
}
 
開發者ID:Alanocallaghan,項目名稱:qupath-tracking-extension,代碼行數:34,代碼來源:HeatmapOverlay.java

示例14: fillRectangle

import ij.process.ImageProcessor; //導入方法依賴的package包/類
private void fillRectangle(Rectangle rectangle, ImageProcessor ip, long time) {
    int x = (int)rectangle.getX();
    int y = (int)rectangle.getY();
    int w = (int)rectangle.getWidth();
    int h = (int)rectangle.getHeight();

    for(int i = x; i < x + w; i++) {
        for(int j = y; j < y + h; j++) {
            if(i >=0 && j >= 0 && i < ip.getWidth() && j < ip.getHeight())
                ip.setf(i, j, ip.getf(i, j) + time);
        }
    }
}
 
開發者ID:Alanocallaghan,項目名稱:qupath-tracking-extension,代碼行數:14,代碼來源:HeatmapOverlay.java

示例15: getFOVSize

import ij.process.ImageProcessor; //導入方法依賴的package包/類
@Override
public double getFOVSize() {
    ImageProcessor ip = stack.getProcessor(count);
    return getObjectSpacePixelSize()*getObjectSpacePixelSize()*ip.getWidth()*ip.getHeight();
}
 
開發者ID:LEB-EPFL,項目名稱:SASS,代碼行數:6,代碼來源:TiffGenerator.java


注:本文中的ij.process.ImageProcessor.getWidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。