本文整理匯總了Java中ij.process.ImageProcessor.setf方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageProcessor.setf方法的具體用法?Java ImageProcessor.setf怎麽用?Java ImageProcessor.setf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ij.process.ImageProcessor
的用法示例。
在下文中一共展示了ImageProcessor.setf方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: copyResultToImage
import ij.process.ImageProcessor; //導入方法依賴的package包/類
void copyResultToImage(ImageProcessor ip) {
final int[] pixel = new int[K];
if (ip instanceof ColorProcessor) {
for (int u = 0; u < M; u++) {
for (int v = 0; v < N; v++) {
for (int k = 0; k < K; k++) {
int c = params.useLinearRgb ?
Math.round(rgbToSrgb(I[k][u][v])) :
Math.round(I[k][u][v]);
if (c < 0) c = 0;
if (c > 255) c = 255;
pixel[k] = c;
}
ip.putPixel(u,v,pixel);
}
}
}
else { // 8-bit, 16-bit or 32-bit (float) processor
for (int u = 0; u < M; u++) {
for (int v = 0; v < N; v++) {
ip.setf(u, v, I[0][u][v]);
}
}
}
}
示例2: 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 ;
}
}
}
示例3: 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);
}
}
}