{"action":"created","comment":{"url":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/comments/41717562","id":41717562,"diff_hunk":"@@ -0,0 +1,64 @@\n+///@File: SegmentMotionBU.h\n+///@Brief: Contains implementation of segmentation based on difference\n+///        between two frames and background updating\n+///@Author: Vitaliy Baldeev\n+///@Date: 03 October 2015\n+\n+#pragma once\n+\n+#include \"ISegmentMotion.h\"\n+#include \"SegmentMotionFactory.h\"\n+#include \"opencv2\\videoio.hpp\"\n+#include \"opencv2\\core\\mat.hpp\"\n+#include \"opencv2\\imgproc.hpp\"\n+#include \"opencv2\\highgui.hpp\"\n+\n+///@class SegmentMotionBU\n+/// Demonstrates the algorithm of simplest background subtraction with\n+/// background updating per every frame\n+class SegmentMotionBU : public ISegmentMotion\n+{\n+public:\n+    ///@brief Launch demostration\n+    void Run();\n+\n+private:\n+    ///@brief Apply algorithm\n+    void apply(cv::Mat& src, cv::Mat& dst);\n+\n+    ///@brief Create trackbars\n+    void createGUI();\n+\n+    ///@brief Update background\n+    void updateBackground(cv::Mat& currentFrame);\n+\n+    ///@brief Set m_params.threshold from trackbar\n+    static void setThresholdFromSlider(int thresholdSlider, void* paramsPtr);\n+\n+    ///@brief Set m_params.alpha from trackbar\n+    static void setAlphaFromSlider(int alphaSlider, void* paramsPtr);\n+\n+    ///@brief structure of parameters with single object - m_params\n+    struct Params\n+    {\n+        int threshold;          ///< maximum of distance between background and current frame\n+        int alpha;              ///< velocity of learning\n+    } m_params;\n+\n+\n+    cv::Mat m_background;       ///< current background image\n+    cv::Mat m_prevBackground;   ///< previous backround image\n+    cv::Mat m_currentFrame;     ///< current image from camera\n+    cv::Mat m_foreground;       ///< binary image with moving objects\n+};\n+\n+namespace\n+{\n+    ISegmentMotion* CreateSegmentMotionBU()","path":"lesson3/SegmentMotionBU.h","position":57,"original_position":57,"commit_id":"c3fa001a947f3efd64a9972f1be10257484af37e","original_commit_id":"c3fa001a947f3efd64a9972f1be10257484af37e","user":{"login":"vitaliybaldeev","id":7349249,"avatar_url":"https://avatars.githubusercontent.com/u/7349249?v=3","gravatar_id":"","url":"https://api.github.com/users/vitaliybaldeev","html_url":"https://github.com/vitaliybaldeev","followers_url":"https://api.github.com/users/vitaliybaldeev/followers","following_url":"https://api.github.com/users/vitaliybaldeev/following{/other_user}","gists_url":"https://api.github.com/users/vitaliybaldeev/gists{/gist_id}","starred_url":"https://api.github.com/users/vitaliybaldeev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitaliybaldeev/subscriptions","organizations_url":"https://api.github.com/users/vitaliybaldeev/orgs","repos_url":"https://api.github.com/users/vitaliybaldeev/repos","events_url":"https://api.github.com/users/vitaliybaldeev/events{/privacy}","received_events_url":"https://api.github.com/users/vitaliybaldeev/received_events","type":"User","site_admin":false},"body":"Тогда теряется смысл фабрики. Каждый, кто будет писать свой алгоритм, будет модифицировать код класса-фабрики. Это неудобно.","created_at":"2015-10-11T23:49:33Z","updated_at":"2015-10-11T23:49:33Z","html_url":"https://github.com/rgolovanov/cvclasses15/pull/2#discussion_r41717562","pull_request_url":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/comments/41717562"},"html":{"href":"https://github.com/rgolovanov/cvclasses15/pull/2#discussion_r41717562"},"pull_request":{"href":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/2","id":46728131,"html_url":"https://github.com/rgolovanov/cvclasses15/pull/2","diff_url":"https://github.com/rgolovanov/cvclasses15/pull/2.diff","patch_url":"https://github.com/rgolovanov/cvclasses15/pull/2.patch","issue_url":"https://api.github.com/repos/rgolovanov/cvclasses15/issues/2","number":2,"state":"open","locked":false,"title":"Add segment motion project","user":{"login":"vitaliybaldeev","id":7349249,"avatar_url":"https://avatars.githubusercontent.com/u/7349249?v=3","gravatar_id":"","url":"https://api.github.com/users/vitaliybaldeev","html_url":"https://github.com/vitaliybaldeev","followers_url":"https://api.github.com/users/vitaliybaldeev/followers","following_url":"https://api.github.com/users/vitaliybaldeev/following{/other_user}","gists_url":"https://api.github.com/users/vitaliybaldeev/gists{/gist_id}","starred_url":"https://api.github.com/users/vitaliybaldeev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitaliybaldeev/subscriptions","organizations_url":"https://api.github.com/users/vitaliybaldeev/orgs","repos_url":"https://api.github.com/users/vitaliybaldeev/repos","events_url":"https://api.github.com/users/vitaliybaldeev/events{/privacy}","received_events_url":"https://api.github.com/users/vitaliybaldeev/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-04T16:43:52Z","updated_at":"2015-10-11T23:49:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"53103e13cf5445ad3c2a0d2ba77dcdb0e53f7214","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/2/commits","review_comments_url":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/2/comments","review_comment_url":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rgolovanov/cvclasses15/issues/2/comments","statuses_url":"https://api.github.com/repos/rgolovanov/cvclasses15/statuses/c3fa001a947f3efd64a9972f1be10257484af37e","head":{"label":"vitaliybaldeev:master","ref":"master","sha":"c3fa001a947f3efd64a9972f1be10257484af37e","user":{"login":"vitaliybaldeev","id":7349249,"avatar_url":"https://avatars.githubusercontent.com/u/7349249?v=3","gravatar_id":"","url":"https://api.github.com/users/vitaliybaldeev","html_url":"https://github.com/vitaliybaldeev","followers_url":"https://api.github.com/users/vitaliybaldeev/followers","following_url":"https://api.github.com/users/vitaliybaldeev/following{/other_user}","gists_url":"https://api.github.com/users/vitaliybaldeev/gists{/gist_id}","starred_url":"https://api.github.com/users/vitaliybaldeev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitaliybaldeev/subscriptions","organizations_url":"https://api.github.com/users/vitaliybaldeev/orgs","repos_url":"https://api.github.com/users/vitaliybaldeev/repos","events_url":"https://api.github.com/users/vitaliybaldeev/events{/privacy}","received_events_url":"https://api.github.com/users/vitaliybaldeev/received_events","type":"User","site_admin":false},"repo":{"id":43640952,"name":"cvclasses15","full_name":"vitaliybaldeev/cvclasses15","owner":{"login":"vitaliybaldeev","id":7349249,"avatar_url":"https://avatars.githubusercontent.com/u/7349249?v=3","gravatar_id":"","url":"https://api.github.com/users/vitaliybaldeev","html_url":"https://github.com/vitaliybaldeev","followers_url":"https://api.github.com/users/vitaliybaldeev/followers","following_url":"https://api.github.com/users/vitaliybaldeev/following{/other_user}","gists_url":"https://api.github.com/users/vitaliybaldeev/gists{/gist_id}","starred_url":"https://api.github.com/users/vitaliybaldeev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitaliybaldeev/subscriptions","organizations_url":"https://api.github.com/users/vitaliybaldeev/orgs","repos_url":"https://api.github.com/users/vitaliybaldeev/repos","events_url":"https://api.github.com/users/vitaliybaldeev/events{/privacy}","received_events_url":"https://api.github.com/users/vitaliybaldeev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vitaliybaldeev/cvclasses15","description":"","fork":true,"url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15","forks_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/forks","keys_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/teams","hooks_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/hooks","issue_events_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/issues/events{/number}","events_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/events","assignees_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/assignees{/user}","branches_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/branches{/branch}","tags_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/tags","blobs_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/git/refs{/sha}","trees_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/statuses/{sha}","languages_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/languages","stargazers_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/stargazers","contributors_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/contributors","subscribers_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/subscribers","subscription_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/subscription","commits_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/commits{/sha}","git_commits_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/git/commits{/sha}","comments_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/comments{/number}","issue_comment_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/issues/comments{/number}","contents_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/contents/{+path}","compare_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/merges","archive_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/downloads","issues_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/issues{/number}","pulls_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/pulls{/number}","milestones_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/milestones{/number}","notifications_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/labels{/name}","releases_url":"https://api.github.com/repos/vitaliybaldeev/cvclasses15/releases{/id}","created_at":"2015-10-04T15:25:53Z","updated_at":"2015-10-04T15:25:54Z","pushed_at":"2015-10-11T14:39:36Z","git_url":"git://github.com/vitaliybaldeev/cvclasses15.git","ssh_url":"git@github.com:vitaliybaldeev/cvclasses15.git","clone_url":"https://github.com/vitaliybaldeev/cvclasses15.git","svn_url":"https://github.com/vitaliybaldeev/cvclasses15","homepage":null,"size":181,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"rgolovanov:master","ref":"master","sha":"98f7b08c427f602f744092a4cb8fe8ecefde3ca0","user":{"login":"rgolovanov","id":14174584,"avatar_url":"https://avatars.githubusercontent.com/u/14174584?v=3","gravatar_id":"","url":"https://api.github.com/users/rgolovanov","html_url":"https://github.com/rgolovanov","followers_url":"https://api.github.com/users/rgolovanov/followers","following_url":"https://api.github.com/users/rgolovanov/following{/other_user}","gists_url":"https://api.github.com/users/rgolovanov/gists{/gist_id}","starred_url":"https://api.github.com/users/rgolovanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgolovanov/subscriptions","organizations_url":"https://api.github.com/users/rgolovanov/orgs","repos_url":"https://api.github.com/users/rgolovanov/repos","events_url":"https://api.github.com/users/rgolovanov/events{/privacy}","received_events_url":"https://api.github.com/users/rgolovanov/received_events","type":"User","site_admin":false},"repo":{"id":42094566,"name":"cvclasses15","full_name":"rgolovanov/cvclasses15","owner":{"login":"rgolovanov","id":14174584,"avatar_url":"https://avatars.githubusercontent.com/u/14174584?v=3","gravatar_id":"","url":"https://api.github.com/users/rgolovanov","html_url":"https://github.com/rgolovanov","followers_url":"https://api.github.com/users/rgolovanov/followers","following_url":"https://api.github.com/users/rgolovanov/following{/other_user}","gists_url":"https://api.github.com/users/rgolovanov/gists{/gist_id}","starred_url":"https://api.github.com/users/rgolovanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgolovanov/subscriptions","organizations_url":"https://api.github.com/users/rgolovanov/orgs","repos_url":"https://api.github.com/users/rgolovanov/repos","events_url":"https://api.github.com/users/rgolovanov/events{/privacy}","received_events_url":"https://api.github.com/users/rgolovanov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rgolovanov/cvclasses15","description":"","fork":false,"url":"https://api.github.com/repos/rgolovanov/cvclasses15","forks_url":"https://api.github.com/repos/rgolovanov/cvclasses15/forks","keys_url":"https://api.github.com/repos/rgolovanov/cvclasses15/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rgolovanov/cvclasses15/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rgolovanov/cvclasses15/teams","hooks_url":"https://api.github.com/repos/rgolovanov/cvclasses15/hooks","issue_events_url":"https://api.github.com/repos/rgolovanov/cvclasses15/issues/events{/number}","events_url":"https://api.github.com/repos/rgolovanov/cvclasses15/events","assignees_url":"https://api.github.com/repos/rgolovanov/cvclasses15/assignees{/user}","branches_url":"https://api.github.com/repos/rgolovanov/cvclasses15/branches{/branch}","tags_url":"https://api.github.com/repos/rgolovanov/cvclasses15/tags","blobs_url":"https://api.github.com/repos/rgolovanov/cvclasses15/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rgolovanov/cvclasses15/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rgolovanov/cvclasses15/git/refs{/sha}","trees_url":"https://api.github.com/repos/rgolovanov/cvclasses15/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rgolovanov/cvclasses15/statuses/{sha}","languages_url":"https://api.github.com/repos/rgolovanov/cvclasses15/languages","stargazers_url":"https://api.github.com/repos/rgolovanov/cvclasses15/stargazers","contributors_url":"https://api.github.com/repos/rgolovanov/cvclasses15/contributors","subscribers_url":"https://api.github.com/repos/rgolovanov/cvclasses15/subscribers","subscription_url":"https://api.github.com/repos/rgolovanov/cvclasses15/subscription","commits_url":"https://api.github.com/repos/rgolovanov/cvclasses15/commits{/sha}","git_commits_url":"https://api.github.com/repos/rgolovanov/cvclasses15/git/commits{/sha}","comments_url":"https://api.github.com/repos/rgolovanov/cvclasses15/comments{/number}","issue_comment_url":"https://api.github.com/repos/rgolovanov/cvclasses15/issues/comments{/number}","contents_url":"https://api.github.com/repos/rgolovanov/cvclasses15/contents/{+path}","compare_url":"https://api.github.com/repos/rgolovanov/cvclasses15/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rgolovanov/cvclasses15/merges","archive_url":"https://api.github.com/repos/rgolovanov/cvclasses15/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rgolovanov/cvclasses15/downloads","issues_url":"https://api.github.com/repos/rgolovanov/cvclasses15/issues{/number}","pulls_url":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls{/number}","milestones_url":"https://api.github.com/repos/rgolovanov/cvclasses15/milestones{/number}","notifications_url":"https://api.github.com/repos/rgolovanov/cvclasses15/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rgolovanov/cvclasses15/labels{/name}","releases_url":"https://api.github.com/repos/rgolovanov/cvclasses15/releases{/id}","created_at":"2015-09-08T06:38:50Z","updated_at":"2015-09-08T17:51:38Z","pushed_at":"2015-10-11T14:39:38Z","git_url":"git://github.com/rgolovanov/cvclasses15.git","ssh_url":"git@github.com:rgolovanov/cvclasses15.git","clone_url":"https://github.com/rgolovanov/cvclasses15.git","svn_url":"https://github.com/rgolovanov/cvclasses15","homepage":null,"size":327,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/2"},"html":{"href":"https://github.com/rgolovanov/cvclasses15/pull/2"},"issue":{"href":"https://api.github.com/repos/rgolovanov/cvclasses15/issues/2"},"comments":{"href":"https://api.github.com/repos/rgolovanov/cvclasses15/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rgolovanov/cvclasses15/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/rgolovanov/cvclasses15/statuses/c3fa001a947f3efd64a9972f1be10257484af37e"}}}}