So, I tried to save the matrix data from the xml file to the rawFaceData vector. when I check the cout statement in the first for loop, it returns only what I want for all elements in the vector. But when he jumps out of the first cycle of the cycle and proceeds to the second cycle, cout gives me all the elements in the same way as the last element all the time (for example, if the size of the vector is 4, then cout gives me the last value of the element 4 times!), previous values have disappeared. Can anyone tell me why ??? Thank!
vector<Mat> rawFaceData;
Mat temp;
FileStorage fsRead = FileStorage();
for(int readCount = 1; readCount < count; readCount++){
ssfilename.str("");
ssfilename<<name<<readCount<<postfix;
filename = ssfilename.str();
cout<<filename<<endl;
fsRead.open(filename, FileStorage::READ);
fsRead["ImageData"]>>temp;
rawFaceData.push_back(temp);
cout<<rawFaceData[readCount-1]<<endl;
}
for(int i = 0; i < rawFaceData.size(); i++){
cout<<rawFaceData[i]<<"\n"<<endl;
}
source
share