본문 바로가기

분류 전체보기

(158)
영상처리 C++ 코드 - HOG+SVM을 활용한 보행자 검출 요즘 유행하는 딥러닝도 참 좋지만 느리고 복잡하고 비용이 비싸다. 가끔은 고전적인 방식도 좋다. 사람 검출을 위해 hog로 피처를 추출해서 svm으로 사람인지 아닌지를 구분하여 box를 친다. 이를 위해 알고리즘을 추출 후 서포트 벡터 머신을 활용하였다. default people detector와 daimler people detector를 사용하였다. 영상 >> 코드 >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 ..
c++ leetcode coin change code code >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 class Solution { public: int returnMin(vector& funcSave, vector& tempVec) { vector temporary; for (const auto& temp : tempVec) if (temp = 0) temporary.push_back(funcSave[temp]); else continue; if (temporary.size() > 0) { i..
leetcode minimum path sum c++ code class Solution { public: int minPathSum(vector& grid) { int xSize = grid[0].size(); int ySize = grid.size(); for (int x = 1; x
c++ leetcode DP min cost climing stairs code code >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 class Solution { public: int minCostClimbingStairs(vector& cost) { int s = cost[0]; int f = cost[1]; if (cost.size() == 2) return std::min(s, f); for (int i = 2; i
c++ leetcode climbing stairs DP solution(Top-down and bottom-up) Top-down code >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 class Solution { public: vector stairVector{ 1,2 }; int climbStairs(int n) { if (n == 1) return 1; if (n == 2) return 2; int sSize = (int)stairVector.size(); if (sSize > n) return stairVector[n-1]; else { int ans = climbStairs(n-1) + climbStairs(n-2); stairVector.push_back(ans); return ans; } } }; Colored by Color Scripter Bo..
c++ leetcode 939 minimum rectangle area o(n^2) solution code code >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 class Solution { public: int minAreaRect(vector& points) { int vecSize = (int)points.size(); unordered_map hashMap; int result = 0; int minArea = 1600000001; int tempArea = 0; int minx = 0; int miny = 0; int maxx = 0; int maxy = 0; for (const auto& poi..
c++ leetcode 525 contiguous array solution code >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 class Solution { public: int findMaxLength(vector& nums) { const int numSize = (int)nums.size(); unordered_map hashMap; int result = 0; hashMap[0].emplace_back(-1); int accum = 0; for (int i = 0; i result) result = diff; } return result; } }; Colored by Color Scripter
c++ leetcode 380 Insert Delete GetRandom o(1) solution code code >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 class RandomizedSet { public: /** Initialize your data structure here. */ unordered_map hashmap; vector intarray; RandomizedSet() { } /** Inserts a value to the set. Returns true if the set did not already contain the specified element. */ bool insert(int va..