1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
template < class T,class U> template<class Archive>
void FaceBase<EigMemberProps<T,U> >::
save(Archive & ar, const unsigned int ) const
{
ar & members;
int pcols=0,prows=0;
if(EigenFacesVectors)
{
ar & EigenFacesVectors->cols;
ar & EigenFacesVectors->rows;
for (int i=0;i!=EigenFacesVectors->rows;++i)
for(int j=0;j!=EigenFacesVectors->cols;++j)
ar & CV_MAT_ELEM(*EigenFacesVectors,float,i,j);
}
else
{
ar & pcols;
ar & prows;
}
if(EigenFaces)
{
ar & EigenFaces->cols;
ar & EigenFaces->rows;
for (int i=0;i!=EigenFaces->rows;++i)
for(int j=0;j!=EigenFaces->cols;++j)
ar & CV_MAT_ELEM(*EigenFaces,float,i,j);
}
else
{
ar & pcols;
ar & prows;
}
if(Faces)
{
ar & Faces->cols;
ar & Faces->rows;
for (int i=0;i!=Faces->rows;++i)
for(int j=0;j!=Faces->cols;++j)
ar & CV_MAT_ELEM(*Faces,unsigned char,i,j);
}
else
{
ar & pcols;
ar & prows;
}
if(Average)
{
ar & Average->cols;
ar & Average->rows;
for (int i=0;i!=Average->rows;++i)
for(int j=0;j!=Average->cols;++j)
ar & CV_MAT_ELEM(*Average,unsigned char,i,j);
}
else
{
ar & pcols;
ar & prows;
}
}
template < class T,class U> template<class Archive>
void FaceBase<EigMemberProps<T,U> >::
load(Archive & ar, const unsigned int )
{
ar & members;
int pcols,prow;
ar & pcols;
ar & prow;
if(pcols==0 || prow==0)
EigenFacesVectors=NULL;
else
{
EigenFacesVectors=cvCreateMat(prow,pcols,CV_32FC1);
for (int i=0;i!=EigenFacesVectors->rows;++i)
for(int j=0;j!=EigenFacesVectors->cols;++j)
ar & CV_MAT_ELEM(*EigenFacesVectors,float,i,j);
}
ar & pcols;
ar & prow;
if(pcols==0 || prow==0)
EigenFaces=NULL;
else
{
EigenFaces=cvCreateMat(prow,pcols,CV_32FC1);
for (int i=0;i!=EigenFaces->rows;++i)
for(int j=0;j!=EigenFaces->cols;++j)
ar & CV_MAT_ELEM(*EigenFaces,float,i,j);
}
ar & pcols;
ar & prow;
if(pcols==0 || prow==0)
Faces=NULL;
else
{
Faces=cvCreateMat(prow,pcols,CV_8UC1);
for (int i=0;i!=Faces->rows;++i)
for(int j=0;j!=Faces->cols;++j)
ar & CV_MAT_ELEM(*Faces,unsigned char,i,j);
}
ar & pcols;
ar & prow;
if(pcols==0 || prow==0)
Average=NULL;
else
{
Average=cvCreateMat(prow,pcols,CV_8UC1);
for (int i=0;i!= Average->rows;++i)
for(int j=0;j!= Average->cols;++j)
ar & CV_MAT_ELEM(*Average,unsigned char,i,j);
}
} |
Partager