Permalink
Browse files

directional gabor response

  • Loading branch information...
1 parent 5c3c996 commit ad7dbf40671ae5685bb84941d28bbd77c75328d1 @brilliun committed May 28, 2012
Showing with 9 additions and 9 deletions.
  1. +1 −1 src/controller/MainController.java
  2. +4 −4 src/filter/FilterBank.java
  3. +3 −3 src/filter/GaborFilter.java
  4. +1 −1 src/filter/IFilter.java
@@ -26,7 +26,7 @@
private void initModel(){
- this.srcImg = new SrcImage("test/5_s30t250.bmp");
+ this.srcImg = new SrcImage("test/12_s50t50.bmp");
filterBankModel.init();
@@ -52,14 +52,14 @@ public void buildKernel(int width, int height) {
}
- public double patchConvolve(Spectrum srcImg, Coordinate2D patchCenterCoord, int width, int height, int edgeAction) {
+ public Complex patchConvolve(Spectrum srcImg, Coordinate2D patchCenterCoord, int width, int height, int edgeAction) {
- double totalResponse = 0.0;
+ Complex totalResponse = new Complex();
Iterator<IFilter> iter = filterBank.iterator();
while(iter.hasNext()){
- totalResponse += iter.next().patchConvolve(srcImg, patchCenterCoord, width, height, edgeAction);
+ totalResponse = totalResponse.add(iter.next().patchConvolve(srcImg, patchCenterCoord, width, height, edgeAction));
}
@@ -91,7 +91,7 @@ public double patchConvolveEnergy(Spectrum srcImg, Coordinate2D patchCenterCoord
IFilter filter = iter.next();
- response = filter.patchConvolve(srcImg, patchCenterCoord, patchWidth, patchHeight, edgeAction);
+ response = filter.patchConvolve(srcImg, patchCenterCoord, patchWidth, patchHeight, edgeAction).getAmplitude();
resultMap.put(filter, response);
@@ -118,7 +118,7 @@ private double gaussianFunction(double x, double y){
- public double patchConvolve(Spectrum inputImg, Coordinate2D patchCenterCoord, int patchWidth, int patchHeight, int edgeAction){
+ public Spectrum patchConvolve(Spectrum inputImg, Coordinate2D patchCenterCoord, int patchWidth, int patchHeight, int edgeAction){
@@ -136,13 +136,13 @@ public double patchConvolve(Spectrum inputImg, Coordinate2D patchCenterCoord, in
Coordinate2D bottomRightCoord = new Coordinate2D(startX + patchWidth - 1, startY + patchHeight - 1);
- double response = 0.0;
+ Spectrum response = new Spectrum();
for(int countX = 0; countX < patchWidth; countX++){
for(int countY = 0; countY < patchHeight; countY++){
- response += dotProduct(inputImg, startX + countX, startY + countY, topLeftCoord, bottomRightCoord, edgeAction).getAmplitude();
+ response = response.add(dotProduct(inputImg, startX + countX, startY + countY, topLeftCoord, bottomRightCoord, edgeAction));
}
}
View
@@ -23,7 +23,7 @@
public Complex dotProduct(Spectrum srcImg, int posX, int posY, Coordinate2D coordA, Coordinate2D coordB, int edgeAction);
- public double patchConvolve(Spectrum srcImg, Coordinate2D patchCenterCoord, int width, int height, int edgeAction);
+ public Spectrum patchConvolve(Spectrum srcImg, Coordinate2D patchCenterCoord, int width, int height, int edgeAction);
public double patchConvolveEnergy(Spectrum srcImg, Coordinate2D patchCenterCoord, int width, int height, int edgeAction);

0 comments on commit ad7dbf4

Please sign in to comment.