{"action":"created","comment":{"url":"https://api.github.com/repos/image-js/image-js/pulls/comments/168691008","pull_request_review_id":97100099,"id":168691008,"diff_hunk":"@@ -101,3 +114,45 @@ function erodeOnceBinary(img, kernel) {\n   return newImage;\n }\n \n+function erodeOnceBinaryOnlyOnes(img, newImage, kernelWidth, kernelHeight) {\n+  const radiusX = (kernelWidth - 1) / 2;\n+  const radiusY = (kernelHeight - 1) / 2;\n+\n+  const minList = [];\n+  for (let x = 0; x < img.width; x++) {\n+    minList.push(0);\n+  }\n+\n+  for (let y = 0; y < img.height; y++) {\n+    let start = y - radiusY;\n+    for (let x = 0; x < img.width; x++) {\n+      let min = 1;\n+      for (let h = 0; h < kernelHeight; h++) {\n+        const hh = start + h;\n+        if (hh < 0 || hh >= img.height) continue;\n+        if (img.getBitXY(x, hh) === 0) {\n+          min = 0;\n+          break;\n+        }\n+      }\n+      minList[x] = min;\n+    }\n+\n+    for (let x = 0; x < img.width; x++) {\n+      let min = 1;\n+      for (let ii = 0; ii < kernelWidth; ii++) {\n+        let i = ii - radiusX + x;\n+        if (i < 0 || i >= img.width) continue;\n+        if (minList[i] === 0) {\n+          min = 0;\n+          break;\n+        }\n+      }\n+","path":"src/image/morphology/erode.js","position":101,"original_position":101,"commit_id":"cbc566cad2aa273c7a3652b64d3cd36f3fb670da","original_commit_id":"adbecf02d7488f514c002e3bfb172492735b2436","user":{"login":"targos","id":2352663,"avatar_url":"https://avatars0.githubusercontent.com/u/2352663?v=4","gravatar_id":"","url":"https://api.github.com/users/targos","html_url":"https://github.com/targos","followers_url":"https://api.github.com/users/targos/followers","following_url":"https://api.github.com/users/targos/following{/other_user}","gists_url":"https://api.github.com/users/targos/gists{/gist_id}","starred_url":"https://api.github.com/users/targos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/targos/subscriptions","organizations_url":"https://api.github.com/users/targos/orgs","repos_url":"https://api.github.com/users/targos/repos","events_url":"https://api.github.com/users/targos/events{/privacy}","received_events_url":"https://api.github.com/users/targos/received_events","type":"User","site_admin":false},"body":"It is not faster (tested with a 3000x2000 image and 50x50 kernel), speed is the same. Do you still prefer if I change it?","created_at":"2018-02-16T07:48:10Z","updated_at":"2018-02-16T07:48:10Z","html_url":"https://github.com/image-js/image-js/pull/374#discussion_r168691008","pull_request_url":"https://api.github.com/repos/image-js/image-js/pulls/374","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/image-js/image-js/pulls/comments/168691008"},"html":{"href":"https://github.com/image-js/image-js/pull/374#discussion_r168691008"},"pull_request":{"href":"https://api.github.com/repos/image-js/image-js/pulls/374"}},"in_reply_to_id":168688088},"pull_request":{"url":"https://api.github.com/repos/image-js/image-js/pulls/374","id":169459128,"html_url":"https://github.com/image-js/image-js/pull/374","diff_url":"https://github.com/image-js/image-js/pull/374.diff","patch_url":"https://github.com/image-js/image-js/pull/374.patch","issue_url":"https://api.github.com/repos/image-js/image-js/issues/374","number":374,"state":"open","locked":false,"title":"perf: optimize erode and dilate for \"only-1\" kernels","user":{"login":"targos","id":2352663,"avatar_url":"https://avatars0.githubusercontent.com/u/2352663?v=4","gravatar_id":"","url":"https://api.github.com/users/targos","html_url":"https://github.com/targos","followers_url":"https://api.github.com/users/targos/followers","following_url":"https://api.github.com/users/targos/following{/other_user}","gists_url":"https://api.github.com/users/targos/gists{/gist_id}","starred_url":"https://api.github.com/users/targos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/targos/subscriptions","organizations_url":"https://api.github.com/users/targos/orgs","repos_url":"https://api.github.com/users/targos/repos","events_url":"https://api.github.com/users/targos/events{/privacy}","received_events_url":"https://api.github.com/users/targos/received_events","type":"User","site_admin":false},"body":"With this change, the time required for the current MRZ detection process is reduced by 30%","created_at":"2018-02-15T19:10:36Z","updated_at":"2018-02-16T07:48:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"198fbe9dac56bc54cf6164b0ec9ff0e5270b2803","assignee":null,"assignees":[],"requested_reviewers":[{"login":"stropitek","id":4118690,"avatar_url":"https://avatars3.githubusercontent.com/u/4118690?v=4","gravatar_id":"","url":"https://api.github.com/users/stropitek","html_url":"https://github.com/stropitek","followers_url":"https://api.github.com/users/stropitek/followers","following_url":"https://api.github.com/users/stropitek/following{/other_user}","gists_url":"https://api.github.com/users/stropitek/gists{/gist_id}","starred_url":"https://api.github.com/users/stropitek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stropitek/subscriptions","organizations_url":"https://api.github.com/users/stropitek/orgs","repos_url":"https://api.github.com/users/stropitek/repos","events_url":"https://api.github.com/users/stropitek/events{/privacy}","received_events_url":"https://api.github.com/users/stropitek/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/image-js/image-js/pulls/374/commits","review_comments_url":"https://api.github.com/repos/image-js/image-js/pulls/374/comments","review_comment_url":"https://api.github.com/repos/image-js/image-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/image-js/image-js/issues/374/comments","statuses_url":"https://api.github.com/repos/image-js/image-js/statuses/cbc566cad2aa273c7a3652b64d3cd36f3fb670da","head":{"label":"image-js:opt-dilate-erode","ref":"opt-dilate-erode","sha":"cbc566cad2aa273c7a3652b64d3cd36f3fb670da","user":{"login":"image-js","id":12996949,"avatar_url":"https://avatars0.githubusercontent.com/u/12996949?v=4","gravatar_id":"","url":"https://api.github.com/users/image-js","html_url":"https://github.com/image-js","followers_url":"https://api.github.com/users/image-js/followers","following_url":"https://api.github.com/users/image-js/following{/other_user}","gists_url":"https://api.github.com/users/image-js/gists{/gist_id}","starred_url":"https://api.github.com/users/image-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/image-js/subscriptions","organizations_url":"https://api.github.com/users/image-js/orgs","repos_url":"https://api.github.com/users/image-js/repos","events_url":"https://api.github.com/users/image-js/events{/privacy}","received_events_url":"https://api.github.com/users/image-js/received_events","type":"Organization","site_admin":false},"repo":{"id":37226136,"name":"image-js","full_name":"image-js/image-js","owner":{"login":"image-js","id":12996949,"avatar_url":"https://avatars0.githubusercontent.com/u/12996949?v=4","gravatar_id":"","url":"https://api.github.com/users/image-js","html_url":"https://github.com/image-js","followers_url":"https://api.github.com/users/image-js/followers","following_url":"https://api.github.com/users/image-js/following{/other_user}","gists_url":"https://api.github.com/users/image-js/gists{/gist_id}","starred_url":"https://api.github.com/users/image-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/image-js/subscriptions","organizations_url":"https://api.github.com/users/image-js/orgs","repos_url":"https://api.github.com/users/image-js/repos","events_url":"https://api.github.com/users/image-js/events{/privacy}","received_events_url":"https://api.github.com/users/image-js/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/image-js/image-js","description":"Image processing and manipulation in JavaScript","fork":false,"url":"https://api.github.com/repos/image-js/image-js","forks_url":"https://api.github.com/repos/image-js/image-js/forks","keys_url":"https://api.github.com/repos/image-js/image-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/image-js/image-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/image-js/image-js/teams","hooks_url":"https://api.github.com/repos/image-js/image-js/hooks","issue_events_url":"https://api.github.com/repos/image-js/image-js/issues/events{/number}","events_url":"https://api.github.com/repos/image-js/image-js/events","assignees_url":"https://api.github.com/repos/image-js/image-js/assignees{/user}","branches_url":"https://api.github.com/repos/image-js/image-js/branches{/branch}","tags_url":"https://api.github.com/repos/image-js/image-js/tags","blobs_url":"https://api.github.com/repos/image-js/image-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/image-js/image-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/image-js/image-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/image-js/image-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/image-js/image-js/statuses/{sha}","languages_url":"https://api.github.com/repos/image-js/image-js/languages","stargazers_url":"https://api.github.com/repos/image-js/image-js/stargazers","contributors_url":"https://api.github.com/repos/image-js/image-js/contributors","subscribers_url":"https://api.github.com/repos/image-js/image-js/subscribers","subscription_url":"https://api.github.com/repos/image-js/image-js/subscription","commits_url":"https://api.github.com/repos/image-js/image-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/image-js/image-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/image-js/image-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/image-js/image-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/image-js/image-js/contents/{+path}","compare_url":"https://api.github.com/repos/image-js/image-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/image-js/image-js/merges","archive_url":"https://api.github.com/repos/image-js/image-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/image-js/image-js/downloads","issues_url":"https://api.github.com/repos/image-js/image-js/issues{/number}","pulls_url":"https://api.github.com/repos/image-js/image-js/pulls{/number}","milestones_url":"https://api.github.com/repos/image-js/image-js/milestones{/number}","notifications_url":"https://api.github.com/repos/image-js/image-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/image-js/image-js/labels{/name}","releases_url":"https://api.github.com/repos/image-js/image-js/releases{/id}","deployments_url":"https://api.github.com/repos/image-js/image-js/deployments","created_at":"2015-06-10T22:32:45Z","updated_at":"2018-02-10T05:47:48Z","pushed_at":"2018-02-16T07:15:00Z","git_url":"git://github.com/image-js/image-js.git","ssh_url":"git@github.com:image-js/image-js.git","clone_url":"https://github.com/image-js/image-js.git","svn_url":"https://github.com/image-js/image-js","homepage":"https://image-js.github.io/image-js","size":40606,"stargazers_count":26,"watchers_count":26,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":76,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":6,"open_issues":76,"watchers":26,"default_branch":"master"}},"base":{"label":"image-js:master","ref":"master","sha":"3cd3564f9f9cee9566991146421c8260c1b01502","user":{"login":"image-js","id":12996949,"avatar_url":"https://avatars0.githubusercontent.com/u/12996949?v=4","gravatar_id":"","url":"https://api.github.com/users/image-js","html_url":"https://github.com/image-js","followers_url":"https://api.github.com/users/image-js/followers","following_url":"https://api.github.com/users/image-js/following{/other_user}","gists_url":"https://api.github.com/users/image-js/gists{/gist_id}","starred_url":"https://api.github.com/users/image-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/image-js/subscriptions","organizations_url":"https://api.github.com/users/image-js/orgs","repos_url":"https://api.github.com/users/image-js/repos","events_url":"https://api.github.com/users/image-js/events{/privacy}","received_events_url":"https://api.github.com/users/image-js/received_events","type":"Organization","site_admin":false},"repo":{"id":37226136,"name":"image-js","full_name":"image-js/image-js","owner":{"login":"image-js","id":12996949,"avatar_url":"https://avatars0.githubusercontent.com/u/12996949?v=4","gravatar_id":"","url":"https://api.github.com/users/image-js","html_url":"https://github.com/image-js","followers_url":"https://api.github.com/users/image-js/followers","following_url":"https://api.github.com/users/image-js/following{/other_user}","gists_url":"https://api.github.com/users/image-js/gists{/gist_id}","starred_url":"https://api.github.com/users/image-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/image-js/subscriptions","organizations_url":"https://api.github.com/users/image-js/orgs","repos_url":"https://api.github.com/users/image-js/repos","events_url":"https://api.github.com/users/image-js/events{/privacy}","received_events_url":"https://api.github.com/users/image-js/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/image-js/image-js","description":"Image processing and manipulation in JavaScript","fork":false,"url":"https://api.github.com/repos/image-js/image-js","forks_url":"https://api.github.com/repos/image-js/image-js/forks","keys_url":"https://api.github.com/repos/image-js/image-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/image-js/image-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/image-js/image-js/teams","hooks_url":"https://api.github.com/repos/image-js/image-js/hooks","issue_events_url":"https://api.github.com/repos/image-js/image-js/issues/events{/number}","events_url":"https://api.github.com/repos/image-js/image-js/events","assignees_url":"https://api.github.com/repos/image-js/image-js/assignees{/user}","branches_url":"https://api.github.com/repos/image-js/image-js/branches{/branch}","tags_url":"https://api.github.com/repos/image-js/image-js/tags","blobs_url":"https://api.github.com/repos/image-js/image-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/image-js/image-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/image-js/image-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/image-js/image-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/image-js/image-js/statuses/{sha}","languages_url":"https://api.github.com/repos/image-js/image-js/languages","stargazers_url":"https://api.github.com/repos/image-js/image-js/stargazers","contributors_url":"https://api.github.com/repos/image-js/image-js/contributors","subscribers_url":"https://api.github.com/repos/image-js/image-js/subscribers","subscription_url":"https://api.github.com/repos/image-js/image-js/subscription","commits_url":"https://api.github.com/repos/image-js/image-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/image-js/image-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/image-js/image-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/image-js/image-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/image-js/image-js/contents/{+path}","compare_url":"https://api.github.com/repos/image-js/image-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/image-js/image-js/merges","archive_url":"https://api.github.com/repos/image-js/image-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/image-js/image-js/downloads","issues_url":"https://api.github.com/repos/image-js/image-js/issues{/number}","pulls_url":"https://api.github.com/repos/image-js/image-js/pulls{/number}","milestones_url":"https://api.github.com/repos/image-js/image-js/milestones{/number}","notifications_url":"https://api.github.com/repos/image-js/image-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/image-js/image-js/labels{/name}","releases_url":"https://api.github.com/repos/image-js/image-js/releases{/id}","deployments_url":"https://api.github.com/repos/image-js/image-js/deployments","created_at":"2015-06-10T22:32:45Z","updated_at":"2018-02-10T05:47:48Z","pushed_at":"2018-02-16T07:15:00Z","git_url":"git://github.com/image-js/image-js.git","ssh_url":"git@github.com:image-js/image-js.git","clone_url":"https://github.com/image-js/image-js.git","svn_url":"https://github.com/image-js/image-js","homepage":"https://image-js.github.io/image-js","size":40606,"stargazers_count":26,"watchers_count":26,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":76,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":6,"open_issues":76,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/image-js/image-js/pulls/374"},"html":{"href":"https://github.com/image-js/image-js/pull/374"},"issue":{"href":"https://api.github.com/repos/image-js/image-js/issues/374"},"comments":{"href":"https://api.github.com/repos/image-js/image-js/issues/374/comments"},"review_comments":{"href":"https://api.github.com/repos/image-js/image-js/pulls/374/comments"},"review_comment":{"href":"https://api.github.com/repos/image-js/image-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/image-js/image-js/pulls/374/commits"},"statuses":{"href":"https://api.github.com/repos/image-js/image-js/statuses/cbc566cad2aa273c7a3652b64d3cd36f3fb670da"}},"author_association":"OWNER"}}
{"actor":{"display_login":"targos"}}