본문 바로가기

C

(101)
c++ sobel operator 구현 코드 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677void convert_greyscale_image_to_sobel(void){ unsigned const int n = 3; int sobel_x[n][n] = {-1,-2,-1,0,0,0,1,2,1}; int sobel_y[n][n] = {-1,0,1,-2,0,2,-1,0,1}; int R_patch[n][n] = { 0, 0,0,0,0,0,0,0,0}; int patch_y = -1; int patch_x = -1; for (int i = 0; i
c++ opencv keypoint를 활용한 homography 찾기 결과 >> 코드 >> 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 #include "opencv2/opencv.hpp" #include #include using namespace cv; int homographyStudy() { // 이미지 읽기 Mat src1 = imread("graf1.png", IMREAD_COLOR)..
영상처리 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..