本文整理匯總了Java中ij.process.ImageProcessor.getf方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageProcessor.getf方法的具體用法?Java ImageProcessor.getf怎麽用?Java ImageProcessor.getf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ij.process.ImageProcessor
的用法示例。
在下文中一共展示了ImageProcessor.getf方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}
示例2: calcDirectCorrelationImage
import ij.process.ImageProcessor; //導入方法依賴的package包/類
/** Function calculates slow (direct) cross correlation between to images
* by shifting them and calculating result
* **/
public ImageProcessor calcDirectCorrelationImage(ImageProcessor ipp1, ImageProcessor ipp2)
{
ImageProcessor ip1,ip2;
//to have the same size as FFT cross correlation for comparison
ip1=padzeros(ipp1);
ip2=padzeros(ipp2);
//int originalWidth = ip1.getWidth();
//int originalHeight = ip1.getHeight();
int nCorrW = ip1.getWidth();
double dCC;//,dCC1,dCC2;
int i,j,m,n;
double val1,val2;
//double mean1,mean2;
//mean1 = ImageStatistics.getStatistics(ip1,Measurements.MEAN,null).mean;
//mean2 = ImageStatistics.getStatistics(ip2,Measurements.MEAN,null).mean;
FloatProcessor crosscorr= new FloatProcessor (nCorrW,nCorrW);
int dx,dy;
int dMaxx=(int)Math.round(nCorrW*0.5-1);
int dMaxy=(int)Math.round(nCorrW*0.5-1);
//correlation shifts
for (dx=-dMaxx;dx<=dMaxx;dx++)
for (dy=-dMaxy;dy<=dMaxy;dy++)
{
//now calculate correlation value for these shifts
dCC=0;
//dCC1=0;
//dCC2=0;
for(i=0;i<nCorrW;i++)
for(j=0;j<nCorrW;j++)
{
m=i+dx;
n=j+dy;
if(m>-1 &&m<nCorrW&& n>-1 &&n<nCorrW)
{
val1=ip1.getf(m,n);//-mean1;
val2=ip2.getf(i,j);//-mean2;
dCC+=val1*val2;
//dCC1+=val1*val1;
//dCC2+=val2*val2;
}
}
//if(dCC1!=0.0 && dCC2!=0.0)
//crosscorr.setf(dx+(int)(nCorrW*0.5),dy+(int)(nCorrW*0.5),(float)(dCC/(Math.sqrt(dCC1)*Math.sqrt(dCC2))));
crosscorr.setf(dx+(int)(nCorrW*0.5),dy+(int)(nCorrW*0.5),(float)(dCC));
//else
//crosscorr.setf(dx+(int)(nCorrW*0.5),dy+(int)(nCorrW*0.5),0);
}
//normalization
ImageProcessor normIP;
float dVal;
normIP = calcNormCorrelationCoeff(ip1,ip2);
for(i=0;i<nCorrW;i++)
for(j=0;j<nCorrW;j++)
{
dVal=crosscorr.getf(i,j)/normIP.getf(i,j);
crosscorr.setf(i,j,dVal);
}
return crosscorr;
}