🐍Python

    [OpenCV] 06-2. Optical Flow

    이번 장에서는,광학 흐름의 개념에 대해서 이해하고 Lucas-Kanade 방법을 사용한 추정을 해보고cv2.calcOpticalFlowPyrLK() 함수를 사용해서 비디오에서의 특성 점을 추적해볼 것이다.Optical Flow광학 흐름은 물체나 카메라의 움직임에 의해 발생하는 두 개의 연속되는 프레임사이에서 객체의 외관상 움직임의 패턴이다. 각 벡터는 첫 번째 프레임에서 점이 두 번째 프레임으로 점으로의 움직임을 보여주는 이동 벡터인 2D 벡터 필드이다. 아래 이미지를 보자!사진위 사진은 공의 움직임을 5개 연속적인 프레임으로 보여준다. 화살표는 이동 벡터를 나타낸다. 광학 흐름은 다음과 같은 분야에서 적용된다 :움직임을 통한 구조 분석비디오 압축비디오 안정화 : 깨끗한 영상..

    [알고리즘] 47. Equalize the Array

    Karl has an array of integers. He wants to reduce the array until all remaining elements are equal. Determine the minimum number of elements to delete to reach his goal.For example, if his array is , we see that he can delete the elements and leaving . He could also delete both twos and either the or the , but that would take deletions. The minimum number of deletions is .Function DescriptionCom..

    [알고리즘] 46. Jumping on the Clouds

    Emma is playing a new mobile game that starts with consecutively numbered clouds. Some of the clouds are thunderheads and others are cumulus. She can jump on any cumulus cloud having a number that is equal to the number of the current cloud plus or . She must avoid the thunderheads. Determine the minimum number of jumps it will take Emma to jump from her starting postion to the last cloud. It is..

    [알고리즘] 45. Repeated String

    Lilah has a string, , of lowercase English letters that she repeated infinitely many times.Given an integer, , find and print the number of letter a's in the first letters of Lilah's infinite string.For example, if the string and , the substring we consider is , the first characters of her infinite string. There are occurrences of a in the substring.Function DescriptionComplete the repeatedStrin..

    [OpenCV] 06-1. Meanshift and Camshift

    이번 장에서는비디오에서 물체를 찾고 트래킹하기 위해 사용되는 Meanshift 와 Camshift에 대해서 배워 볼 것이다.MeanshiftMeanshift의 알고리즘은 간단하다. 수 많은 포인트 셋을 가지고 있다고 생각해보자(히스토그램의 배경투사 같은 픽셀 분포일 수 있다.) 작은 창(아마 원)을 받고, 이 창을 픽셀 밀집도가 최대인 지역(또는 포인트의 수가 최대인 곳)으로 이동시켜야한다. 아래 그림을 보고 이해해보자.사진초기 창은 파란색 원으로 모이는 “C1”이다. 이 창의 중심은 파란색 직사각형으로 표시된 “C1_o”이다. 하지만 만약 창 안의 포인트들의 중심을 찾으면 “C1_r”(작은 파랑 동그라미, 창의 실제 중심이다.)을 얻을 것이다. 확실히 이는..

    [OpenCV] 05-10. Feature Matching + Homography to find Objects

    이번 장에서는Feature matching 과 calib3 모듈의 findHomography를 섞어서 복합적인 이미지에서 알고있는 객체를 찾아 볼 것이다.Basics이전 장에서는, queryImage를 사용해서 특성 포인트들을 찾고, 다른 이미지인 trainImage에서도 있는 특성 포인트를 찾고 가장 잘 맞는 매칭을 찾아냈다. 요약하자면, 객체 일부분의 위치를 찾아서 다른 뒤섞인 이미지 속에서 이를 찾아내는 것이다. 이 정보는 trainImage에서 객체를 찾기에 충분하다.그래서 우리는 calib3d 모듈에 있는 cv2.findHomography() 를 사용할 수 있다. 만약 우리가 두 이미지로부터의 포인트 집합을 ..