本文整理汇总了C++中PCA::backProject方法的典型用法代码示例。如果您正苦于以下问题:C++ PCA::backProject方法的具体用法?C++ PCA::backProject怎么用?C++ PCA::backProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCA
的用法示例。
在下文中一共展示了PCA::backProject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rateBubble
//Rate a location on how likely it is to be a bubble
double rateBubble(Mat& det_img_gray, Point bubble_location, PCA& my_PCA){
Mat query_pixels, pca_components;
getRectSubPix(det_img_gray, Point(14,18), bubble_location, query_pixels);
query_pixels.reshape(0,1).convertTo(query_pixels, CV_32F);
pca_components = my_PCA.project(query_pixels);
//The rating is the SSD of query pixels and their back projection
Mat out = my_PCA.backProject(pca_components)- query_pixels;
return sum(out.mul(out)).val[0];
}
示例2: norm
int
predict(PCA &pca, Mat &train, Mat face, double threshold = 0.3, double distance = 44000){
Mat w = pca.project(face);
Mat predicted = pca.backProject(w);
int label = -1;
double min = distance * threshold;
for(int i = 0; i < 15; i++){
for(int j = 0; j < 8; j++){
double d = norm(predicted, train.row((i*8) + j));
if(d < min){
min = d;
label = i;
}
}
}
return label;
}
示例3: res
void
FMR_FNMR(PCA &pca, Mat &train, Mat &test, double step = 0.05, double distance = 44000.0){
struct stat {
double total{0}, match{0};
double res() { return match/total; }
};
Mat w, r;
cout << "Threshold;" << "FMR;" << "FNMR;" << "ROC TP;" << "ROC FP" << endl;
for(double t = 0.0; t <= 1.000001; t += step) {
double min = distance * t;
stat fmr, fnmr;
for(int i = 0; i < 15; i++){
for(int j = 0; j < 3; j++){
Mat face = test.row((i*3) + j);
pca.project(face, w);
pca.backProject(w, r);
for(int k = 0; k < 15; k++) {
if(k == i){
// FNMR
for(int l = 0; l < 8; l++) {
double d = norm(r, train.row((k*8) + l));
if(d > min){
fnmr.match++;
}
// else {
// ROC TP
// }
fnmr.total++;
}
} else {
// FMR
for(int l = 0; l < 8; l++){
double d = norm(r, train.row((k*8) + l));
if(d < min){
fmr.match++;
// ROC FP
}
fmr.total++;
}
}
}
}
}
cout << 1-t << ";"
<< fmr.res() << ";"
<< fnmr.res() << ";"
<< ((fnmr.total-fnmr.match)/fnmr.total) << ";"
<< fmr.res() << endl;
}
}