//@Override public Image process(Image imageIn) { clone = imageIn.clone(); int width = imageIn.getWidth(); int height = imageIn.getHeight(); for(int x = 0 ; x < width; x++){ for(int y = 0 ; y < height ; y++){ double un_x = 0, un_y = 0 ; double[] result = calc_undistorted_coord (x, y, un_x, un_y) ; un_x = result[0];un_y = result[1]; int crNull = 0xFFFFFF;//WHITE int cr = crNull ; if ( (un_x > -1) && (un_x < width) && (un_y > -1) && (un_y < height) ) { // only this range is valid int nSrcX = ((un_x < 0) ? -1 : (int)un_x); int nSrcY = ((un_y < 0) ? -1 : (int)un_y); int nSrcX_1 = nSrcX + 1; int nSrcY_1 = nSrcY + 1; int[] color = new int[4]; color[0] = IsInside(width, height, nSrcX, nSrcY) ? clone.getPixelColor(nSrcX,nSrcY) : crNull; color[1] = IsInside(width, height, nSrcX_1, nSrcY) ? clone.getPixelColor(nSrcX_1,nSrcY) : crNull; color[2] = IsInside(width, height, nSrcX, nSrcY_1) ? clone.getPixelColor(nSrcX,nSrcY_1) : crNull; color[3] = IsInside(width, height, nSrcX_1, nSrcY_1) ? clone.getPixelColor(nSrcX_1,nSrcY_1) : crNull; cr = GetBilinear(un_x-nSrcX, un_y-nSrcY, color); } imageIn.setPixelColor(x, y, cr); } } return imageIn; }
//@Override public Image process(Image imageIn) { clone = imageIn.clone(); int width = imageIn.getWidth(); int height = imageIn.getHeight(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { double un_x = 0, un_y = 0; double[] result = calc_undistorted_coord(x, y, un_x, un_y); un_x = result[0]; un_y = result[1]; int crNull = 0xFFFFFF; //WHITE int cr = crNull; if ((un_x > -1) && (un_x < width) && (un_y > -1) && (un_y < height)) { // only this range is valid int nSrcX = ((un_x < 0) ? -1 : (int)un_x); int nSrcY = ((un_y < 0) ? -1 : (int)un_y); int nSrcX_1 = nSrcX + 1; int nSrcY_1 = nSrcY + 1; int[] color = new int[4]; color[0] = IsInside(width, height, nSrcX, nSrcY) ? clone.getPixelColor(nSrcX, nSrcY) : crNull; color[1] = IsInside(width, height, nSrcX_1, nSrcY) ? clone.getPixelColor(nSrcX_1, nSrcY) : crNull; color[2] = IsInside(width, height, nSrcX, nSrcY_1) ? clone.getPixelColor(nSrcX, nSrcY_1) : crNull; color[3] = IsInside(width, height, nSrcX_1, nSrcY_1) ? clone.getPixelColor(nSrcX_1, nSrcY_1) : crNull; cr = GetBilinear(un_x - nSrcX, un_y - nSrcY, color); } imageIn.setPixelColor(x, y, cr); } } return(imageIn); }
public override Image process(Image imageIn) { int matt = imageIn.getWidth(); int width = matt; int height = imageIn.getHeight(); if ((_point.X + _point.Y) <= 0) { _point.X = width / 2; _point.Y = height / 2; } _scolor = matt * 0.0375; _sglow = matt * 0.078125; _sinner = matt * 0.1796875; _souter = matt * 0.3359375; _shalo = matt * 0.084375; _color.r = 239.0 / 255.0; _color.g = 239.0 / 255.0; _color.b = 239.0 / 255.0; _glow.r = 245.0 / 255.0; _glow.g = 245.0 / 255.0; _glow.b = 245.0 / 255.0; _inner.r = 255.0 / 255.0; _inner.g = 38.0 / 255.0; _inner.b = 43.0 / 255.0; _outer.r = 69.0 / 255.0; _outer.g = 59.0 / 255.0; _outer.b = 64.0 / 255.0; _halo.r = 80.0 / 255.0; _halo.g = 15.0 / 255.0; _halo.b = 4.0 / 255.0; initref((int)_point.X, (int)_point.Y, width, imageIn.getHeight(), matt); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { double hyp = FHypot(x - _point.X, y - _point.Y); int color = imageIn.getPixelColor(x, y); color = mcolor(color, hyp); /* make color */ color = mglow(color, hyp); /* make _glow */ color = minner(color, hyp); /* make _inner */ color = mouter(color, hyp); /* make _outer */ color = mhalo(color, hyp); /* make _halo */ for (int i = 0; i < _numref; i++) { switch (_reflect[i].type) { case 1: { color = mrt1(color, _reflect[i], x, y); break; } case 2: { color = mrt2(color, _reflect[i], x, y); break; } case 3: { color = mrt3(color, _reflect[i], x, y); break; } case 4: { color = mrt4(color, _reflect[i], x, y); break; } } } imageIn.setPixelColor(x, y, color); } } return(imageIn); }
public override Image process(Image imageIn) { int matt = imageIn.getWidth(); int width = matt; int height = imageIn.getHeight(); if ((_point.X + _point.Y) <= 0) { _point.X = width / 2; _point.Y = height / 2; } _scolor = matt * 0.0375; _sglow = matt * 0.078125; _sinner = matt * 0.1796875; _souter = matt * 0.3359375; _shalo = matt * 0.084375; _color.r = 239.0 / 255.0; _color.g = 239.0 / 255.0; _color.b = 239.0 / 255.0; _glow.r = 245.0 / 255.0; _glow.g = 245.0 / 255.0; _glow.b = 245.0 / 255.0; _inner.r = 255.0 / 255.0; _inner.g = 38.0 / 255.0; _inner.b = 43.0 / 255.0; _outer.r = 69.0 / 255.0; _outer.g = 59.0 / 255.0; _outer.b = 64.0 / 255.0; _halo.r = 80.0 / 255.0; _halo.g = 15.0 / 255.0; _halo.b = 4.0 / 255.0; initref((int)_point.X, (int)_point.Y, width, imageIn.getHeight(), matt); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { double hyp = FHypot(x - _point.X, y - _point.Y); int color = imageIn.getPixelColor(x, y); color = mcolor(color, hyp); /* make color */ color = mglow(color, hyp); /* make _glow */ color = minner(color, hyp); /* make _inner */ color = mouter(color, hyp); /* make _outer */ color = mhalo(color, hyp); /* make _halo */ for (int i = 0; i < _numref; i++) { switch (_reflect[i].type) { case 1: { color = mrt1(color, _reflect[i], x, y); break; } case 2: { color = mrt2(color, _reflect[i], x, y); break; } case 3: { color = mrt3(color, _reflect[i], x, y); break; } case 4: { color = mrt4(color, _reflect[i], x, y); break; } } } imageIn.setPixelColor(x, y, color); } } return imageIn; }