Skip to content

Instantly share code, notes, and snippets.

@adokoy001
Created May 18, 2013 22:14
Show Gist options
  • Save adokoy001/5605943 to your computer and use it in GitHub Desktop.
Save adokoy001/5605943 to your computer and use it in GitHub Desktop.
zinniaの特徴量抽出方法
// zinniaの特徴量抽出は以下を参照
void Features::makeBasicFeature(int offset,
const Node *first,
const Node *last) {
// distance
addFeature(offset + 1 , 10 * distance(first, last));
// degree
addFeature(offset + 2 ,
std::atan2(last->y - first->y, last->x - first->x));
// absolute position
addFeature(offset + 3, 10 * (first->x - 0.5));
addFeature(offset + 4, 10 * (first->y - 0.5));
addFeature(offset + 5, 10 * (last->x - 0.5));
addFeature(offset + 6, 10 * (last->y - 0.5));
// absolute degree
addFeature(offset + 7, std::atan2(first->y - 0.5, first->x - 0.5));
addFeature(offset + 8, std::atan2(last->y - 0.5, last->x - 0.5));
// absolute distance
addFeature(offset + 9, 10 * distance2(first));
addFeature(offset + 10, 10 * distance2(last));
// diff
addFeature(offset + 11, 5 * (last->x - first->x));
addFeature(offset + 12, 5 * (last->y - first->y));
}
@adokoy001
Copy link
Author

zinniaの特徴量抽出の処理です。feature.cppから抜粋

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment