{"action":"created","comment":{"url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/comments/236088735","pull_request_review_id":178089243,"id":236088735,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjA4ODczNQ==","diff_hunk":"@@ -0,0 +1,113 @@\n+\\section{Object localization}\\label{Design:ObjectLocalization}\n+An early working product was favored in order to get a baseline for all components to be further developed from.\n+Therefore since object localization using machine learning algorithms requires a bit of setup, along with a lot of training data some algorithms were implemented without machine learning.\n+\n+\\subsection{Zone Average}\n+Initially an object detection algorithm dubbed \"Zone Average\" were created.\n+Zone Average locates the most red object in an image.\n+It works by splitting the image into $N\\times N$ tiles, and determining the total redness within each tile.\n+The tile that contains the most red is determined to contain the object, and the location of that tile is returned as a result.\n+\n+In order to increase accuracy, dynamic resizing of tiles were introduced.\n+The idea is that if the same tile has been the selected tile for multiple iterations, the size of the tiles should decrease to get better accuracy.\n+Likewise when the object begins moving the size of the tiles should expand.\n+\n+\\figur{0.6}{images/zone_avg.png}{Zone average algorithm detecting red balloon.}{fig:zone_avg}\n+\n+Zone Average functioned well as a starting point, but it lacked accuracy as also illustrated in image \\ref{fig:zone_avg} where multiple tiles could be very red, but not necessarily in the center.\n+\n+\\subsection{Object Fill}\n+Following Zone Average a new algorithm called \"Object Fill\" was created.\n+Object Fills purpose was to render very accurate position results, with the initial limitation of only being able to locate a single red object.\n+The algorithm consists of two main parts:\n+\\begin{itemize}\n+\t\\item Locate the object\n+\t\\item Fill the object\n+\\end{itemize}\n+The idea is to traverse the image with a given step size, until the last x pixels were within the given red threshold.\n+Once the location part yielded that a red object were found a filling algorithm were initialized in order to determine the exact body of the red object.\n+The filling algorithm is in essence a graph search, and works as described below:\n+\\begin{itemize}\n+\t\\item Create a queue with a pixel known to be within the red object (This pixel is reported by the initial object location algorithm).\n+\t\\item While queue is empty:\n+\t\\begin{itemize}\n+\t\t\\item Pop element from queue.\n+\t\t\\item If element is not within the red threshold\n+\t\t\\begin{itemize}\n+\t\t\t\\item Add the pixels x and y coordinate to the sum of x and y coordinates on the pixels bounding box.\n+\t\t\t\\item Increment the number of pixels on the objects bounding box with one.\n+\t\t\\end{itemize}\n+\t\t\\item Else\n+\t\t\\begin{itemize}\n+\t\t\t\\item Get all neighbors of the pixel (step size for neighbors may not necessarily be one) that has not yet been visited\n+\t\t\t\\item Add neighbors to the queue and to a set of all visited pixels\n+\t\t\\end{itemize}\n+\t\\end{itemize}\n+\tDivide the sum of the bounding box's x and y values, with the total amount of elements in the bounding box to get the center x and y value of the object.\n+\\end{itemize}\n+\n+Figure~\\ref{fig:obj_fill} is a debug view of the algorithm running.\n+The Green pixels are the bounding box of the object and the black pixels shows all the visited pixels.\n+\n+\\figur{0.6}{images/obj_fill.png}{Object Fill algorithm detecting red balloon.}{fig:obj_fill}\n+\n+The algorithm was later improved in a couple of aspects.\n+First of all, the initial search for the red object would start its search based on the last center of the red object.\n+Secondly the algorithms was improved to only accept an object if it contained a certain amount of \"redness\".\n+This helped reduce the amount of false positives from very small objects or big but not so red objects.\n+If the filling algorithm reports that the object is not a valid red object, the searching algorithm will continue from where it left off, until it has searched the entire image.\n+\n+\\subsection{Thresh Moment}\n+\n+The previous algorithms utilizes OpenCV to extract image from the webcam. \n+The algorithms then works with the data in a low level fashion iterating over each pixel in the image to analyze it.\n+However, OpenCV comes with a huge amount of functions for image processing, that can be utilized in order to create a simple performant algorithm for this use case. \n+The algorithm was dubbed \"Thresh Moment\" since the core algorithm relies on threshold and image moment.\n+\n+A couple of concepts used by the algorithm are worth mentioning beforehand.\n+\n+\\paragraph{HSV}\n+The algorithm will convert the image to the HSV color model.\n+HSV format differs from traditional RGB, in that instead of having three additive color channels for red, green and blue it has three values defining hue, saturation and light.\n+This makes it easier to recognize both dark and light red, since the redness is defined in the hue.\n+\n+\\paragraph{Contours}\n+Contours are almost identical to edges.\n+They are outlines that follows all continuous points along a boundary of an object.\n+Continuous points are determined based on color and intensity.\n+It this case it will essentially help determine the outline of the red object.\\cite{contours}","path":"report/4.Design/Object_Localization.tex","position":78,"original_position":78,"commit_id":"36e0cb492ba22d12e76f49d6cca563095da69c06","original_commit_id":"36e0cb492ba22d12e76f49d6cca563095da69c06","user":{"login":"nillas12","id":6108612,"node_id":"MDQ6VXNlcjYxMDg2MTI=","avatar_url":"https://avatars0.githubusercontent.com/u/6108612?v=4","gravatar_id":"","url":"https://api.github.com/users/nillas12","html_url":"https://github.com/nillas12","followers_url":"https://api.github.com/users/nillas12/followers","following_url":"https://api.github.com/users/nillas12/following{/other_user}","gists_url":"https://api.github.com/users/nillas12/gists{/gist_id}","starred_url":"https://api.github.com/users/nillas12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nillas12/subscriptions","organizations_url":"https://api.github.com/users/nillas12/orgs","repos_url":"https://api.github.com/users/nillas12/repos","events_url":"https://api.github.com/users/nillas12/events{/privacy}","received_events_url":"https://api.github.com/users/nillas12/received_events","type":"User","site_admin":false},"body":"```suggestion\r\nIn this case it will essentially help determine the outline of the red object.\\cite{contours}\r\n```","created_at":"2018-11-25T20:27:37Z","updated_at":"2018-11-25T20:34:48Z","html_url":"https://github.com/aau-hcl-p5/main/pull/94#discussion_r236088735","pull_request_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/94","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/comments/236088735"},"html":{"href":"https://github.com/aau-hcl-p5/main/pull/94#discussion_r236088735"},"pull_request":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/94"}}},"pull_request":{"url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/94","id":233385948,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzMzg1OTQ4","html_url":"https://github.com/aau-hcl-p5/main/pull/94","diff_url":"https://github.com/aau-hcl-p5/main/pull/94.diff","patch_url":"https://github.com/aau-hcl-p5/main/pull/94.patch","issue_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/94","number":94,"state":"open","locked":false,"title":"P5 151 document hand written algorithm s","user":{"login":"technight","id":5200541,"node_id":"MDQ6VXNlcjUyMDA1NDE=","avatar_url":"https://avatars1.githubusercontent.com/u/5200541?v=4","gravatar_id":"","url":"https://api.github.com/users/technight","html_url":"https://github.com/technight","followers_url":"https://api.github.com/users/technight/followers","following_url":"https://api.github.com/users/technight/following{/other_user}","gists_url":"https://api.github.com/users/technight/gists{/gist_id}","starred_url":"https://api.github.com/users/technight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/technight/subscriptions","organizations_url":"https://api.github.com/users/technight/orgs","repos_url":"https://api.github.com/users/technight/repos","events_url":"https://api.github.com/users/technight/events{/privacy}","received_events_url":"https://api.github.com/users/technight/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-25T16:35:20Z","updated_at":"2018-11-25T20:34:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b21f2917e8861344640462bde53a4ec4eded1550","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/94/commits","review_comments_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/94/comments","review_comment_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/94/comments","statuses_url":"https://api.github.com/repos/aau-hcl-p5/main/statuses/36e0cb492ba22d12e76f49d6cca563095da69c06","head":{"label":"aau-hcl-p5:P5-151-document-hand-written-algorithm-s","ref":"P5-151-document-hand-written-algorithm-s","sha":"36e0cb492ba22d12e76f49d6cca563095da69c06","user":{"login":"aau-hcl-p5","id":43030341,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDMwMzQx","avatar_url":"https://avatars0.githubusercontent.com/u/43030341?v=4","gravatar_id":"","url":"https://api.github.com/users/aau-hcl-p5","html_url":"https://github.com/aau-hcl-p5","followers_url":"https://api.github.com/users/aau-hcl-p5/followers","following_url":"https://api.github.com/users/aau-hcl-p5/following{/other_user}","gists_url":"https://api.github.com/users/aau-hcl-p5/gists{/gist_id}","starred_url":"https://api.github.com/users/aau-hcl-p5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aau-hcl-p5/subscriptions","organizations_url":"https://api.github.com/users/aau-hcl-p5/orgs","repos_url":"https://api.github.com/users/aau-hcl-p5/repos","events_url":"https://api.github.com/users/aau-hcl-p5/events{/privacy}","received_events_url":"https://api.github.com/users/aau-hcl-p5/received_events","type":"Organization","site_admin":false},"repo":{"id":147644695,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc2NDQ2OTU=","name":"main","full_name":"aau-hcl-p5/main","private":false,"owner":{"login":"aau-hcl-p5","id":43030341,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDMwMzQx","avatar_url":"https://avatars0.githubusercontent.com/u/43030341?v=4","gravatar_id":"","url":"https://api.github.com/users/aau-hcl-p5","html_url":"https://github.com/aau-hcl-p5","followers_url":"https://api.github.com/users/aau-hcl-p5/followers","following_url":"https://api.github.com/users/aau-hcl-p5/following{/other_user}","gists_url":"https://api.github.com/users/aau-hcl-p5/gists{/gist_id}","starred_url":"https://api.github.com/users/aau-hcl-p5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aau-hcl-p5/subscriptions","organizations_url":"https://api.github.com/users/aau-hcl-p5/orgs","repos_url":"https://api.github.com/users/aau-hcl-p5/repos","events_url":"https://api.github.com/users/aau-hcl-p5/events{/privacy}","received_events_url":"https://api.github.com/users/aau-hcl-p5/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/aau-hcl-p5/main","description":null,"fork":false,"url":"https://api.github.com/repos/aau-hcl-p5/main","forks_url":"https://api.github.com/repos/aau-hcl-p5/main/forks","keys_url":"https://api.github.com/repos/aau-hcl-p5/main/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aau-hcl-p5/main/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aau-hcl-p5/main/teams","hooks_url":"https://api.github.com/repos/aau-hcl-p5/main/hooks","issue_events_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/events{/number}","events_url":"https://api.github.com/repos/aau-hcl-p5/main/events","assignees_url":"https://api.github.com/repos/aau-hcl-p5/main/assignees{/user}","branches_url":"https://api.github.com/repos/aau-hcl-p5/main/branches{/branch}","tags_url":"https://api.github.com/repos/aau-hcl-p5/main/tags","blobs_url":"https://api.github.com/repos/aau-hcl-p5/main/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aau-hcl-p5/main/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aau-hcl-p5/main/git/refs{/sha}","trees_url":"https://api.github.com/repos/aau-hcl-p5/main/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aau-hcl-p5/main/statuses/{sha}","languages_url":"https://api.github.com/repos/aau-hcl-p5/main/languages","stargazers_url":"https://api.github.com/repos/aau-hcl-p5/main/stargazers","contributors_url":"https://api.github.com/repos/aau-hcl-p5/main/contributors","subscribers_url":"https://api.github.com/repos/aau-hcl-p5/main/subscribers","subscription_url":"https://api.github.com/repos/aau-hcl-p5/main/subscription","commits_url":"https://api.github.com/repos/aau-hcl-p5/main/commits{/sha}","git_commits_url":"https://api.github.com/repos/aau-hcl-p5/main/git/commits{/sha}","comments_url":"https://api.github.com/repos/aau-hcl-p5/main/comments{/number}","issue_comment_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/comments{/number}","contents_url":"https://api.github.com/repos/aau-hcl-p5/main/contents/{+path}","compare_url":"https://api.github.com/repos/aau-hcl-p5/main/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aau-hcl-p5/main/merges","archive_url":"https://api.github.com/repos/aau-hcl-p5/main/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aau-hcl-p5/main/downloads","issues_url":"https://api.github.com/repos/aau-hcl-p5/main/issues{/number}","pulls_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls{/number}","milestones_url":"https://api.github.com/repos/aau-hcl-p5/main/milestones{/number}","notifications_url":"https://api.github.com/repos/aau-hcl-p5/main/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aau-hcl-p5/main/labels{/name}","releases_url":"https://api.github.com/repos/aau-hcl-p5/main/releases{/id}","deployments_url":"https://api.github.com/repos/aau-hcl-p5/main/deployments","created_at":"2018-09-06T08:48:06Z","updated_at":"2018-11-23T09:47:05Z","pushed_at":"2018-11-25T16:50:10Z","git_url":"git://github.com/aau-hcl-p5/main.git","ssh_url":"git@github.com:aau-hcl-p5/main.git","clone_url":"https://github.com/aau-hcl-p5/main.git","svn_url":"https://github.com/aau-hcl-p5/main","homepage":null,"size":25165,"stargazers_count":2,"watchers_count":2,"language":"TeX","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":2,"default_branch":"develop"}},"base":{"label":"aau-hcl-p5:develop","ref":"develop","sha":"2babb972b407dce2a3a520ac188f25d834b7c334","user":{"login":"aau-hcl-p5","id":43030341,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDMwMzQx","avatar_url":"https://avatars0.githubusercontent.com/u/43030341?v=4","gravatar_id":"","url":"https://api.github.com/users/aau-hcl-p5","html_url":"https://github.com/aau-hcl-p5","followers_url":"https://api.github.com/users/aau-hcl-p5/followers","following_url":"https://api.github.com/users/aau-hcl-p5/following{/other_user}","gists_url":"https://api.github.com/users/aau-hcl-p5/gists{/gist_id}","starred_url":"https://api.github.com/users/aau-hcl-p5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aau-hcl-p5/subscriptions","organizations_url":"https://api.github.com/users/aau-hcl-p5/orgs","repos_url":"https://api.github.com/users/aau-hcl-p5/repos","events_url":"https://api.github.com/users/aau-hcl-p5/events{/privacy}","received_events_url":"https://api.github.com/users/aau-hcl-p5/received_events","type":"Organization","site_admin":false},"repo":{"id":147644695,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc2NDQ2OTU=","name":"main","full_name":"aau-hcl-p5/main","private":false,"owner":{"login":"aau-hcl-p5","id":43030341,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDMwMzQx","avatar_url":"https://avatars0.githubusercontent.com/u/43030341?v=4","gravatar_id":"","url":"https://api.github.com/users/aau-hcl-p5","html_url":"https://github.com/aau-hcl-p5","followers_url":"https://api.github.com/users/aau-hcl-p5/followers","following_url":"https://api.github.com/users/aau-hcl-p5/following{/other_user}","gists_url":"https://api.github.com/users/aau-hcl-p5/gists{/gist_id}","starred_url":"https://api.github.com/users/aau-hcl-p5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aau-hcl-p5/subscriptions","organizations_url":"https://api.github.com/users/aau-hcl-p5/orgs","repos_url":"https://api.github.com/users/aau-hcl-p5/repos","events_url":"https://api.github.com/users/aau-hcl-p5/events{/privacy}","received_events_url":"https://api.github.com/users/aau-hcl-p5/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/aau-hcl-p5/main","description":null,"fork":false,"url":"https://api.github.com/repos/aau-hcl-p5/main","forks_url":"https://api.github.com/repos/aau-hcl-p5/main/forks","keys_url":"https://api.github.com/repos/aau-hcl-p5/main/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aau-hcl-p5/main/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aau-hcl-p5/main/teams","hooks_url":"https://api.github.com/repos/aau-hcl-p5/main/hooks","issue_events_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/events{/number}","events_url":"https://api.github.com/repos/aau-hcl-p5/main/events","assignees_url":"https://api.github.com/repos/aau-hcl-p5/main/assignees{/user}","branches_url":"https://api.github.com/repos/aau-hcl-p5/main/branches{/branch}","tags_url":"https://api.github.com/repos/aau-hcl-p5/main/tags","blobs_url":"https://api.github.com/repos/aau-hcl-p5/main/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aau-hcl-p5/main/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aau-hcl-p5/main/git/refs{/sha}","trees_url":"https://api.github.com/repos/aau-hcl-p5/main/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aau-hcl-p5/main/statuses/{sha}","languages_url":"https://api.github.com/repos/aau-hcl-p5/main/languages","stargazers_url":"https://api.github.com/repos/aau-hcl-p5/main/stargazers","contributors_url":"https://api.github.com/repos/aau-hcl-p5/main/contributors","subscribers_url":"https://api.github.com/repos/aau-hcl-p5/main/subscribers","subscription_url":"https://api.github.com/repos/aau-hcl-p5/main/subscription","commits_url":"https://api.github.com/repos/aau-hcl-p5/main/commits{/sha}","git_commits_url":"https://api.github.com/repos/aau-hcl-p5/main/git/commits{/sha}","comments_url":"https://api.github.com/repos/aau-hcl-p5/main/comments{/number}","issue_comment_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/comments{/number}","contents_url":"https://api.github.com/repos/aau-hcl-p5/main/contents/{+path}","compare_url":"https://api.github.com/repos/aau-hcl-p5/main/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aau-hcl-p5/main/merges","archive_url":"https://api.github.com/repos/aau-hcl-p5/main/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aau-hcl-p5/main/downloads","issues_url":"https://api.github.com/repos/aau-hcl-p5/main/issues{/number}","pulls_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls{/number}","milestones_url":"https://api.github.com/repos/aau-hcl-p5/main/milestones{/number}","notifications_url":"https://api.github.com/repos/aau-hcl-p5/main/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aau-hcl-p5/main/labels{/name}","releases_url":"https://api.github.com/repos/aau-hcl-p5/main/releases{/id}","deployments_url":"https://api.github.com/repos/aau-hcl-p5/main/deployments","created_at":"2018-09-06T08:48:06Z","updated_at":"2018-11-23T09:47:05Z","pushed_at":"2018-11-25T16:50:10Z","git_url":"git://github.com/aau-hcl-p5/main.git","ssh_url":"git@github.com:aau-hcl-p5/main.git","clone_url":"https://github.com/aau-hcl-p5/main.git","svn_url":"https://github.com/aau-hcl-p5/main","homepage":null,"size":25165,"stargazers_count":2,"watchers_count":2,"language":"TeX","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/94"},"html":{"href":"https://github.com/aau-hcl-p5/main/pull/94"},"issue":{"href":"https://api.github.com/repos/aau-hcl-p5/main/issues/94"},"comments":{"href":"https://api.github.com/repos/aau-hcl-p5/main/issues/94/comments"},"review_comments":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/94/comments"},"review_comment":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/94/commits"},"statuses":{"href":"https://api.github.com/repos/aau-hcl-p5/main/statuses/36e0cb492ba22d12e76f49d6cca563095da69c06"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nillas12"}}