i'm getting this error, dont know why? please help
hi, i'm getting this error, dont know why? please help
D:\javafiles\Image Matching Algorithm\ImageMatchingAlgorithm.java:107: cannot find symbol
symbol : variable getDimX
location: class SubWindow
System.out.println("sw.getDimX ="+sw.getDimX+" "+"sw.getDimY ="+sw.getDimY);
^
D:\javafiles\Image Matching Algorithm\ImageMatchingAlgorithm.java:107: cannot find symbol
symbol : variable getDimY
location: class SubWindow
System.out.println("sw.getDimX ="+sw.getDimX+" "+"sw.getDimY ="+sw.getDimY);
^
D:\javafiles\Image Matching Algorithm\ImageMatchingAlgorithm.java:108: cannot find symbol
symbol : variable setDimX
location: class SubWindow
System.out.println("sw.setDimX ="+sw.setDimX+" "+"sw.setDimY ="+sw.setDimY);
^
D:\javafiles\Image Matching Algorithm\ImageMatchingAlgorithm.java:108: cannot find symbol
symbol : variable setDimY
location: class SubWindow
System.out.println("sw.setDimX ="+sw.setDimX+" "+"sw.setDimY ="+sw.setDimY);
^
4 errors
Code java:
import java.util.*;
import java.lang.*;
public class ImageMatchingAlgorithm
{
int swaped1;
int swaped2;
int isolated;
public boolean hasReversed(int mw_axis, int sw_axis)
{
if(sw_axis > mw_axis)
return true;
return false;
}
public boolean isTangible (int mw_axis, int sw_axis)
{
if (mw_axis == sw_axis)
return true;
return false;
}
public void doIsolate(int mw_axis)
{
isolated=mw_axis-1;
}
public int getIsolated()
{
return isolated;
}
public void doSwap(int coor1, int coor2)
{
swaped1=coor2;
swaped2=coor1;
}
public int getMWSwapedDim()
{
return swaped1;
}
public int getSWSwapedDim()
{
return swaped2;
}
public static void main (String[] args)
{
int scanx;
int scany;
Scanner readDim = new Scanner(System.in);
MainWindow mw = new MainWindow();
SubWindow sw = new SubWindow();
ImageMatchingAlgorithm Obj = new ImageMatchingAlgorithm();
int [] CorrlationMatrix=new int [sw.correlationSize()];
System.out.print("Dimension of MW X axis:");
scanx=readDim.nextInt();
mw.setDimX(scanx);
System.out.print("Dimension of MW Y axis:");
scany=readDim.nextInt();
mw.setDimY(scany);
System.out.print("Dimension of SW X axis:");
scanx=readDim.nextInt();
sw.setDimX(scanx);
System.out.print("Dimension of SW Y axis:");
scany=readDim.nextInt();
sw.setDimY(scany);
if (Obj.hasReversed(mw.getDimX(), sw.getDimX()) )
{
Obj.doSwap(mw.getDimX(), sw.getDimX());
mw.setDimX(Obj.getMWSwapedDim());
sw.setDimX(Obj.getSWSwapedDim());
}
if (Obj.isTangible(mw.getDimX(), sw.getDimX()))
{
Obj.doIsolate(mw.getDimX());
sw.setDimX(Obj.getIsolated());
}
if (Obj.hasReversed(mw.getDimY(), sw.getDimY()) )
{
Obj.doSwap(mw.getDimY(), sw.getDimY());
mw.setDimY(Obj.getMWSwapedDim());
sw.setDimY(Obj.getSWSwapedDim());
}
if (Obj.isTangible(mw.getDimY(), sw.getDimY()))
{
Obj.doIsolate(mw.getDimY());
sw.setDimY(Obj.getIsolated());
}
int [][]MainGrid = mw.setPixelValues( mw.defGrid(mw.getDimX(),mw.getDimY()) );
int [][]SubGrid = sw.setPixelValues( sw.defGrid(sw.getDimX(),sw.getDimY()) );
mw.display();
sw.display();
//for(int i=0;i<t.length;i++)
// for (int j=0;j<t[0].length;j++)
sw.initCoor(sw.getDimX(),sw.getDimY());
System.out.println("sw.getDimX ="+sw.getDimX+" "+"sw.getDimY ="+sw.getDimY);
System.out.println("sw.setDimX ="+sw.setDimX+" "+"sw.setDimY ="+sw.setDimY);
//System.out.println(r);
System.out.println();
System.out.println();
/*do{
int sum=0;
int rounds=0;
for(int i=sw.getCoorX0();i<((sw.swDimx-1)+sw.getCoorX0());i++)
{
for (int j=sw.getCoorY0();j<((sw.swDimy-1)+sw.getCoorY0());j++)
{
sum+=MainGrid[i][j];
}
}
CorrlationMatrix[rounds]=sum;
rounds++;
if (sw.HasVerticalOverLap())
{
sw.Vertical_Shift();
sw.CarryBack();
}
sw.Horizontal_Shift();
System.out.print(sum+" ");
}while(!sw.notDone()); */
//System.out.print("\n"+sw.initCoor()+"\n");
//System.out.println(mw.getDimX()+" "+mw.getDimY());
//System.out.println(sw.getDimX()+" "+sw.getDimY());
}
}
Re: i'm getting this error, dont know why? please help
examine your code:
Code Java:
System.out.println("sw.getDimX ="+sw.getDimX+" "+"sw.getDimY ="+sw.getDimY);
System.out.println("sw.setDimX ="+sw.setDimX+" "+"sw.setDimY ="+sw.setDimY);
I'm assuming you meant to call the methods getDimX() rather than try to get a field named getDimX (same thing for getDimY). I don't know why you're trying to print out setDimY, usually set denotes void method which allows you to set a variable's value.
Re: i'm getting this error, dont know why? please help
Yeah, exactly as said above. You shouldn't print anything inside a setter method as it is usually a VOID, which means returns nothing.
The only thing you need is following line of code instead of the two lines you have mentioned above,
Code java:
System.out.println("sw.getDimX ="+sw.getDimX()+" "+"sw.getDimY ="+sw.getDimY());
Hope that helps!
Goldest
Re: i'm getting this error, dont know why? please help
Quote:
Originally Posted by
helloworld922
examine your code:
Code Java:
System.out.println("sw.getDimX ="+sw.getDimX+" "+"sw.getDimY ="+sw.getDimY);
System.out.println("sw.setDimX ="+sw.setDimX+" "+"sw.setDimY ="+sw.setDimY);
I'm assuming you meant to call the methods getDimX() rather than try to get a field named getDimX (same thing for getDimY). I don't know why you're trying to print out setDimY, usually set denotes void method which allows you to set a variable's value.
thank u very much for ur help,however, i still have some errors and i'll post them
Re: i'm getting this error, dont know why? please help