{"action":"created","comment":{"url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/comments/46683017","id":46683017,"diff_hunk":"@@ -0,0 +1,57 @@\n+#ifndef BIN_PROCESSING_H\n+#define BIN_PROCESSING_H\n+\n+#include <fstream>\n+#include <ios>\n+#include <iostream>\n+#include <string>\n+\n+#include \"exception.hpp\"\n+\n+\n+template <typename T>\n+void LoadBinFile(const std::string& fileName, T* data, int& rows, int& cols, int& channels);\n+\n+template <typename T>\n+void SaveBinFile(const std::string& fileName, const T* data, int rows, int cols, int channels);\n+\n+\n+template <typename T>\n+void LoadBinFile(const std::string& fileName, T* data, int& rows, int& cols, int& channels) {\n+    std::ifstream ifs(fileName.c_str(), std::ios_base::in | std::ios_base::binary);\n+\n+    if (ifs.is_open() == false) {\n+        throw exception(\"Fail to open file: '\" + fileName + \"'.\");\n+    }\n+\n+    ifs.read(reinterpret_cast<char*>(&rows), sizeof(int));\n+    ifs.read(reinterpret_cast<char*>(&cols), sizeof(int));\n+    ifs.read(reinterpret_cast<char*>(&channels), sizeof(int));\n+\n+    const int num_el = rows * cols * channels;\n+    data = new T[num_el];\n+    ifs.read(reinterpret_cast<char*>(data), sizeof(T) * num_el);\n+\n+    ifs.close();\n+}\n+\n+template <typename T>\n+void SaveBinFile(const std::string& fileName, const T* data, int rows, int cols, int channels) {\n+    std::ofstream ofs(fileName.c_str(), std::ios_base::out | std::ios_base::binary);\n+\n+    if (ofs.is_open() == false) {\n+        throw exception(\"Fail to open file: '\" + fileName + \"'.\");\n+    }    \n+\n+    ofs.write(reinterpret_cast<const char*>(&rows), sizeof(int));\n+    ofs.write(reinterpret_cast<const char*>(&cols), sizeof(int));\n+    ofs.write(reinterpret_cast<const char*>(&channels), sizeof(int));\n+\n+    const int num_el = rows * cols * channels;\n+    ofs.write(reinterpret_cast<const char*>(data), sizeof(T) * num_el);\n+\n+    ofs.close();\n+}","path":"extra/apps/inference_converter/util/bin_processing.hpp","position":54,"original_position":54,"commit_id":"efed7f876a04e7ce2164d0110fde819b162f1555","original_commit_id":"efed7f876a04e7ce2164d0110fde819b162f1555","user":{"login":"zhiltsov-max","id":13832349,"avatar_url":"https://avatars.githubusercontent.com/u/13832349?v=3","gravatar_id":"","url":"https://api.github.com/users/zhiltsov-max","html_url":"https://github.com/zhiltsov-max","followers_url":"https://api.github.com/users/zhiltsov-max/followers","following_url":"https://api.github.com/users/zhiltsov-max/following{/other_user}","gists_url":"https://api.github.com/users/zhiltsov-max/gists{/gist_id}","starred_url":"https://api.github.com/users/zhiltsov-max/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhiltsov-max/subscriptions","organizations_url":"https://api.github.com/users/zhiltsov-max/orgs","repos_url":"https://api.github.com/users/zhiltsov-max/repos","events_url":"https://api.github.com/users/zhiltsov-max/events{/privacy}","received_events_url":"https://api.github.com/users/zhiltsov-max/received_events","type":"User","site_admin":false},"body":"Можно, но зачем?","created_at":"2015-12-04T13:51:18Z","updated_at":"2015-12-04T13:51:18Z","html_url":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab/pull/12#discussion_r46683017","pull_request_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/comments/46683017"},"html":{"href":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab/pull/12#discussion_r46683017"},"pull_request":{"href":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/12","id":52577412,"html_url":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab/pull/12","diff_url":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab/pull/12.diff","patch_url":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab/pull/12.patch","issue_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/issues/12","number":12,"state":"open","locked":false,"title":"Added: mat to png converter tool","user":{"login":"zhiltsov-max","id":13832349,"avatar_url":"https://avatars.githubusercontent.com/u/13832349?v=3","gravatar_id":"","url":"https://api.github.com/users/zhiltsov-max","html_url":"https://github.com/zhiltsov-max","followers_url":"https://api.github.com/users/zhiltsov-max/followers","following_url":"https://api.github.com/users/zhiltsov-max/following{/other_user}","gists_url":"https://api.github.com/users/zhiltsov-max/gists{/gist_id}","starred_url":"https://api.github.com/users/zhiltsov-max/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhiltsov-max/subscriptions","organizations_url":"https://api.github.com/users/zhiltsov-max/orgs","repos_url":"https://api.github.com/users/zhiltsov-max/repos","events_url":"https://api.github.com/users/zhiltsov-max/events{/privacy}","received_events_url":"https://api.github.com/users/zhiltsov-max/received_events","type":"User","site_admin":false},"body":"Подходит для создания видео, но не умеет записывать colormap в файл, так что с оценкой результатов пока никак.\r\n\r\nПо colormap:\r\nhttps://joekuan.wordpress.com/2009/05/26/how-to-create-8-bit-colormap-png-image-for-usplash/\r\nhttp://www.libpng.org/pub/png/book/chapter08.html","created_at":"2015-12-03T19:06:44Z","updated_at":"2015-12-04T13:51:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e25ea9296633cf3e1c6875519bbaa85cdba9a4bf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/12/commits","review_comments_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/12/comments","review_comment_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/issues/12/comments","statuses_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/statuses/efed7f876a04e7ce2164d0110fde819b162f1555","head":{"label":"ITLab-Vision:converters","ref":"converters","sha":"efed7f876a04e7ce2164d0110fde819b162f1555","user":{"login":"ITLab-Vision","id":9713705,"avatar_url":"https://avatars.githubusercontent.com/u/9713705?v=3","gravatar_id":"","url":"https://api.github.com/users/ITLab-Vision","html_url":"https://github.com/ITLab-Vision","followers_url":"https://api.github.com/users/ITLab-Vision/followers","following_url":"https://api.github.com/users/ITLab-Vision/following{/other_user}","gists_url":"https://api.github.com/users/ITLab-Vision/gists{/gist_id}","starred_url":"https://api.github.com/users/ITLab-Vision/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITLab-Vision/subscriptions","organizations_url":"https://api.github.com/users/ITLab-Vision/orgs","repos_url":"https://api.github.com/users/ITLab-Vision/repos","events_url":"https://api.github.com/users/ITLab-Vision/events{/privacy}","received_events_url":"https://api.github.com/users/ITLab-Vision/received_events","type":"Organization","site_admin":false},"repo":{"id":45383301,"name":"ITLab-Vision-deeplab","full_name":"ITLab-Vision/ITLab-Vision-deeplab","owner":{"login":"ITLab-Vision","id":9713705,"avatar_url":"https://avatars.githubusercontent.com/u/9713705?v=3","gravatar_id":"","url":"https://api.github.com/users/ITLab-Vision","html_url":"https://github.com/ITLab-Vision","followers_url":"https://api.github.com/users/ITLab-Vision/followers","following_url":"https://api.github.com/users/ITLab-Vision/following{/other_user}","gists_url":"https://api.github.com/users/ITLab-Vision/gists{/gist_id}","starred_url":"https://api.github.com/users/ITLab-Vision/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITLab-Vision/subscriptions","organizations_url":"https://api.github.com/users/ITLab-Vision/orgs","repos_url":"https://api.github.com/users/ITLab-Vision/repos","events_url":"https://api.github.com/users/ITLab-Vision/events{/privacy}","received_events_url":"https://api.github.com/users/ITLab-Vision/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab","description":"Working copy of Deeplab repository (https://bitbucket.org/deeplab/deeplab-public).","fork":false,"url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab","forks_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/forks","keys_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/teams","hooks_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/hooks","issue_events_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/issues/events{/number}","events_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/events","assignees_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/assignees{/user}","branches_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/branches{/branch}","tags_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/tags","blobs_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/git/refs{/sha}","trees_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/statuses/{sha}","languages_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/languages","stargazers_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/stargazers","contributors_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/contributors","subscribers_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/subscribers","subscription_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/subscription","commits_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/commits{/sha}","git_commits_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/git/commits{/sha}","comments_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/comments{/number}","issue_comment_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/issues/comments{/number}","contents_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/contents/{+path}","compare_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/merges","archive_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/downloads","issues_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/issues{/number}","pulls_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls{/number}","milestones_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/milestones{/number}","notifications_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/labels{/name}","releases_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/releases{/id}","created_at":"2015-11-02T09:02:33Z","updated_at":"2015-11-02T09:08:31Z","pushed_at":"2015-12-03T19:06:44Z","git_url":"git://github.com/ITLab-Vision/ITLab-Vision-deeplab.git","ssh_url":"git@github.com:ITLab-Vision/ITLab-Vision-deeplab.git","clone_url":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab.git","svn_url":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab","homepage":null,"size":17422,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"ITLab-Vision:master","ref":"master","sha":"69cb5a63018cabd0768b62466a4ff0943e507185","user":{"login":"ITLab-Vision","id":9713705,"avatar_url":"https://avatars.githubusercontent.com/u/9713705?v=3","gravatar_id":"","url":"https://api.github.com/users/ITLab-Vision","html_url":"https://github.com/ITLab-Vision","followers_url":"https://api.github.com/users/ITLab-Vision/followers","following_url":"https://api.github.com/users/ITLab-Vision/following{/other_user}","gists_url":"https://api.github.com/users/ITLab-Vision/gists{/gist_id}","starred_url":"https://api.github.com/users/ITLab-Vision/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITLab-Vision/subscriptions","organizations_url":"https://api.github.com/users/ITLab-Vision/orgs","repos_url":"https://api.github.com/users/ITLab-Vision/repos","events_url":"https://api.github.com/users/ITLab-Vision/events{/privacy}","received_events_url":"https://api.github.com/users/ITLab-Vision/received_events","type":"Organization","site_admin":false},"repo":{"id":45383301,"name":"ITLab-Vision-deeplab","full_name":"ITLab-Vision/ITLab-Vision-deeplab","owner":{"login":"ITLab-Vision","id":9713705,"avatar_url":"https://avatars.githubusercontent.com/u/9713705?v=3","gravatar_id":"","url":"https://api.github.com/users/ITLab-Vision","html_url":"https://github.com/ITLab-Vision","followers_url":"https://api.github.com/users/ITLab-Vision/followers","following_url":"https://api.github.com/users/ITLab-Vision/following{/other_user}","gists_url":"https://api.github.com/users/ITLab-Vision/gists{/gist_id}","starred_url":"https://api.github.com/users/ITLab-Vision/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITLab-Vision/subscriptions","organizations_url":"https://api.github.com/users/ITLab-Vision/orgs","repos_url":"https://api.github.com/users/ITLab-Vision/repos","events_url":"https://api.github.com/users/ITLab-Vision/events{/privacy}","received_events_url":"https://api.github.com/users/ITLab-Vision/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab","description":"Working copy of Deeplab repository (https://bitbucket.org/deeplab/deeplab-public).","fork":false,"url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab","forks_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/forks","keys_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/teams","hooks_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/hooks","issue_events_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/issues/events{/number}","events_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/events","assignees_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/assignees{/user}","branches_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/branches{/branch}","tags_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/tags","blobs_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/git/refs{/sha}","trees_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/statuses/{sha}","languages_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/languages","stargazers_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/stargazers","contributors_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/contributors","subscribers_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/subscribers","subscription_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/subscription","commits_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/commits{/sha}","git_commits_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/git/commits{/sha}","comments_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/comments{/number}","issue_comment_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/issues/comments{/number}","contents_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/contents/{+path}","compare_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/merges","archive_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/downloads","issues_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/issues{/number}","pulls_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls{/number}","milestones_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/milestones{/number}","notifications_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/labels{/name}","releases_url":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/releases{/id}","created_at":"2015-11-02T09:02:33Z","updated_at":"2015-11-02T09:08:31Z","pushed_at":"2015-12-03T19:06:44Z","git_url":"git://github.com/ITLab-Vision/ITLab-Vision-deeplab.git","ssh_url":"git@github.com:ITLab-Vision/ITLab-Vision-deeplab.git","clone_url":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab.git","svn_url":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab","homepage":null,"size":17422,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/12"},"html":{"href":"https://github.com/ITLab-Vision/ITLab-Vision-deeplab/pull/12"},"issue":{"href":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/issues/12"},"comments":{"href":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/ITLab-Vision/ITLab-Vision-deeplab/statuses/efed7f876a04e7ce2164d0110fde819b162f1555"}}}}