{"action":"created","comment":{"url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/comments/89506097","pull_request_review_id":10051296,"id":89506097,"diff_hunk":"@@ -31,52 +38,121 @@ class CheckboxReader:\n     ##########################################################################\n     #                               INIT METHOD                              #\n     ##########################################################################\n-    def __init__(self, img, ratiomin=0.01):\n-        self.min = ratiomin\n+    def __init__(self, img, threshold=212.5):\n         # read the image in greyscale\n         if isinstance(img, str):\n             self.img = cv2.imread(img, 0)\n         else:\n             self.img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)\n-        self.h, self.w = self.img.shape[:2]\n-        self.state = None\n-        self.corners = []\n-        # preprocessing of the image\n-        # (remove noise)\n-        self._preprocessing()\n-        # find all the corners\n-        # self._findCorner()\n-        self.histogram = cv2.calcHist([self.img], [0], None, [256], [0, 256])\n+            self.decision_threshold = threshold\n+            self.score = None\n \n     ##########################################################################\n     #                             PUBLIC METHODS                             #\n     ##########################################################################\n-    def get_pixels_count(self, min_brightness=0, max_brightness=256):\n-        \"\"\" Returns the number of pixels in the given brightness range.\n-\n-        :param min_brightness: Minimum brightness value for pixels count\n-        :param max_brightness: Maximum brightness value for pixels count\n-        :returns: The number of pixels found.\n-        :rtype: float\n \n-        \"\"\"\n-        if min_brightness < 0:\n-            min_brightness = 0\n-        if max_brightness > 256:\n-            max_brightness = 256\n-        count = 0\n-        if min_brightness < max_brightness:\n-            count = np.sum(self.histogram[min_brightness:max_brightness])\n+    def compute_boxscore(self, boxsize=17):\n+        img = 255 - np.copy(self.img)","path":"sbc_compassion/tools/checkboxreader.py","position":69,"original_position":69,"commit_id":"00941280a70977e3fdc81432bfe388fd0f9d31fa","original_commit_id":"00941280a70977e3fdc81432bfe388fd0f9d31fa","user":{"login":"ecino","id":8435180,"avatar_url":"https://avatars.githubusercontent.com/u/8435180?v=3","gravatar_id":"","url":"https://api.github.com/users/ecino","html_url":"https://github.com/ecino","followers_url":"https://api.github.com/users/ecino/followers","following_url":"https://api.github.com/users/ecino/following{/other_user}","gists_url":"https://api.github.com/users/ecino/gists{/gist_id}","starred_url":"https://api.github.com/users/ecino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecino/subscriptions","organizations_url":"https://api.github.com/users/ecino/orgs","repos_url":"https://api.github.com/users/ecino/repos","events_url":"https://api.github.com/users/ecino/events{/privacy}","received_events_url":"https://api.github.com/users/ecino/received_events","type":"User","site_admin":false},"body":"Maybe a quick comment on how the score is computed?","created_at":"2016-11-24T14:26:18Z","updated_at":"2016-11-24T14:29:08Z","html_url":"https://github.com/CompassionCH/compassion-modules/pull/381#discussion_r89506097","pull_request_url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/381","_links":{"self":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/comments/89506097"},"html":{"href":"https://github.com/CompassionCH/compassion-modules/pull/381#discussion_r89506097"},"pull_request":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/381"}}},"pull_request":{"url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/381","id":95186463,"html_url":"https://github.com/CompassionCH/compassion-modules/pull/381","diff_url":"https://github.com/CompassionCH/compassion-modules/pull/381.diff","patch_url":"https://github.com/CompassionCH/compassion-modules/pull/381.patch","issue_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/381","number":381,"state":"open","locked":false,"title":"Enhence language detection","user":{"login":"emgirardin","id":22315871,"avatar_url":"https://avatars.githubusercontent.com/u/22315871?v=3","gravatar_id":"","url":"https://api.github.com/users/emgirardin","html_url":"https://github.com/emgirardin","followers_url":"https://api.github.com/users/emgirardin/followers","following_url":"https://api.github.com/users/emgirardin/following{/other_user}","gists_url":"https://api.github.com/users/emgirardin/gists{/gist_id}","starred_url":"https://api.github.com/users/emgirardin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emgirardin/subscriptions","organizations_url":"https://api.github.com/users/emgirardin/orgs","repos_url":"https://api.github.com/users/emgirardin/repos","events_url":"https://api.github.com/users/emgirardin/events{/privacy}","received_events_url":"https://api.github.com/users/emgirardin/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-24T14:20:34Z","updated_at":"2016-11-24T14:29:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"04e8857771910c97d88d987a37f84f17937fb7ba","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/381/commits","review_comments_url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/381/comments","review_comment_url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/381/comments","statuses_url":"https://api.github.com/repos/CompassionCH/compassion-modules/statuses/00941280a70977e3fdc81432bfe388fd0f9d31fa","head":{"label":"emgirardin:master","ref":"master","sha":"00941280a70977e3fdc81432bfe388fd0f9d31fa","user":{"login":"emgirardin","id":22315871,"avatar_url":"https://avatars.githubusercontent.com/u/22315871?v=3","gravatar_id":"","url":"https://api.github.com/users/emgirardin","html_url":"https://github.com/emgirardin","followers_url":"https://api.github.com/users/emgirardin/followers","following_url":"https://api.github.com/users/emgirardin/following{/other_user}","gists_url":"https://api.github.com/users/emgirardin/gists{/gist_id}","starred_url":"https://api.github.com/users/emgirardin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emgirardin/subscriptions","organizations_url":"https://api.github.com/users/emgirardin/orgs","repos_url":"https://api.github.com/users/emgirardin/repos","events_url":"https://api.github.com/users/emgirardin/events{/privacy}","received_events_url":"https://api.github.com/users/emgirardin/received_events","type":"User","site_admin":false},"repo":{"id":68691535,"name":"compassion-modules","full_name":"emgirardin/compassion-modules","owner":{"login":"emgirardin","id":22315871,"avatar_url":"https://avatars.githubusercontent.com/u/22315871?v=3","gravatar_id":"","url":"https://api.github.com/users/emgirardin","html_url":"https://github.com/emgirardin","followers_url":"https://api.github.com/users/emgirardin/followers","following_url":"https://api.github.com/users/emgirardin/following{/other_user}","gists_url":"https://api.github.com/users/emgirardin/gists{/gist_id}","starred_url":"https://api.github.com/users/emgirardin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emgirardin/subscriptions","organizations_url":"https://api.github.com/users/emgirardin/orgs","repos_url":"https://api.github.com/users/emgirardin/repos","events_url":"https://api.github.com/users/emgirardin/events{/privacy}","received_events_url":"https://api.github.com/users/emgirardin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/emgirardin/compassion-modules","description":"Odoo modules for Compassion","fork":true,"url":"https://api.github.com/repos/emgirardin/compassion-modules","forks_url":"https://api.github.com/repos/emgirardin/compassion-modules/forks","keys_url":"https://api.github.com/repos/emgirardin/compassion-modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emgirardin/compassion-modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emgirardin/compassion-modules/teams","hooks_url":"https://api.github.com/repos/emgirardin/compassion-modules/hooks","issue_events_url":"https://api.github.com/repos/emgirardin/compassion-modules/issues/events{/number}","events_url":"https://api.github.com/repos/emgirardin/compassion-modules/events","assignees_url":"https://api.github.com/repos/emgirardin/compassion-modules/assignees{/user}","branches_url":"https://api.github.com/repos/emgirardin/compassion-modules/branches{/branch}","tags_url":"https://api.github.com/repos/emgirardin/compassion-modules/tags","blobs_url":"https://api.github.com/repos/emgirardin/compassion-modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emgirardin/compassion-modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emgirardin/compassion-modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/emgirardin/compassion-modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emgirardin/compassion-modules/statuses/{sha}","languages_url":"https://api.github.com/repos/emgirardin/compassion-modules/languages","stargazers_url":"https://api.github.com/repos/emgirardin/compassion-modules/stargazers","contributors_url":"https://api.github.com/repos/emgirardin/compassion-modules/contributors","subscribers_url":"https://api.github.com/repos/emgirardin/compassion-modules/subscribers","subscription_url":"https://api.github.com/repos/emgirardin/compassion-modules/subscription","commits_url":"https://api.github.com/repos/emgirardin/compassion-modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/emgirardin/compassion-modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/emgirardin/compassion-modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/emgirardin/compassion-modules/issues/comments{/number}","contents_url":"https://api.github.com/repos/emgirardin/compassion-modules/contents/{+path}","compare_url":"https://api.github.com/repos/emgirardin/compassion-modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emgirardin/compassion-modules/merges","archive_url":"https://api.github.com/repos/emgirardin/compassion-modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emgirardin/compassion-modules/downloads","issues_url":"https://api.github.com/repos/emgirardin/compassion-modules/issues{/number}","pulls_url":"https://api.github.com/repos/emgirardin/compassion-modules/pulls{/number}","milestones_url":"https://api.github.com/repos/emgirardin/compassion-modules/milestones{/number}","notifications_url":"https://api.github.com/repos/emgirardin/compassion-modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emgirardin/compassion-modules/labels{/name}","releases_url":"https://api.github.com/repos/emgirardin/compassion-modules/releases{/id}","deployments_url":"https://api.github.com/repos/emgirardin/compassion-modules/deployments","created_at":"2016-09-20T08:34:30Z","updated_at":"2016-09-20T08:34:34Z","pushed_at":"2016-11-24T14:19:14Z","git_url":"git://github.com/emgirardin/compassion-modules.git","ssh_url":"git@github.com:emgirardin/compassion-modules.git","clone_url":"https://github.com/emgirardin/compassion-modules.git","svn_url":"https://github.com/emgirardin/compassion-modules","homepage":"","size":8422,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"CompassionCH:master","ref":"master","sha":"c08e2860e29f4ee0fdd2449a4c68b4abdb74defe","user":{"login":"CompassionCH","id":8435213,"avatar_url":"https://avatars.githubusercontent.com/u/8435213?v=3","gravatar_id":"","url":"https://api.github.com/users/CompassionCH","html_url":"https://github.com/CompassionCH","followers_url":"https://api.github.com/users/CompassionCH/followers","following_url":"https://api.github.com/users/CompassionCH/following{/other_user}","gists_url":"https://api.github.com/users/CompassionCH/gists{/gist_id}","starred_url":"https://api.github.com/users/CompassionCH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CompassionCH/subscriptions","organizations_url":"https://api.github.com/users/CompassionCH/orgs","repos_url":"https://api.github.com/users/CompassionCH/repos","events_url":"https://api.github.com/users/CompassionCH/events{/privacy}","received_events_url":"https://api.github.com/users/CompassionCH/received_events","type":"Organization","site_admin":false},"repo":{"id":23073482,"name":"compassion-modules","full_name":"CompassionCH/compassion-modules","owner":{"login":"CompassionCH","id":8435213,"avatar_url":"https://avatars.githubusercontent.com/u/8435213?v=3","gravatar_id":"","url":"https://api.github.com/users/CompassionCH","html_url":"https://github.com/CompassionCH","followers_url":"https://api.github.com/users/CompassionCH/followers","following_url":"https://api.github.com/users/CompassionCH/following{/other_user}","gists_url":"https://api.github.com/users/CompassionCH/gists{/gist_id}","starred_url":"https://api.github.com/users/CompassionCH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CompassionCH/subscriptions","organizations_url":"https://api.github.com/users/CompassionCH/orgs","repos_url":"https://api.github.com/users/CompassionCH/repos","events_url":"https://api.github.com/users/CompassionCH/events{/privacy}","received_events_url":"https://api.github.com/users/CompassionCH/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CompassionCH/compassion-modules","description":"Odoo modules for Compassion","fork":false,"url":"https://api.github.com/repos/CompassionCH/compassion-modules","forks_url":"https://api.github.com/repos/CompassionCH/compassion-modules/forks","keys_url":"https://api.github.com/repos/CompassionCH/compassion-modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CompassionCH/compassion-modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CompassionCH/compassion-modules/teams","hooks_url":"https://api.github.com/repos/CompassionCH/compassion-modules/hooks","issue_events_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/events{/number}","events_url":"https://api.github.com/repos/CompassionCH/compassion-modules/events","assignees_url":"https://api.github.com/repos/CompassionCH/compassion-modules/assignees{/user}","branches_url":"https://api.github.com/repos/CompassionCH/compassion-modules/branches{/branch}","tags_url":"https://api.github.com/repos/CompassionCH/compassion-modules/tags","blobs_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CompassionCH/compassion-modules/statuses/{sha}","languages_url":"https://api.github.com/repos/CompassionCH/compassion-modules/languages","stargazers_url":"https://api.github.com/repos/CompassionCH/compassion-modules/stargazers","contributors_url":"https://api.github.com/repos/CompassionCH/compassion-modules/contributors","subscribers_url":"https://api.github.com/repos/CompassionCH/compassion-modules/subscribers","subscription_url":"https://api.github.com/repos/CompassionCH/compassion-modules/subscription","commits_url":"https://api.github.com/repos/CompassionCH/compassion-modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/CompassionCH/compassion-modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/comments{/number}","contents_url":"https://api.github.com/repos/CompassionCH/compassion-modules/contents/{+path}","compare_url":"https://api.github.com/repos/CompassionCH/compassion-modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CompassionCH/compassion-modules/merges","archive_url":"https://api.github.com/repos/CompassionCH/compassion-modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CompassionCH/compassion-modules/downloads","issues_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues{/number}","pulls_url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls{/number}","milestones_url":"https://api.github.com/repos/CompassionCH/compassion-modules/milestones{/number}","notifications_url":"https://api.github.com/repos/CompassionCH/compassion-modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CompassionCH/compassion-modules/labels{/name}","releases_url":"https://api.github.com/repos/CompassionCH/compassion-modules/releases{/id}","deployments_url":"https://api.github.com/repos/CompassionCH/compassion-modules/deployments","created_at":"2014-08-18T14:08:09Z","updated_at":"2016-10-25T13:51:19Z","pushed_at":"2016-11-24T14:20:34Z","git_url":"git://github.com/CompassionCH/compassion-modules.git","ssh_url":"git@github.com:CompassionCH/compassion-modules.git","clone_url":"https://github.com/CompassionCH/compassion-modules.git","svn_url":"https://github.com/CompassionCH/compassion-modules","homepage":"","size":9888,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":5,"forks":13,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/381"},"html":{"href":"https://github.com/CompassionCH/compassion-modules/pull/381"},"issue":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/381"},"comments":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/381/comments"},"review_comments":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/381/comments"},"review_comment":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/381/commits"},"statuses":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/statuses/00941280a70977e3fdc81432bfe388fd0f9d31fa"}}}}
{"actor":{"display_login":"ecino"}}