{"action":"created","comment":{"url":"https://api.github.com/repos/SimPrints/libAFIS/pulls/comments/43994111","id":43994111,"diff_hunk":"@@ -1,26 +1,183 @@\n #include <stdlib.h>\n #include <assert.h>\n+#include <math.h>\n+#include <stdio.h>\n \n #include \"HillOrientation.h\"\n+#include \"General/Array.h\"\n \n-HillOrientation HillOrientation_Construct(void)\n+#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))\n+#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))\n+#define NUM_VECTORS (28)\n+\n+const Point neighbors[NUM_VECTORS] = {\n+    { -1, 1, }, { -1, 2 }, { -1, 3 },\n+    { -2, 1  }, { -2, 2 }, { -2, 3 },\n+    { -3, 1  }, { -3, 2 }, { -3, 3 },\n+    { 0, 1 }, { 0, 2, }, { 0, 3 },\n+    { 1, 0 }, { 1, 1, }, { 1, 2 }, { 1, 3 },\n+    { 2, 0 }, { 2, 1  }, { 2, 2 }, { 2, 3 },\n+    { 3, 0 }, { 3, 1  }, { 3, 2 }, { 3, 3 },\n+    { -5, 0 }, { -5, 5 }, { 0, 5 }, { 5, 5 }\n+};\n+\n+static bool IsInsideImageAndMask(int imageHeight, int imageWidth, BoolArray2D pixelMask, int x, int y)\n+{\n+    bool ok = x >= 0\n+        && y >= 0\n+        && x < imageWidth\n+        && y < imageHeight\n+        && pixelMask.data[x][y];\n+\n+    return ok;\n+}\n+\n+/*\n+static void print_directions(PointFArray2D directions) {\n+  for ( int i=0; i < directions.sizeX; ++i ) {\n+    for ( int j=0; j < directions.sizeY; ++j ) {\n+      printf(\"(%f, %f)\", directions.data[i][j].x, directions.data[i][j].y);\n+    }\n+    printf(\"\\n\");\n+  }\n+}\n+*/\n+\n+/*\n+static void print_BoolArray2D(BoolArray2D array) {\n+  for ( int i=0; i < array.sizeX; ++i ) {\n+    for ( int j=0; j < array.sizeY; ++j ) {\n+      printf(\"%d \", array.data[i][j]);\n+    }\n+    printf(\"\\n\");\n+  }\n+} */\n+\n+PointFArray2D HillOrientation_AccumulateDirections(FloatArray2D input, int imageHeight, int imageWidth, BoolArray2D pixelMask)","path":"Sources/Extraction/Filters/HillOrientation.c","position":57,"original_position":57,"commit_id":"795e373dcdb890c6c4f4e43686cc82f7bce46164","original_commit_id":"795e373dcdb890c6c4f4e43686cc82f7bce46164","user":{"login":"fatboab","id":1792932,"avatar_url":"https://avatars.githubusercontent.com/u/1792932?v=3","gravatar_id":"","url":"https://api.github.com/users/fatboab","html_url":"https://github.com/fatboab","followers_url":"https://api.github.com/users/fatboab/followers","following_url":"https://api.github.com/users/fatboab/following{/other_user}","gists_url":"https://api.github.com/users/fatboab/gists{/gist_id}","starred_url":"https://api.github.com/users/fatboab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fatboab/subscriptions","organizations_url":"https://api.github.com/users/fatboab/orgs","repos_url":"https://api.github.com/users/fatboab/repos","events_url":"https://api.github.com/users/fatboab/events{/privacy}","received_events_url":"https://api.github.com/users/fatboab/received_events","type":"User","site_admin":false},"body":"Why not pass in Size to start off with and then you don;t need to re-create the Size object thingy","created_at":"2015-11-05T10:01:04Z","updated_at":"2015-11-05T10:01:04Z","html_url":"https://github.com/SimPrints/libAFIS/pull/15#discussion_r43994111","pull_request_url":"https://api.github.com/repos/SimPrints/libAFIS/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/SimPrints/libAFIS/pulls/comments/43994111"},"html":{"href":"https://github.com/SimPrints/libAFIS/pull/15#discussion_r43994111"},"pull_request":{"href":"https://api.github.com/repos/SimPrints/libAFIS/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/SimPrints/libAFIS/pulls/15","id":49713977,"html_url":"https://github.com/SimPrints/libAFIS/pull/15","diff_url":"https://github.com/SimPrints/libAFIS/pull/15.diff","patch_url":"https://github.com/SimPrints/libAFIS/pull/15.patch","issue_url":"https://api.github.com/repos/SimPrints/libAFIS/issues/15","number":15,"state":"open","locked":false,"title":"Add implementation of fingerprint orientation","user":{"login":"andrew-farries","id":8225907,"avatar_url":"https://avatars.githubusercontent.com/u/8225907?v=3","gravatar_id":"","url":"https://api.github.com/users/andrew-farries","html_url":"https://github.com/andrew-farries","followers_url":"https://api.github.com/users/andrew-farries/followers","following_url":"https://api.github.com/users/andrew-farries/following{/other_user}","gists_url":"https://api.github.com/users/andrew-farries/gists{/gist_id}","starred_url":"https://api.github.com/users/andrew-farries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrew-farries/subscriptions","organizations_url":"https://api.github.com/users/andrew-farries/orgs","repos_url":"https://api.github.com/users/andrew-farries/repos","events_url":"https://api.github.com/users/andrew-farries/events{/privacy}","received_events_url":"https://api.github.com/users/andrew-farries/received_events","type":"User","site_admin":false},"body":"This PR contains the implementation of the orientation step, and some associated new data structures and tests.\r\n\r\nSourceAFIS uses a random(ish) sampling of neighbours but we're using a hard coded set, the same for each pixel. We're not sure how much impact that has on the result.\r\n\r\nCurrently, the smoothing step of orientation is not performed. The results don't look fantastic but it's also a bit hard to tell with the current visualisation.","created_at":"2015-11-04T16:49:18Z","updated_at":"2015-11-05T10:01:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07e084b8505d94445ce2f0a020ce7882a4c6b990","assignee":{"login":"david-connell","id":3006395,"avatar_url":"https://avatars.githubusercontent.com/u/3006395?v=3","gravatar_id":"","url":"https://api.github.com/users/david-connell","html_url":"https://github.com/david-connell","followers_url":"https://api.github.com/users/david-connell/followers","following_url":"https://api.github.com/users/david-connell/following{/other_user}","gists_url":"https://api.github.com/users/david-connell/gists{/gist_id}","starred_url":"https://api.github.com/users/david-connell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-connell/subscriptions","organizations_url":"https://api.github.com/users/david-connell/orgs","repos_url":"https://api.github.com/users/david-connell/repos","events_url":"https://api.github.com/users/david-connell/events{/privacy}","received_events_url":"https://api.github.com/users/david-connell/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/SimPrints/libAFIS/pulls/15/commits","review_comments_url":"https://api.github.com/repos/SimPrints/libAFIS/pulls/15/comments","review_comment_url":"https://api.github.com/repos/SimPrints/libAFIS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SimPrints/libAFIS/issues/15/comments","statuses_url":"https://api.github.com/repos/SimPrints/libAFIS/statuses/795e373dcdb890c6c4f4e43686cc82f7bce46164","head":{"label":"SimPrints:orientation","ref":"orientation","sha":"795e373dcdb890c6c4f4e43686cc82f7bce46164","user":{"login":"SimPrints","id":4208048,"avatar_url":"https://avatars.githubusercontent.com/u/4208048?v=3","gravatar_id":"","url":"https://api.github.com/users/SimPrints","html_url":"https://github.com/SimPrints","followers_url":"https://api.github.com/users/SimPrints/followers","following_url":"https://api.github.com/users/SimPrints/following{/other_user}","gists_url":"https://api.github.com/users/SimPrints/gists{/gist_id}","starred_url":"https://api.github.com/users/SimPrints/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimPrints/subscriptions","organizations_url":"https://api.github.com/users/SimPrints/orgs","repos_url":"https://api.github.com/users/SimPrints/repos","events_url":"https://api.github.com/users/SimPrints/events{/privacy}","received_events_url":"https://api.github.com/users/SimPrints/received_events","type":"Organization","site_admin":false},"repo":{"id":45032473,"name":"libAFIS","full_name":"SimPrints/libAFIS","owner":{"login":"SimPrints","id":4208048,"avatar_url":"https://avatars.githubusercontent.com/u/4208048?v=3","gravatar_id":"","url":"https://api.github.com/users/SimPrints","html_url":"https://github.com/SimPrints","followers_url":"https://api.github.com/users/SimPrints/followers","following_url":"https://api.github.com/users/SimPrints/following{/other_user}","gists_url":"https://api.github.com/users/SimPrints/gists{/gist_id}","starred_url":"https://api.github.com/users/SimPrints/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimPrints/subscriptions","organizations_url":"https://api.github.com/users/SimPrints/orgs","repos_url":"https://api.github.com/users/SimPrints/repos","events_url":"https://api.github.com/users/SimPrints/events{/privacy}","received_events_url":"https://api.github.com/users/SimPrints/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SimPrints/libAFIS","description":"Redgate + SimPrints DTW endevore : SourceAFIS -> C","fork":false,"url":"https://api.github.com/repos/SimPrints/libAFIS","forks_url":"https://api.github.com/repos/SimPrints/libAFIS/forks","keys_url":"https://api.github.com/repos/SimPrints/libAFIS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SimPrints/libAFIS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SimPrints/libAFIS/teams","hooks_url":"https://api.github.com/repos/SimPrints/libAFIS/hooks","issue_events_url":"https://api.github.com/repos/SimPrints/libAFIS/issues/events{/number}","events_url":"https://api.github.com/repos/SimPrints/libAFIS/events","assignees_url":"https://api.github.com/repos/SimPrints/libAFIS/assignees{/user}","branches_url":"https://api.github.com/repos/SimPrints/libAFIS/branches{/branch}","tags_url":"https://api.github.com/repos/SimPrints/libAFIS/tags","blobs_url":"https://api.github.com/repos/SimPrints/libAFIS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SimPrints/libAFIS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SimPrints/libAFIS/git/refs{/sha}","trees_url":"https://api.github.com/repos/SimPrints/libAFIS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SimPrints/libAFIS/statuses/{sha}","languages_url":"https://api.github.com/repos/SimPrints/libAFIS/languages","stargazers_url":"https://api.github.com/repos/SimPrints/libAFIS/stargazers","contributors_url":"https://api.github.com/repos/SimPrints/libAFIS/contributors","subscribers_url":"https://api.github.com/repos/SimPrints/libAFIS/subscribers","subscription_url":"https://api.github.com/repos/SimPrints/libAFIS/subscription","commits_url":"https://api.github.com/repos/SimPrints/libAFIS/commits{/sha}","git_commits_url":"https://api.github.com/repos/SimPrints/libAFIS/git/commits{/sha}","comments_url":"https://api.github.com/repos/SimPrints/libAFIS/comments{/number}","issue_comment_url":"https://api.github.com/repos/SimPrints/libAFIS/issues/comments{/number}","contents_url":"https://api.github.com/repos/SimPrints/libAFIS/contents/{+path}","compare_url":"https://api.github.com/repos/SimPrints/libAFIS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SimPrints/libAFIS/merges","archive_url":"https://api.github.com/repos/SimPrints/libAFIS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SimPrints/libAFIS/downloads","issues_url":"https://api.github.com/repos/SimPrints/libAFIS/issues{/number}","pulls_url":"https://api.github.com/repos/SimPrints/libAFIS/pulls{/number}","milestones_url":"https://api.github.com/repos/SimPrints/libAFIS/milestones{/number}","notifications_url":"https://api.github.com/repos/SimPrints/libAFIS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SimPrints/libAFIS/labels{/name}","releases_url":"https://api.github.com/repos/SimPrints/libAFIS/releases{/id}","created_at":"2015-10-27T10:11:00Z","updated_at":"2015-11-03T09:08:20Z","pushed_at":"2015-11-05T09:56:38Z","git_url":"git://github.com/SimPrints/libAFIS.git","ssh_url":"git@github.com:SimPrints/libAFIS.git","clone_url":"https://github.com/SimPrints/libAFIS.git","svn_url":"https://github.com/SimPrints/libAFIS","homepage":null,"size":5300,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"SimPrints:master","ref":"master","sha":"8c2b0c3861c6c5d24eed6b3417513d4deed8dd7c","user":{"login":"SimPrints","id":4208048,"avatar_url":"https://avatars.githubusercontent.com/u/4208048?v=3","gravatar_id":"","url":"https://api.github.com/users/SimPrints","html_url":"https://github.com/SimPrints","followers_url":"https://api.github.com/users/SimPrints/followers","following_url":"https://api.github.com/users/SimPrints/following{/other_user}","gists_url":"https://api.github.com/users/SimPrints/gists{/gist_id}","starred_url":"https://api.github.com/users/SimPrints/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimPrints/subscriptions","organizations_url":"https://api.github.com/users/SimPrints/orgs","repos_url":"https://api.github.com/users/SimPrints/repos","events_url":"https://api.github.com/users/SimPrints/events{/privacy}","received_events_url":"https://api.github.com/users/SimPrints/received_events","type":"Organization","site_admin":false},"repo":{"id":45032473,"name":"libAFIS","full_name":"SimPrints/libAFIS","owner":{"login":"SimPrints","id":4208048,"avatar_url":"https://avatars.githubusercontent.com/u/4208048?v=3","gravatar_id":"","url":"https://api.github.com/users/SimPrints","html_url":"https://github.com/SimPrints","followers_url":"https://api.github.com/users/SimPrints/followers","following_url":"https://api.github.com/users/SimPrints/following{/other_user}","gists_url":"https://api.github.com/users/SimPrints/gists{/gist_id}","starred_url":"https://api.github.com/users/SimPrints/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimPrints/subscriptions","organizations_url":"https://api.github.com/users/SimPrints/orgs","repos_url":"https://api.github.com/users/SimPrints/repos","events_url":"https://api.github.com/users/SimPrints/events{/privacy}","received_events_url":"https://api.github.com/users/SimPrints/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SimPrints/libAFIS","description":"Redgate + SimPrints DTW endevore : SourceAFIS -> C","fork":false,"url":"https://api.github.com/repos/SimPrints/libAFIS","forks_url":"https://api.github.com/repos/SimPrints/libAFIS/forks","keys_url":"https://api.github.com/repos/SimPrints/libAFIS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SimPrints/libAFIS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SimPrints/libAFIS/teams","hooks_url":"https://api.github.com/repos/SimPrints/libAFIS/hooks","issue_events_url":"https://api.github.com/repos/SimPrints/libAFIS/issues/events{/number}","events_url":"https://api.github.com/repos/SimPrints/libAFIS/events","assignees_url":"https://api.github.com/repos/SimPrints/libAFIS/assignees{/user}","branches_url":"https://api.github.com/repos/SimPrints/libAFIS/branches{/branch}","tags_url":"https://api.github.com/repos/SimPrints/libAFIS/tags","blobs_url":"https://api.github.com/repos/SimPrints/libAFIS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SimPrints/libAFIS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SimPrints/libAFIS/git/refs{/sha}","trees_url":"https://api.github.com/repos/SimPrints/libAFIS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SimPrints/libAFIS/statuses/{sha}","languages_url":"https://api.github.com/repos/SimPrints/libAFIS/languages","stargazers_url":"https://api.github.com/repos/SimPrints/libAFIS/stargazers","contributors_url":"https://api.github.com/repos/SimPrints/libAFIS/contributors","subscribers_url":"https://api.github.com/repos/SimPrints/libAFIS/subscribers","subscription_url":"https://api.github.com/repos/SimPrints/libAFIS/subscription","commits_url":"https://api.github.com/repos/SimPrints/libAFIS/commits{/sha}","git_commits_url":"https://api.github.com/repos/SimPrints/libAFIS/git/commits{/sha}","comments_url":"https://api.github.com/repos/SimPrints/libAFIS/comments{/number}","issue_comment_url":"https://api.github.com/repos/SimPrints/libAFIS/issues/comments{/number}","contents_url":"https://api.github.com/repos/SimPrints/libAFIS/contents/{+path}","compare_url":"https://api.github.com/repos/SimPrints/libAFIS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SimPrints/libAFIS/merges","archive_url":"https://api.github.com/repos/SimPrints/libAFIS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SimPrints/libAFIS/downloads","issues_url":"https://api.github.com/repos/SimPrints/libAFIS/issues{/number}","pulls_url":"https://api.github.com/repos/SimPrints/libAFIS/pulls{/number}","milestones_url":"https://api.github.com/repos/SimPrints/libAFIS/milestones{/number}","notifications_url":"https://api.github.com/repos/SimPrints/libAFIS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SimPrints/libAFIS/labels{/name}","releases_url":"https://api.github.com/repos/SimPrints/libAFIS/releases{/id}","created_at":"2015-10-27T10:11:00Z","updated_at":"2015-11-03T09:08:20Z","pushed_at":"2015-11-05T09:56:38Z","git_url":"git://github.com/SimPrints/libAFIS.git","ssh_url":"git@github.com:SimPrints/libAFIS.git","clone_url":"https://github.com/SimPrints/libAFIS.git","svn_url":"https://github.com/SimPrints/libAFIS","homepage":null,"size":5300,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SimPrints/libAFIS/pulls/15"},"html":{"href":"https://github.com/SimPrints/libAFIS/pull/15"},"issue":{"href":"https://api.github.com/repos/SimPrints/libAFIS/issues/15"},"comments":{"href":"https://api.github.com/repos/SimPrints/libAFIS/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/SimPrints/libAFIS/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/SimPrints/libAFIS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SimPrints/libAFIS/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/SimPrints/libAFIS/statuses/795e373dcdb890c6c4f4e43686cc82f7bce46164"}}}}