本文整理匯總了Java中ij.process.ImageProcessor.getPixel方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageProcessor.getPixel方法的具體用法?Java ImageProcessor.getPixel怎麽用?Java ImageProcessor.getPixel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ij.process.ImageProcessor
的用法示例。
在下文中一共展示了ImageProcessor.getPixel方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: 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;
}
示例3: getNeighborhoodIndex
import ij.process.ImageProcessor; //導入方法依賴的package包/類
private int getNeighborhoodIndex(ImageProcessor ip, int u, int v) {
int c = 0;
if (ip.getPixel(u+1, v) > 0) c+= 1; // NH[0]
if (ip.getPixel(u+1, v-1) > 0) c+= 2; // NH[1]
if (ip.getPixel(u, v-1) > 0) c+= 4; // NH[2]
if (ip.getPixel(u-1, v-1) > 0) c+= 8; // NH[3]
if (ip.getPixel(u-1, v) > 0) c+= 16; // NH[4]
if (ip.getPixel(u-1, v+1) > 0) c+= 32; // NH[5]
if (ip.getPixel(u, v+1) > 0) c+= 64; // NH[6]
if (ip.getPixel(u+1, v+1) > 0) c+= 128; // NH[7]
return c; // c = 0,...,255
}
示例4: 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();
}