我收到此错误"找不到符号类向量"在我的项目中。
我有java.util
整个Vector
类。
我尝试更改build.gradle上的版本,但它没有帮助。
我很感激任何建议。
public class ObjectDetection {
vector <DMatch> matches;
public vector <ObjectRep> targets; // wektor zawierający obiekty klasy ObjectRep (jeszcze nie zawiera)
float maxDist;
ArrayList<Float> distances = new ArrayList<Float>();
int noOfBestFeatures = 10;
float distance;
private float match(Mat frameDes, Mat objectDes)
{
MatOfDMatch matches = new MatOfDMatch();
DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.
BRUTEFORCE_HAMMINGLUT) ;
matcher.match(frameDes, objectDes, matches);
List<DMatch> matchesList = matches.toList();
if(matchesList.size()<noOfBestFeatures)
return Float.MAX_VALUE;
float sum = 0f;
float min = matchesList.get(0).distance;
distances.clear();
for(DMatch match : matchesList){
min = Math.min(min, match.distance);
distances.add(match.distance);
}
if(distances.size()<noOfBestFeatures)
return Float.MAX_VALUE;
Collections.sort(distances);
for(int i = 0; i<noOfBestFeatures; i++) sum += distances.get(i);
return sum;
}
public void findBestMatch(Mat cFrameDescriptors){
if(targets==null)
return;
//Log.d("", " MAtching");
if(cFrameDescriptors.size().height<1) //jeżeli ramka ta jest mniejsza od 1 nie bierzemy pod uwagę
return;
matches.clear();
float bestMatch = maxDist;
Log.d("", " No of objects: " + targets.size());
for(ObjectRep item : targets)
{
float match = match(cFrameDescriptors, item.bytesToMat());
//Log.d("DETECTOR","OBJECT NAME: "+item.getName()+", match="+match );
if(match>=maxDist) continue;
matches.put(match, item); // dodajemy do listy
//Log.v("", Statics.LOGTAG+"item name: "+item.getName()+" match: "+match);
bestMatch = Math.min(bestMatch, match);
}
Log.v("", " bestMatch: " + bestMatch);
if(bestMatch == maxDist) return ;
else
{
ObjectRep detectedObject=matches.get(bestMatch);
String str=detectedObject.name;
System.out.println("DETECTED: "+str);
}
}
}