KR101471199B1 - Method and apparatus for separating foreground and background from image, Method and apparatus for substituting separated background - Google Patents
Method and apparatus for separating foreground and background from image, Method and apparatus for substituting separated background Download PDFInfo
- Publication number
- KR101471199B1 KR101471199B1 KR1020080037563A KR20080037563A KR101471199B1 KR 101471199 B1 KR101471199 B1 KR 101471199B1 KR 1020080037563 A KR1020080037563 A KR 1020080037563A KR 20080037563 A KR20080037563 A KR 20080037563A KR 101471199 B1 KR101471199 B1 KR 101471199B1
- Authority
- KR
- South Korea
- Prior art keywords
- foreground
- background
- image
- region
- probability
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 238000000926 separation method Methods 0.000 claims abstract description 37
- 238000012937 correction Methods 0.000 claims description 14
- 238000000605 extraction Methods 0.000 claims description 12
- 230000002194 synthesizing effect Effects 0.000 claims description 7
- 239000000284 extract Substances 0.000 claims description 6
- 238000012545 processing Methods 0.000 abstract description 4
- 238000006467 substitution reaction Methods 0.000 abstract description 4
- 230000002123 temporal effect Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 8
- 238000005286 illumination Methods 0.000 description 4
- 239000003086 colorant Substances 0.000 description 2
- 238000003709 image segmentation Methods 0.000 description 2
- 239000000203 mixture Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 230000010339 dilation Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/50—Image enhancement or restoration using two or more images, e.g. averaging or subtraction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/80—Geometric correction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
영상을 전경과 배경으로 분리하는 방법 및 장치, 영상을 전경과 배경으로 분리하여 배경을 대체하는 방법 및 장치, 그리고 상기 방법을 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록 매체가 개시된다. 본 발명에 따른 영상을 전경과 배경으로 분리하는 방법은, 입력되는 현재 프레임의 영상을 배경 모델과 비교하여, 상기 영상을 화소 단위로 전경과 배경으로 분리하는 단계; 상기 영상을 복수 개의 영역들로 분할하고, 상기 분할된 영역들 중 전경 영역인지 배경 영역인지 불확실한 영역들을 추출하는 단계; 상기 추출된 영역들을 전경 영역과 배경 영역으로 분류하는 단계; 및 상기 분류된 결과에 따라 상기 추출된 영역들에 속한 화소들의 전경 배경 분리 결과를 보정하는 단계를 포함하는 것을 특징으로 한다. 이러한 본 발명에 의하면, 실시간으로 정확하게 전경과 배경을 분리할 수 있는 효과가 있다.A method and apparatus for separating an image into foreground and background, a method and apparatus for separating an image into foreground and background to replace the background, and a computer-readable recording medium on which a program for executing the method is recorded. A method of separating an image according to the present invention into a foreground and a background includes the steps of: comparing an image of an input current frame with a background model, and separating the image into foreground and background in pixel units; Dividing the image into a plurality of regions and extracting uncertain regions, which are foreground regions or background regions, of the divided regions; Classifying the extracted regions into a foreground region and a background region; And correcting a foreground background separation result of pixels belonging to the extracted regions according to the classified result. According to the present invention, the foreground and background can be accurately separated in real time.
영상 처리, 전경 분리, 배경 대체 Image processing, foreground separation, background substitution
Description
본 발명은 영상 처리에 관한 것으로, 보다 상세하게는, 영상을 전경과 배경으로 분리하는 방법 및 장치, 영상을 전경과 배경으로 분리하여 배경을 대체하는 방법 및 장치, 그리고 상기 방법을 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록 매체에 관한 것이다. The present invention relates to image processing, and more particularly, to a method and apparatus for separating an image into foreground and background, a method and apparatus for separating a foreground and background into separate images, and a program The present invention relates to a computer-readable recording medium having recorded thereon a computer program.
영상을 전경과 배경으로 분리하는 기술은 비디오 감시, 인간 계수(human counting), 비디오 편집 등을 포함한 다양한 시각 시스템에서 사용된다. 특히 근래에 인터넷 망의 발달과 웹카메라의 등장으로 음성과 영상을 함께 이용한 화상대화가 상용화되고 있는데, 이러한 화상대화에서는 본인이 원하지 않은 많은 부분이 카메라로 노출될 가능성이 있다. 따라서 통신의 주체가 되는 사람과 배경을 분리하여 노출을 원하지 않는 배경을 새로운 배경으로 대체하여 전송함으로써 개인의 사생활을 보호하는 방안이 강구되고 있다. 이러한 배경 대체 기술에 있어서도 영상을 전 경에 해당하는 사람과 배경으로 분리하는 것이 선행되어야 한다. Techniques for separating images into foreground and background are used in various visual systems including video surveillance, human counting, and video editing. Particularly in recent years, the development of the Internet network and the appearance of web cameras have brought about the commercialization of videoconferencing using voice and video. In such videoconferencing, there is a possibility that a large part of the user is not exposed to the camera. Therefore, there is a way to protect the personal privacy of a person by separating the person who is the subject of communication from the background and substituting a background that does not want to be exposed with a new background. In such a background substitution technique, it is necessary to separate the image into the background and the person corresponding to the background.
종래의 영상 분리 기술로 배경 차분을 통한 움직이는 객체를 분리하는 방법이 있다. 배경 차분은 현재 이미지를, 일정 기간 동안 정적인 배경으로부터 얻어지는 참조 영상으로부터 동일한 부분을 차분하는 방법이다. 이러한 제거 과정을 거치면, 화면 상에는 단지 움직이는 물체 또는 새로운 물체만이 남게 된다. 실시간 처리는 가능하나 조명변화에 민감하다는 단점이 있으며 배경과 유사한 색상의 옷을 입은 사람이 등장하게 되면 영상 분리가 정확하지 않다는 문제점을 가지고 있다. There is a method of separating a moving object through a background difference with a conventional image separation technique. The background difference is a method of subtracting the current image from the reference image obtained from a static background for a certain period of time. After this removal process, only moving objects or new objects remain on the screen. Real-time processing is possible, but there is a disadvantage that it is sensitive to illumination change, and when a person dressed in a color similar to the background appears, image separation is inaccurate.
모델 기반의 영상 분리 기술은 사람의 대략적인 위치를 추정하기 위해 칼라정보 이용하여 얼굴영역을 검출한 뒤, 사람의 상반신만 나타난다는 것을 가정하여 사람의 머리와 몸통 모델을 이용하여 영상을 분리해 내는 기술이다. 모델을 이용하는 방법이기 때문에 사람의 상반신이 아닌 전신이 나타나거나 사람이 손을 드는 등의 다양한 자세를 취하였을 때는 영상 분리가 불가능하다는 단점이 있다.The model-based image segmentation technique detects the face region using color information to estimate the approximate position of a person and then separates the image using the human head and body model assuming that only the upper half of the person appears Technology. This method is disadvantageous in that it is impossible to separate images when a variety of attitudes are taken such as the whole body is displayed instead of the upper body of a person, or a person takes a hand.
모션 기반의 영상 분리 기술은 입력영상에서 광류(Optical Flow) 등과 같은 모션 정보를 추출하여 알고리즘을 이용하여 이전 프레임과 현재프레임의 움직임을 추출한다. 추출된 움직임 정보는 배경과 움직이는 사람이 다르게 나타나기 때문에 움직이는 사람의 모션만을 추출하여 영상 분리를 하는 방법이다. 이 기술에 의하면, 사람이 움직이지 않으면 모션 정보가 나타나지 않기 때문에 움직이는 사람만 분리가 가능하며 또한 이전 프레임과 현재프레임의 조명 변화가 존재하지 않는다는 가정을 해야만 모션 정보를 정확히 추출해 낼 수 있기 때문에 약한 조명변화에도 민감하다는 단점이 있다. Motion - based image segmentation technique extracts motion information such as optical flow from input image and extracts motion of previous frame and current frame using algorithm. The extracted motion information is a method of extracting only the motion of the moving person and separating the image because the background and the moving person appear differently. According to this technique, since the motion information is not displayed if the person does not move, only the moving person can be separated. Furthermore, since the motion information can be accurately extracted only assuming that there is no illumination change between the previous frame and the current frame, It is also sensitive to changes.
또한, 스테레오 카메라를 이용하여 카메라로부터 물체까지의 거리를 측정하여 물체와 배경을 구별하는 방법이 있는데, 이 방법은 스테레오 카메라, 즉 두 대의 카메라가 필요하기 때문에, 장치의 크기가 커지고, 휴대성이 현저히 떨어지며 비용 면에서도 불리한 단점이 있다.In addition, there is a method of distinguishing the object from the background by measuring the distance from the camera to the object using a stereo camera. Since this method requires a stereo camera, i.e., two cameras, the size of the device increases, It has a disadvantage in that it is significantly disadvantageous in terms of cost.
본 발명이 이루고자 하는 기술적 과제는 단일 카메라를 이용하여 실시간으로 영상을 전경과 배경으로 정확하게 분리할 수 있는, 영상을 전경과 배경으로 분리하는 방법 및 장치, 그리고 상기 방법을 실행시키기 위한 컴퓨터로 읽을 수 있는 기록 매체를 제공하는 데 있다. SUMMARY OF THE INVENTION The present invention is directed to a method and apparatus for separating an image into a foreground and a background, which can accurately separate an image in foreground and background in real time using a single camera, and a computer- And a recording medium.
본 발명이 이루고자 하는 다른 기술적 과제는 단일 카메라를 이용하여 실시간으로 영상을 전경과 배경으로 정확하게 분리하고, 영상의 배경을 다른 배경으로 대체할 수 있는, 영상을 전경과 배경으로 분리하여 배경을 대체하는 방법 및 장치, 그리고 상기 방법을 실행시키기 위한 컴퓨터로 읽을 수 있는 기록매체를 제공하는 데 있다. Another object of the present invention is to provide an image processing apparatus and method which can separate a foreground and a background accurately by using a single camera in real time and replace the background of the image with another background, A method and an apparatus, and a computer-readable recording medium for executing the method.
상기 기술적 과제를 해결하기 위하여 본 발명에 따른, 영상을 전경과 배경으로 분리하는 방법은, (a) 입력되는 현재 프레임의 영상을 배경 모델과 비교하여, 상기 영상을 화소 단위로 전경과 배경으로 분리하는 단계; (b) 상기 영상을 복수 개의 영역들로 분할하고, 상기 분할된 영역들 중 전경 영역인지 배경 영역인지 불 확실한 영역들을 추출하는 단계; (c) 상기 추출된 영역들을 전경 영역과 배경 영역으로 분류하는 단계; 및 (d) 상기 (c) 단계에서 분류된 결과에 따라 상기 추출된 영역들에 속한 화소들의 전경 배경 분리 결과를 보정하는 단계를 포함하는 것을 특징으로 한다.According to an aspect of the present invention, there is provided a method for separating an image into foreground and background, comprising the steps of: (a) comparing an image of an input current frame with a background model; ; (b) dividing the image into a plurality of regions, and extracting uncertain regions, which are foreground regions or background regions, of the divided regions; (c) classifying the extracted regions into a foreground region and a background region; And (d) correcting a foreground background separation result of pixels belonging to the extracted regions according to a result classified in the step (c).
여기서 상기 방법은, 상기 배경 모델을 생성하는 단계를 더 포함하고, 상기 배경 모델은 전경에 해당하는 물체 또는 사람이 등장하기 이전 프레임까지의 매 프레임마다 학습된 모델을 따를 수 있다.The method may further include generating the background model, wherein the background model may follow a learned model for every frame up to an object in foreground or a frame before a person appears.
또한, 상기 (a) 단계에서, 화소 단위로 상기 영상과 상기 배경 영상의 유사도를 계산하고, 상기 계산된 유사도를 소정 제1 임계값과 비교함으로써 상기 영상을 전경과 배경으로 분리할 수 있다.In the step (a), the similarity between the image and the background image may be calculated on a pixel-by-pixel basis, and the calculated similarity may be compared with a predetermined first threshold value to divide the image into foreground and background.
또한, 상기 (b) 단계에서, 상기 분할된 영역들 각각에 대하여, 상기 (a) 단계에서 화소 단위로 전경과 배경으로 분리된 결과를 이용하여 전경 영역인지 배경 영역인지 불확실할 확률을 계산하고, 상기 계산된 확률을 소정 제2 임계값과 비교함으로써 상기 불확실할 영역들을 추출할 수 있다.In the step (b), for each of the divided regions, a probability of uncertainty of whether the foreground region or the background region is uncertain is calculated using the results separated in foreground and background in pixel units in the step (a) The uncertainty regions may be extracted by comparing the calculated probability with a predetermined second threshold value.
또한, 상기 (c) 단계는, (c1) 상기 추출된 영역들 각각에 대하여, 전경 영역일 확률을 계산하는 단계; 및 (c2) 상기 계산된 확률을 소정 제3 임계값과 비교함으로써 상기 추출된 영역들을 전경 영역과 배경 영역으로 분류하는 단계를 포함할 수 있다.The step (c) includes the steps of: (c1) calculating a probability of a foreground region for each of the extracted regions; And (c2) classifying the extracted regions into a foreground region and a background region by comparing the calculated probability with a predetermined third threshold value.
또한, 상기 (a) 단계에서, 화소 단위로 상기 영상과 상기 배경 영상의 유사도를 계산하고, 상기 계산된 유사도를 소정 제1 임계값과 비교함으로써 상기 영상 을 전경과 배경으로 분리하며, 상기 (c1) 단계에서, 상기 계산된 유사도를 이용하여 상기 전경 영역일 확률을 계산할 수 있다.In the step (a), the degree of similarity between the image and the background image is calculated on a pixel-by-pixel basis, and the calculated degree of similarity is compared with a predetermined first threshold value to divide the image into foreground and background, ), It is possible to calculate the probability of the foreground region using the calculated similarity.
또한, 상기 전경 영역일 확률은 다음 수학식에 따라 구해질 수 있다.In addition, the probability of the foreground region can be obtained according to the following equation.
여기서, P Fg (R i )는 불확실 영역 R i 의 전경 영역일 확률을, N Fg (R i )는 불확실 영역 R i 에서의 전경 화소의 개수를, N Bg (R i )는 불확실 영역 R i 에서의 배경 화소의 개수를 의미한다. Here, P Fg (R i) is the probability of the foreground area of the uncertainty region R i, N Fg (R i) is the number of foreground pixels in the uncertain region R i, N Bg (R i) is uncertain region R i The number of background pixels in the background image.
또한, 상기 방법은, 소정의 과거 프레임으로부터 상기 현재 프레임까지 상기 (a) 단계에서 화소 단위로 전경과 배경으로 분리된 결과 영상을 누적하여 전경 확률 모델을 생성하는 단계를 더 포함하고, 상기 (c1) 단계에서, 상기 생성된 전경 확률 모델을 이용하여 상기 전경 영역일 확률을 계산할 수 있다.The method further includes the step of generating a foreground probability model by accumulating the foreground and background separated images in the foreground and background in a pixel unit in the step (a) from a predetermined past frame to the current frame, ), It is possible to calculate the probability of the foreground region using the generated foreground probability model.
또한, 상기 전경 확률 모델은, 다음 수학식에 따라 표현될 수 있다.Also, the foreground probability model can be expressed according to the following equation.
여기서, 는 프레임 t의 영상에서 화소 p가 전경 화소일 확률을, 는 프레임 t-1의 영상에서 화소 p가 전경 화소일 확률을, 는 프레임 t의 영상에서 화소 p의 전경 분리 결과값을 의미하며, 는 소정 값이다.here, Shows the probability that the pixel p is the foreground pixel in the image of the frame t, The probability that the pixel p is the foreground pixel in the image of the frame t-1, Denotes the foreground separation result of the pixel p in the image of the frame t, Is a predetermined value.
또한, 상기 전경 영역일 확률은 다음 수학식에 따라 구해질 수 있다.In addition, the probability of the foreground region can be obtained according to the following equation.
여기서, P Fg t (R i )는 현재 프레임인 t번째 프레임에서 불확실 영역 R i 의 전경 영역일 확률을, P Fg t-1 (R i )은 이전 프레임인 t-1번째 프레임에서의 불확실 영역 R i 의 전경 영역일 확률을, N Fg (R i ) 및 N Bg (R i )는 t번째 프레임에서 불확실 영역 R i 의 전경 화소의 개수 및 배경 화소의 개수를 나타낸다. Here, P Fg t (R i) is the probability of the foreground area of the uncertainty region R i in a t-th frame is the current frame, P Fg t-1 (R i) is the previous frame is a t-1 uncertainty region of the second frame the probability of the foreground region of the R i, N Fg (R i) and Bg N (R i) is the number of the number of foreground pixels and background pixels in the uncertain region R i in the t-th frame.
상기 기술적 과제를 해결하기 위하여 상기된 본 발명에 따른 영상을 전경과 배경으로 분리하는 방법을 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록 매체를 제공한다.According to an aspect of the present invention, there is provided a computer-readable recording medium having recorded thereon a program for executing a method of dividing an image into foreground and background according to the present invention.
상기 기술적 과제를 해결하기 위하여 본 발명에 따른, 영상을 전경과 배경으로 분리하는 장치는, 입력되는 현재 프레임의 영상을 배경 모델과 비교하여, 상기 영상을 화소 단위로 전경과 배경으로 분리하는 화소 단위 분리부; 상기 영상을 복수 개의 영역들로 분할하고, 상기 분할된 영역들 중 전경 영역인지 배경 영역인지 불확실한 영역들을 추출하는 불확실 영역 추출부; 상기 추출된 영역들을 전경 영역과 배경 영역으로 분류하는 영역 단위 분류부; 및 상기 영역 단위 분류부에서 분류된 결과에 따라 상기 추출된 영역들에 속한 화소들의 전경 배경 분리 결과를 보정하는 보정부를 포함하는 것을 특징으로 한다.According to an aspect of the present invention, there is provided an apparatus for separating an image into a foreground and a background, the apparatus comprising: an input unit that compares an image of an input current frame with a background model, Separator; An uncertainty region extraction unit for dividing the image into a plurality of regions and extracting uncertain regions, which are foreground regions or background regions, of the divided regions; A region unit classification unit for classifying the extracted regions into a foreground region and a background region; And a correction unit correcting a foreground background separation result of pixels belonging to the extracted regions according to a result classified by the region unit classifier.
상기 다른 기술적 과제를 해결하기 위하여 본 발명에 따른, 영상을 전경과 배경으로 분리하여 배경을 대체하는 방법은, (a) 입력되는 영상을 배경 모델과 비교하여, 상기 영상을 화소 단위로 전경과 배경으로 분리하는 단계; (b) 상기 영상을 복수 개의 영역들로 분할하고, 상기 분할된 영역들 중 전경 영역인지 배경 영역인지 불확실한 영역들을 추출하는 단계; (c) 상기 추출된 영역들을 전경 영역과 배경 영역으로 분류하는 단계; (d) 상기 (c) 단계에서 분류된 결과에 따라 상기 추출된 영역들에 속한 화소들의 전경 배경 분리 결과를 보정하여, 전경 영상을 출력하는 단계; 및 (e) 상기 전경 영상에 미리 마련된 배경 영상을 합성하는 단계를 포함하는 것을 특징으로 한다.According to another aspect of the present invention, there is provided a method of separating a foreground and a background into foreground and background, comprising the steps of: (a) comparing an input image with a background model, ; (b) dividing the image into a plurality of regions and extracting uncertain regions, whether the region is a foreground region or a background region, among the divided regions; (c) classifying the extracted regions into a foreground region and a background region; (d) correcting foreground background separation results of pixels belonging to the extracted regions according to a result classified in step (c), and outputting a foreground image; And (e) synthesizing a background image prepared in advance in the foreground image.
여기서, 상기 (e) 단계는, 상기 전경 영상과 상기 배경 영상의 각 컬러채널 값에 따라 상기 배경 영상의 색상을 보정하는 단계를 포함할 수 있다.The step (e) may include correcting the hue of the background image according to each color channel value of the foreground image and the background image.
또한, 상기 (e) 단계는, 상기 전경 영상의 색상 정보를 분석하고, 특정 컬러채널에 편중되어 있는지 여부에 따라서 선택적으로, 상기 전경 영상과 배경 영상의 각 컬러채널 값에 따라 상기 배경 영상의 색상을 보정하거나, 상기 배경 영상의 밝기를 보정하는 단계를 포함할 수 있다.The step (e) may further include analyzing the color information of the foreground image and selectively extracting the color of the background image according to each color channel value of the foreground image and the background image, Or correcting the brightness of the background image.
상기 다른 기술적 과제를 해결하기 위하여 상기된 본 발명에 따른 영상을 전경과 배경으로 분리하여 배경을 대체하는 방법을 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록 매체를 제공한다.According to another aspect of the present invention, there is provided a computer-readable recording medium having recorded thereon a program for executing a method of replacing a background by dividing an image according to the present invention into foreground and background.
상기 다른 기술적 과제를 해결하기 위하여 본 발명에 따른 영상을 전경과 배경으로 분리하여 배경을 대체하는 장치는, 입력되는 영상을 배경 모델과 비교하여, 상기 영상을 화소 단위로 전경과 배경으로 분리하는 화소 단위 분리부; 상기 영상을 복수 개의 영역들로 분할하고, 상기 분할된 영역들 중 전경 영역인지 배경 영역인지 불확실한 영역들을 추출하는 불확실 영역 추출부; 상기 추출된 영역들을 전경 영역과 배경 영역으로 분류하는 영역 단위 분류부; 상기 영역 단위 분류부에서 분류된 결과에 따라 상기 추출된 영역들에 속한 화소들의 전경 배경 분리 결과를 보정하여, 전경 영상을 출력하는 보정부; 및 상기 전경 영상에 미리 마련된 배경 영상을 합성하는 배경 영상 합성부를 포함하는 것을 특징으로 한다.According to another aspect of the present invention, there is provided an apparatus for separating an image into foreground and background and comparing the input image with a background model, A unit separation unit; An uncertainty region extraction unit for dividing the image into a plurality of regions and extracting uncertain regions, which are foreground regions or background regions, of the divided regions; A region unit classification unit for classifying the extracted regions into a foreground region and a background region; A correction unit correcting a foreground background separation result of pixels belonging to the extracted regions according to a result classified by the region unit classifier and outputting a foreground image; And a background image synthesizing unit synthesizing a background image prepared in advance in the foreground image.
상술한 본 발명에 의하면, 영상을 복수 개의 영역들로 분할하고, 분할된 영역들 중 불확실한 영역들을 전경과 배경으로 분류하여 보정함으로써, 조명의 변화나 전경과 배경에 유사한 색상이 존재하더라도 실시간으로 정확하게 전경과 배경을 분리할 수 있다. 또한, 전경과 배경으로 분리된 결과 영상을 누적하여 생성된 전경 확률 모델을 이용함으로써 더 정확하게 전경과 배경을 분리할 수 있다.According to the present invention, an image is divided into a plurality of areas, and uncertain areas of the divided areas are classified and corrected by foreground and background, so that even if there is a similar color in a change of illumination or foreground and background, You can separate foreground and background. In addition, the foreground and background can be separated more precisely by using the foreground probability model generated by accumulating the result images separated into foreground and background.
이하에서는 도면을 참조하여 본 발명의 바람직한 실시예들을 상세히 설명한다. 이하 설명 및 첨부된 도면들에서 실질적으로 동일한 구성요소들은 각각 동일한 부호들로 나타냄으로써 중복 설명을 생략하기로 한다. 또한 본 발명을 설명함에 있어 관련된 공지기능 혹은 구성에 대한 구체적인 설명이 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우 그에 대한 상세한 설명은 생략하기로 한다.Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the drawings. In the following description and the accompanying drawings, substantially the same components are denoted by the same reference numerals, and redundant description will be omitted. In the following description of the present invention, a detailed description of known functions and configurations incorporated herein will be omitted when it may make the subject matter of the present invention rather unclear.
도 1은 본 발명의 일 실시예에 따른, 영상을 전경과 배경으로 분리하는 장치의 블록도이다. 본 실시예에 따른 전경 배경 분리 장치(10)는, 배경 모델 생성부(100), 화소 단위 분리부(110), 불확실 영역 추출부(120), 영역 단위 분류부(130), 보정부(140)를 포함하여 이루어진다. 전경 배경 분리 장치(10)에는 카메라(미도시)로부터 획득된 프레임 단위의 영상이 입력된다. 1 is a block diagram of an apparatus for separating an image into foreground and background, according to an embodiment of the present invention. The foreground
배경 모델 생성부(100)는, 후술할 화소 단위 분리부(110)가 입력되는 영상을 전경과 배경으로 분리하고자 할 때 입력되는 영상과 비교 대상이 되는 배경 모델을 생성한다. 이때 배경 모델 생성부(100)는, 전경에 해당하는 물체 또는 사람이 영상에 등장하기 이전 프레임까지의 매 프레임마다 모델을 학습하고, 이렇게 학습된 모델을 배경 모델로서 생성하여 저장한다. 도시되지는 않았으나, 본 실시예에 따른 전경 배경 분리 장치(10)에는 상기 배경 모델을 저장하기 위한 저장 수단(미도시)이 포함될 수 있다.The background
이하에서는, 본 발명의 일 실시예에 따른 배경 모델에 관하여 보다 상세히 설명하기로 한다. 본 실시예에 따른 배경 모델에 의하면, 입력 영상 내의 임의의 화소 p는 다음과 같은 4개의 요소, 로 모델링된다. 여기서, 는 화소 p에서의 컬러 기댓값을, 는 컬러값의 표준편차를, 는 밝기 왜곡의 변화(variation of brightness distortion), 는 색도 왜곡의 변화(variation of chromaticity distortion)를 의미한다. 밝기 왜곡의 변화와, 색도 왜곡의 변화에 관하여는 논문 [T. Horprasert, D. Harwood, L.S. Davis "A Statistical Approach for Real-time Robust Background Subtraction and Shadow Detection", IEEE Frame Rate Workshop, pp. 1-19, 1999.]에 개시되어 있으므로, 상세한 설명은 생략하기로 한다.Hereinafter, a background model according to an embodiment of the present invention will be described in more detail. According to the background model of the present embodiment, an arbitrary pixel p in the input image has the following four elements: Lt; / RTI > here, The color expected value at pixel p , The standard deviation of the color values, A variation of brightness distortion, Means a variation of chromaticity distortion. Regarding the change of the brightness distortion and the change of the chromaticity distortion, the paper [T. Horprasert, D. Harwood, LS Davis, "A Statistical Approach for Real-time Robust Background Subtraction and Shadow Detection", IEEE Frame Rate Workshop, pp. 1-19, 1999.], detailed description thereof will be omitted.
본 실시예에 의하면, 배경 모델 생성부(100)는 영상 내에 물체 또는 사람이 등장하기 전까지 매 프레임마다 을 계산한다. t번째 프레임에서 계산되는 를 라 표현하면, 예를 들어 N번째 프레임에서 사람이 등장했다면, N-1 번째 프레임까지 계산된 가 배경 모델로서 생성된다. According to the present embodiment, the background
t번째 프레임에 대하여, 화소 p에서의 컬러 기댓값의 벡터 와 표준편차의 벡터 는 다음 수학식과 같이, r, g, b 컬러값 각각에 대한 평균 및 표준편차의 성분을 가진다.For the t-th frame, the vector of the color expectation value at pixel p And the standard deviation vector Has the components of mean and standard deviation for each of the r, g, b color values, as shown in the following equation.
본 실시예에 의하면, 매 프레임마다 배경 모델을 학습하는 바, t번째 프레임의 영상 내 화소 p에서의 컬러값 i에 대한 평균 및 표준편차 는 다음 수학식에 따라 이전 프레임인 t-1 번째 프레임의 평균 및 표준편차 를 이용하여 구해질 수 있다.According to the present embodiment, the background model is learned every frame, and the average value of the color values i in the in-video pixel p of the t- And standard deviation The average of the (t-1) -th frame, which is the previous frame, according to the following equation And standard deviation . ≪ / RTI >
여기서, 아래첨자 i는 r, g, b 중 어느 하나를, 는 화소 p에서의 컬러 i의 컬러값을 의미한다. Here, the subscript i denotes any one of r, g, and b, Means the color value of the color i in the pixel p .
또한, t번째 프레임의 영상 내 화소 p에서의 밝기 왜곡 와 색도 왜곡 는 다음 수학식에 따라 구해질 수 있다.Further, the brightness distortion in the in-video pixel p of the t-th frame And chromaticity distortion Can be obtained according to the following equation.
이때, t번째 프레임의 영상 내 화소 p에서의 밝기 왜곡의 변화도 와 색도 왜곡의 변화도 는 다음 수학식에 따라 이전 프레임인 t-1번째 프레임의 밝기 왜곡 의 변화 과 색도 왜곡의 변화 를 이용하여 구해질 수 있다. At this time, the change in brightness distortion in the in-video pixel p of the t- And chromaticity distortion Of the brightness distortion of the (t-1) -th frame, which is the previous frame, according to the following equation And chromaticity distortion . ≪ / RTI >
배경 모델 생성부(100)에서, 전경에 해당하는 물체 또는 사람이 등장하는 프레임 이전의 프레임까지 상술한 바와 같이 학습된 배경 모델은 저장 수단(미도시)에 저장된다.In the background
배경 모델 생성부(100)에 의해 배경 모델이 생성되면, 화소 단위 분리부(110)는 입력되는 프레임의 영상을 배경 모델 생성부(100)에서 생성된 배경 모델과 비교하여, 상기 영상을 화소 단위로 전경과 배경으로 분리한다. 여기서, 입력되는 프레임은 전경에 해당하는 물체 또는 사람이 등장한 프레임 및 그 이후의 프레임들 각각을 의미하며, 화소 단위 분리부(110)는 이들 각 프레임마다의 영상을 배경 모델과 비교하여 화소 단위로 전경과 배경으로 분리한다. 화소 단위로 전경과 배경으로 분리한다는 것은, 다시 말하면 하나의 영상 내의 화소들 각각이 전경에 해당하는지 배경에 해당하는지를 구분하는 것이다. When the background model is generated by the background
화소 단위 분리부(110)는 입력되는 영상을 배경 모델과 비교하기 위하여 영상에 속하는 각 화소마다, 입력되는 영상과 배경 모델의 유사도를 계산한다. 그리고 이 유사도에 따라서 각 화소를 전경 화소 또는 배경 화소 중 어느 하나로 분류하는데, 예를 들어 유사도가 높으면 배경 화소로, 유사도가 낮으면 전경 화소로 분 류한다. In order to compare the input image with the background model, the pixel-
영상 내의 임의의 화소 p에 대한 유사도 l(p)는 밝기 왜곡 분포와 색도 왜곡 분포를 이용하여 다음 수학식에 따라 구해질 수 있다. The similarity l (p) for an arbitrary pixel p in an image can be obtained according to the following equation using a brightness distortion distribution and a chromaticity distortion distribution.
여기서, 는 화소 p에 대한 밝기 왜곡 분포를, 는 화소 p에 대한 색도 왜곡 분포를 의미하며, 는 실제적으로 색도 유사도가 밝기 유사도보다 상대적으로 적음을 반영하기 위한 값으로서, 1 이상의 소정 값이다. here, Represents the brightness distortion distribution for the pixel p , Represents the chromaticity distortion distribution for the pixel p , Is a value for reflecting the fact that the chromaticity similarity is relatively smaller than the brightness similarity, and is a predetermined value or more.
상기 밝기 왜곡 분포 와 색도 왜곡 분포 는 다음 수학식에 따라 구해질 수 있다. The brightness distortion distribution And chromaticity distortion distribution Can be obtained according to the following equation.
그리고, 화소 단위 분리부(110)는 상기 유사도를 소정 임계값 과 비교하고, 비교 결과에 따라 전경 화소 또는 배경 화소로 분류한다. 이는 다음 수학식과 같이 표현될 수 있다.Then, the pixel-
여기서, 는 임의의 화소 p가 전경 화소 또는 배경 화소로 분리된 결과를 나타내고, 1은 전경 화소로 분류되었음을, 0은 배경 화소로 분류되었음을 의미한다. here, Indicates that a pixel p is divided into a foreground pixel or a background pixel, 1 represents a foreground pixel, and 0 represents a background pixel.
도 2는 상술한 실시예에 따라서 입력 영상이 전경과 배경으로 분리된 결과를 보여준다. 도 2에서, (a)는 상술한 실시예에 따라 생성된 배경 모델에 따른 영상을 나타내고, (b)는 입력된 영상을 나타내며, (c)는 화소 단위로 전경과 배경이 분리된 결과 영상을 나타낸다. (c)에서 흰색으로 표시된 부분이 전경 화소를, 검정색으로 표시된 부분이 배경 화소를 나타낸다.FIG. 2 shows a result obtained by dividing an input image into foreground and background in accordance with the above-described embodiment. In FIG. 2, (a) represents an image according to the background model generated according to the above-described embodiment, (b) represents an input image, and (c) . In (c), white indicates the foreground pixel, and black indicates the background pixel.
불확실 영역 추출부(120)는 입력 영상을 복수 개의 영역들로 분할하고, 분할된 영역들 중에서 전경 영역인지 배경 영역인지 불확실한 영역들을 추출한다. 그리고 영역 단위 분류부(130)는 불확실 영역 추출부(120)에서 추출된 영역들, 즉 불확실 영역들을 전경 영역과 배경 영역으로 분리한다. The uncertainty
도 2의 (c)를 참조하면, 화소 단위 분리부(110)에서 획득된 전경과 배경이 분리된 결과 영상은, 전경임에도 배경으로, 혹은 배경임에도 전경으로 판단된 부분이 상당히 존재함을 알 수 있다. 이러한 결과는 조명 또는 자연광의 영향으로 전경과 배경의 색이 변하거나, 전경과 배경의 색이 유사한 경우에 더 두드러지게 나타나게 된다. 따라서 불확실 영역 추출부(120)와 영역 단위 분류부(130)가 전경인지 배경인지 불확실한 영역들에 대하여 다시 판단을 하고, 이 결과에 따라 후술하는 보정부(140)가 화소 단위 분리부(110)에서 획득된 전경과 배경이 분리된 결과 영상을 보정한다.Referring to FIG. 2 (c), it can be seen that the result image in which the foreground and the background obtained in the pixel-
불확실 영역 추출부(120)는 먼저 입력 영상을 복수 개의 영역들로 분할하는데, 이때 예를 들어, Mean-Shift 알고리즘을 사용할 수 있다. Mean-Shift 알고리즘이란, 특정 데이터의 근방에 존재하는 주변 데이터들의 평균 쪽으로 중심을 이동시키면서 유사한 데이터를 군집화하는 알고리즘이다. The uncertainty
그리고, 불확실 영역 추출부(120)는, 분할된 영역들 중에서 전경 영역인지 배경 영역인지 불확실한 영역(이하, 불확실 영역)들을 추출하는데, 이때 화소 단위 분리부(110)에서 각 화소가 전경 또는 배경으로 분리된 결과를 이용한다. 구체적으로 설명하면, 불확실 영역 추출부(120)는 분할된 영역들 각각에 대하여, 해당 영역에 속하는 화소들 각각의 전경 배경 분리 결과를 이용하여 전경 영역인지 배경 영역인지 불확실할 확률(이하, 불확실 확률)을 계산하고, 상기 불확실 확률이 높으면 해당 영역을 불확실 영역으로 분류한다. The uncertainty
여기서, 임의의 영역 R i 에 대한 불확실 확률 P U (R i )는 다음 수학식에 따라 구해질 수 있다. Here, the uncertainty probability P U (R i ) for an arbitrary region R i can be obtained according to the following equation.
여기서, n은 분할된 영역의 개수를, 는 분할된 영역들의 집 합을, N Fg ( R i )는 영역 R i 에서의 전경 화소의 개수를, N Bg ( R i )는 영역 R i 에서의 배경 화소의 개수를 의미한다. Here, n denotes the number of divided areas, N Fg ( R i ) is the number of foreground pixels in the region R i , and N Bg ( R i ) is the number of background pixels in the region R i .
불확실 영역 추출부(120)는 불확실 확률 P U (R i )를 소정 임계값 와 비교하고, 비교 결과에 따라 불확실 영역인지 여부를 결정한다. 이는 다음 수학식과 같이 표현될 수 있다.Uncertainty
여기서 UR은 해당 영역이 불확실 영역임을, NON_UR은 해당 영역이 불확실 영역이 아님을 나타낸다. 상기 수학식에 따르면, 불확실 확률 P U (R i )가 소정 임계값 보다 크면 불확실 영역으로, 그렇지 않으면 불확실 영역이 아닌 것으로 결정한다.Here, UR indicates that the corresponding region is an uncertainty region, and NON_UR indicates that the corresponding region is not an uncertainty region. According to the above equation, when the uncertainty probability P U (R i ) If it is greater than the uncertainty region, it is determined that it is not an uncertainty region.
영역 단위 분류부(130)는 불확실 영역 추출부(120)에서 추출된 불확실 영역들을 전경 영역과 배경 영역으로 분류한다. 이를 위하여, 영역 단위 분류부(130)는 우선 불확실 영역들 각각에 대하여 해당 영역이 전경 영역일 확률을 계산한다. 이 확률은 해당 영역에 속한 화소들의, 화소 단위 분리부(110)에서 계산된 유사도를 이용하여 다음 수학식에 따라 구해질 수 있다.The region
여기서, P Fg (R i )는 불확실 영역 R i 의 전경 영역일 확률을, N Fg (R i )는 불확실 영역 R i 에서의 전경 화소의 개수를, N Bg (R i )는 불확실 영역 R i 에서의 배경 화소의 개수를 의미한다. Here, P Fg (R i) is the probability of the foreground area of the uncertainty region R i, N Fg (R i) is the number of foreground pixels in the uncertain region R i, N Bg (R i) is uncertain region R i The number of background pixels in the background image.
그리고 영역 단위 분류부(130)는 상기 계산된 확률을 소정 임계값 와 비교하고, 비교 결과에 따라 전경 영역인지 배경 영역인지를 결정한다. 이는 다음 수학식과 같이 표현될 수 있다.The region
여기서, 는 불확실 영역 R i 가 전경 영역 또는 배경 영역으로 분류된 결과를 나타내고, 1은 전경 영역으로 분류되었음을, 0은 배경 영역으로 분류되었음을 의미한다. 상기 수학식에 따르면, 전경 영역일 확률 P Fg (R i )가 소정 임계값 보다 크면, 전경 영역으로, 그렇지 않으면 배경 영역으로 분류한다. here, Indicates that the uncertainty region R i is classified into a foreground region or a background region, 1 denotes a foreground region, and 0 denotes a background region. According to the above equation, when the probability P Fg (R i ) of the foreground region is smaller than a predetermined threshold value If it is larger, it is classified as foreground area, otherwise it is classified as background area.
본 실시예에서, 영역 단위 분류부(130)는, 전경 영역일 확률을 계산하고, 이 확률을 소정 임계값과 비교하였으나, 마찬가지의 방식으로 배경 영역일 확률을 계 산하고, 이 확률을 소정 임계값과 비교하는 형태로 구현될 수도 있음은 물론이다. In the present embodiment, the area
보정부(140)는 영상 내의 화소들 중 불확실 영역들에 속한 화소들의 전경 배경 분리 결과를 영역 단위 분류부(130)에서 분류된 결과에 따라 보정한다. 즉, 화소 단위 분리부(110)에서 전경으로 분류된 화소가 영역 단위 분류부(130)에서 분류된 배경 영역에 속한다면 배경 화소로 보정하고, 화소 단위 분리부(110)에서 배경으로 분류된 화소가 영역 단위 분류부(130)에서 분류된 전경 영역에 속한다면 전경 화소로 보정한다. 그리고 보정부(140)는 분리된 배경을 제거함으로써 전경 영상을 출력한다.The
도 3은 상술한 실시예에 따라 입력 영상이 전경과 배경으로 분리되는 과정을 나타낸다. 도 3에서, (a)는 입력 영상을, (b)는 Mean-Shift 알고리즘을 사용하여 복수 개의 영역들로 분할된 영상을 나타낸다. (c)는 화소 단위로 전경과 배경이 분리된 결과 영상으로서, 흰색으로 표시된 부분이 전경 화소를, 검정색으로 표시된 부분이 배경 화소를 나타낸다. (d)에서는 불확실 영역들을 흰색으로 나타내었고, (e)는 불확실 영역들이 전경 영역과 배경 영역으로 분류된 결과로서, 전경 영역은 붉은색으로, 배경 영역은 파란색으로 나타내었다. (f)는 화소 단위로 전경과 배경이 분리된 결과 영상 (c)를 영역 단위로 전경과 배경으로 분류된 결과 (e)에 따라 보정된 영상을 나타낸다. FIG. 3 illustrates a process in which an input image is divided into foreground and background according to the above-described embodiment. In FIG. 3, (a) shows an input image, and (b) shows an image divided into a plurality of regions using a mean-shift algorithm. (c) is a result image in which the foreground and the background are separated in pixel units, and the white portion represents the foreground pixel and the black portion represents the background pixel. (d) shows the uncertainty areas in white, and (e) shows the uncertainty areas as the foreground and background regions, with the foreground region as red and the background region as blue. (f) shows the image obtained by dividing the foreground and the background in pixel units and the image (c) corrected according to the result (e) classified into the foreground and background in the area unit.
도 3의 (c)와 (f)를 참고하면, 전경에 해당하는 사람의 옷 색상이 배경과 유사하여 (c)에서 전경이 전경임에도 배경으로 잘못 판단되는 현상이 두드러지게 나타나는 반면, 보정된 영상 (f)에서는 이러한 문제점이 거의 나타나지 않음을 알 수 있다. Referring to FIGS. 3 (c) and 3 (f), the color of the clothes of the person corresponding to the foreground is similar to the background, so that in the case of (c) (f) shows that such a problem is hardly observed.
도 4는 본 발명의 다른 실시예에 따른, 영상을 전경과 배경으로 분리하는 장치의 블록도이다. 본 실시예에 따른 전경 배경 분리 장치(20)는, 배경 모델 생성부(100), 화소 단위 분리부(110), 불확실 영역 추출부(120), 영역 단위 분류부(135), 보정부(140), 전경 확률 모델 생성부(145)를 포함하여 이루어진다. 도 1에 도시된 전경 배경 분리 장치와 마찬가지로, 본 실시예에 따른 전경 배경 분리 장치(10)에도 역시 카메라(미도시)로부터 획득된 프레임 단위의 영상이 입력된다. 4 is a block diagram of an apparatus for separating an image into foreground and background, according to another embodiment of the present invention. The foreground
본 실시예에 따른 전경 배경 분리 장치(20)에서, 배경 모델 생성부(100), 화소 단위 분리부(110), 불확실 영역 추출부(120), 보정부(140)의 동작은 도 1에 관하여 설명된 바와 동일하므로, 설명은 생략하기로 한다.In the foreground
먼저, 전경 확률 모델 생성부(145)에 관하여 설명한다. 일반적으로 동영상에서 중요한 특징으로 시간에 따라 영상이 변화하지만 인접한 프레임 간의 영상에서 그 차이는 크지 않은 특징이 있다. 따라서, 이전 프레임에서 전경으로 분류되었던 화소들은 현재 프레임에서도 전경으로 분류된 확률이 높다고 볼 수 있다. 전경 확률 모델 생성부(145)는 이러한 특징을 이용, 과거 프레임의 정보를 반영하여 현재 프레임의 영상의 화소들이 전경 화소일 확률을 나타내는 전경 확률 모델을 생성한다. 이를 위하여, 전경 확률 모델 생성(145)는 화소 단위 분리부(110)에서 화소 단위로 전경과 배경으로 분리된 결과 영상을 누적하여 전경 확률 모델을 생성한다. 이러한 전경 확률 모델을 편의상, 시간적 전경 확률 모델(Temporal Foreground Probability Model, TFPM)이라 명명하기로 한다. 시간적 전경 확률 모델은 다음 수 학식과 같이, 이전 프레임의 전경 확률과 현재 프레임의 전경 분리 결과값의 가중치 합으로 표현될 수 있다.First, the foreground probability
여기서, 는 현재 프레임인 t번째 프레임의 영상에서 화소 p가 전경 화소일 확률을, 는, t-1번째 프레임의 영상에서 화소 p가 전경 화소일 확률을, 는 t번째 프레임의 영상에 대한 화소 단위 분리부(110)에서 화소 p의 전경 분리 결과값을 의미하며, 0번째 프레임은 영상에 사람이 등장한 프레임이다.here, Represents the probability that the pixel p is the foreground pixel in the image of the t-th frame, which is the current frame, The probability that the pixel p is the foreground pixel in the image of the (t-1) th frame, Denotes the foreground separation result of the pixel p in the pixel
또한, 는 미리 정의되는 소정 값으로서 0에서 1 사이의 값으로 부여되며, 전경 변화의 정도에 따라 그 값을 달리 정의할 수 있다. 예를 들어, 사람의 움직임이 작은 경우에는 바로 이전 프레임의 영상에 가중치를 비교적 높게 주어야 하므로, 를 상대적으로 큰 값으로 정의하고, 사람의 움직임이 큰 경우에는 이전 프레임과 현재 프레임의 차이가 크기 때문에 사람의 움직임이 작은 경우에 비해 이전 프레임의 영상에 가중치를 비교적 낮게 주어야 하므로 를 상대적으로 작은 값으로 정의할 수 있을 것이다. 화상 대화나 화상 회의에서는 사람이 급격하게 움직이는 경우가 적다고 본다면, 본 실시예를 화상 대화나 화상 회의에 적용하고자 할 때 를 상대적으로 큰 값으로 정의할 수 있을 것이다. Also, Is a predefined predetermined value given as a value between 0 and 1, and the value can be defined differently according to the degree of foreground change. For example, if the motion of the person is small, the weight of the image of the immediately preceding frame should be relatively high, If the human motion is large, the difference between the previous frame and the current frame is large. Therefore, the weight of the previous frame should be relatively low compared to the case where the human motion is small Can be defined as a relatively small value. If it is assumed that a person is suddenly moved in an image conversation or a video conference in a small number, if the present embodiment is to be applied to an image conversation or a video conference Can be defined as a relatively large value.
도 5는 이러한 시간적 전경 확률 모델을 나타내는 도면으로서, (a)는 프레임 별 입력 영상을, (b)는 상술한 시간적 전경 확률 모델에 따라 구해진 전경 확률에 따른 영상을 나타낸다. 시간적 전경 확률 모델에서는 전경 분리 결과가 계속적으로 누적되는 바, (b)를 참조하면 계속적으로 전경으로 분리되는 부분은 흰색의 농도가 짙게 나타나는 것을 알 수 있으며, 이러한 부분은 다음 프레임에서도 전경일 확률이 높다고 할 수 있다. FIG. 5 is a diagram showing such a temporal foreground probability model, in which (a) shows an input image for each frame, and (b) shows an image according to the foreground probability obtained according to the above-described temporal foreground probability model. In the temporal foreground probability model, the result of foreground separation is continuously accumulated. Referring to (b), it can be seen that the white background is consistently concentrated in the part separated into the foreground continuously. can do.
상술한 시간적 전경 확률 모델을 이용하면 전경인 사람의 몸에 홀이 발생하는 등의 문제점을 해결할 수 있는 장점이 있다. 사람의 몸에 홀이 생성된 영역이 매우 작다고 하더라도 사람의 몸이나 머리 부분에 홀이 발생하게 되면, 배경을 다른 영상으로 합성하였을 때 영상을 보는 사람의 눈에 확 띄게 된다. 그러나 상술한 시간적 전경 확률 모델에 따르면 과거의 전경 분리 결과를 누적하여 전경일 확률이 구해지므로 홀이 발생하는 문제점을 해결할 수 있다.The use of the temporal foreground probability model described above has the advantage of solving problems such as the occurrence of holes in the foreground human body. Even if the area where the hole is created in the human body is very small, if holes are formed in the human body or the head part, the image becomes noticeable to the viewer when the background is synthesized with another image. However, according to the above-described temporal foreground probability model, the problem of the occurrence of a hole can be solved because the past foreground separation result is accumulated to obtain the probability of a foreground.
영역 단위 분류부(135)는 도 1에 관하여 설명된 영역 단위 분류부(130)와 마찬가지로, 불확실 영역 추출부(120)에서 추출된 불확실 영역들에 대하여 전경 영역일 확률을 계산하고, 이 확률에 따라 불확실 영역들을 전경 영역 또는 배경 영역으로 분류한다. 다만, 본 실시예에서는 전경 확률 모델 생성부(145)에서 생성된 시간적 전경 확률 모델이, 불확실 영역들에 대한 전경 영역일 확률을 계산하는 데 이용된다. 본 실시예에 따르면, 영역 단위 분류부(135)에서 불확실 영역들 각각에 대하여 해당 영역이 전경 영역일 확률은 다음 수학식에 따라 구해질 수 있다.The area
여기서, P Fg t (R i )는 현재 프레임인 t번째 프레임에서 불확실 영역 R i 의 전경 영역일 확률을, P Fg t-1 (R i )은 이전 프레임인 t-1번째 프레임에서의 불확실 영역 R i 의 전경 영역일 확률을, N Fg (R i ) 및 N Bg (R i )는 t번째 프레임에서 불확실 영역 R i 의 전경 화소의 개수 및 배경 화소의 개수를 의미한다. 그리고 는 상기된 수학식 10에 따른 현재 프레임인 t번째 프레임의 영상에서 화소 p가 전경 화소일 확률을 나타낸다. Here, P Fg t (R i) is the probability of the foreground area of the uncertainty region R i in a t-th frame is the current frame, P Fg t-1 (R i) is the previous frame is a t-1 uncertainty region of the second frame the probability of the foreground region of the R i, N Fg (R i) and Bg N (R i) is the number of the number of foreground pixels and background pixels in the uncertain region R i in the t-th frame. And Represents the probability that the pixel p is the foreground pixel in the image of the t-th frame, which is the current frame according to Equation (10).
도 6은 본 발명의 일 실시예에 따른, 영상을 전경과 배경으로 분리하여 배경을 대체하는 장치의 블록도이다. 본 실시예에 따른 배경 대체 장치는, 전경 배경 분리부(30) 및 배경 영상 합성부(40)를 포함하여 이루어진다.FIG. 6 is a block diagram of an apparatus for separating backgrounds into foreground and background images according to an embodiment of the present invention. Referring to FIG. The background substitution apparatus according to the present embodiment includes a foreground
전경 배경 분리부(30)는 입력 영상을 전경과 배경으로 분리하여, 배경이 제거된 전경 영상을 출력한다. 전경 배경 분리부(30)는 도 1에 관하여 설명된 전경 배경 분리 장치(10) 또는 도 4에 관하여 설명된 전경 배경 분리 장치(20)의 구성 및 동작과 동일하므로, 여기서 설명은 생략하기로 한다. The foreground
배경 영상 합성부(40)는 전경 배경 분리부(30)에서 출력된 전경 영상에 미리 마련된 대체될 배경 영상을 합성하여, 입력 영상에서 배경이 대체된 영상을 출력한 다. The background
단순히 분리된 사람 영상에 새로운 배경 영상을 대체하는 경우, 완전히 다른 조건에서 생성된 두 영상이기 때문에 사람 영역을 가위로 오려 새로운 배경에 붙여놓은 듯한 느낌을 줄 수 있다. 즉, 전경 영상과 대체될 새로운 배경 영상은 완전히 서로 다른 조명 조건에서 촬영된 영상이기 때문에 하나의 영상으로 합성할 경우 각 영상의 전체적인 밝기와 색상이 전혀 달라 자연스러운 하나의 영상으로 보이지 않을 수 있다. 이러한 문제점을 해결하기 위해서는 배경 영상을 전경 영상과 같은 조명 조건에서 촬영한 것처럼 보이기 위한 밝기와 색상에 대한 보정 작업이 필요하다. 따라서 본 실시예에서, 배경 영상 합성부(40)는 전경 영상의 색상 정보를 고려하여, 합성된 배경 영상의 색상 또는 밝기를 보정한다.In the case of simply replacing a new background image with a separated human image, since the two images are generated under completely different conditions, it is possible to give the impression that the human region is scissors cut and pasted on a new background. In other words, since the new background image to be replaced with the foreground image is an image photographed under completely different lighting conditions, the overall brightness and color of each image may be completely different from each other, resulting in a single natural image. To solve these problems, it is necessary to correct the brightness and color of the background image to make it appear as if the background image is photographed in the same lighting condition as the foreground image. Therefore, in the present embodiment, the background
먼저, 배경 영상의 색상 보정에 관하여 설명한다. 본 실시예에서, 전경 영상과 배경 영상 간의 색상 차이를 보정하기 위해 대각선 모델(diagonal model)을 이용한 색상 변환(color transform) 방법을 사용한다. 대각선 모델을 이용한 색상 보정은 두 영상 내에 서로 대응되는 화소가 존재하지 않아도 색상 보정이 가능하며 속도가 매우 빠르다는 장점이 있다. First, the color correction of the background image will be described. In this embodiment, a color transform method using a diagonal model is used to correct a color difference between a foreground image and a background image. The color correction using the diagonal model is advantageous in that color correction is possible and speed is very fast even if there are no corresponding pixels in two images.
대체될 배경의 색상 보정은 다음 수학식에서와 같이 대체될 배경과 대각선 모델 M의 곱으로 나타내어질 수 있다. The color correction of the background to be replaced can be represented by the product of the background to be replaced and the diagonal model M as in the following equation.
여기서, α, β, γ는 각각 전경 영상과 대체될 배경 영상의 R, G, B 컬러채널의 평균 명암도(intensity)의 비율을 나타내며, 다음 수학식에 따라 구해진다.Here,?,?, And? Represent the ratio of the average intensity of the R, G, and B color channels of the foreground image and the background image to be replaced, respectively, and are obtained according to the following equations.
여기서, mean ( R F ) 및 mean ( R B )는 각각 전경 영상의 R 컬러채널 값의 평균 및 대체될 배경 영상의 R 컬러채널 값의 평균을 나타낸다. G 컬러채널 및 B 컬러채널에 관하여도 마찬가지이다. Mean ( R F ) and mean ( R B ) represent the average of the R color channel values of the foreground image and the average of the R color channel values of the background image to be replaced, respectively. The same is true for the G color channel and the B color channel.
다만, 배경 영상의 색상을 보정하는 경우, 전경 영상의 색상 분포가 특정 컬러채널에 지나치게 편중되어 있다면, 상술한 바와 같이 전경 영상의 컬러채널 값을 고려하여 배경 영상의 색상을 보정하는 것은 좋지 않은 결과를 초래할 수 있다. 예를 들어, 배경 영역이 특정 컬러채널에 편중되도록 보정될 수 있다. 이러한 경우 배경 영역의 색상을 보정하기보다 밝기만 보정하는 것이 더욱 좋은 결과를 나타낼 수 있다. 따라서 본 실시예에서는, 전경 영상의 색상 정보를 분석하고, 색상이 특정 컬러채널에 지나치게 편중되어 있는지 여부에 따라서 선택적으로, 배경 영상의 색상을 보정하거나, 배경 영상의 밝기를 보정한다.However, in the case of correcting the color of the background image, if the color distribution of the foreground image is excessively concentrated on the specific color channel, correcting the color of the background image in consideration of the color channel value of the foreground image as described above is not preferable ≪ / RTI > For example, the background area may be corrected to be biased to a particular color channel. In this case, correcting only the brightness rather than the color of the background area may give better results. Therefore, in the present embodiment, the color information of the foreground image is analyzed, and the color of the background image is selectively corrected or the brightness of the background image is corrected depending on whether the color is excessively concentrated on the specific color channel.
도 7은 본 발명의 일 실시예에 따라 배경 영상의 색상 또는 밝기를 선택적으로 보정하는 방법을 나타낸 흐름도이다.FIG. 7 is a flowchart illustrating a method of selectively correcting hue or brightness of a background image according to an exemplary embodiment of the present invention. Referring to FIG.
먼저 610단계에서, 전경 영상 및 대체될 배경 영상의 R, G, B 컬러채널 값의 평균을 각각 계산한다.First, in
620단계에서 전경 영상의 색상 분포가 특정 컬러채널에 지나치게 편중되어 있는지 판단한다. 여기서, 특정 컬러채널에 지나치게 편중되어 있는지 여부는 전경 영상의 컬러채널 값의 평균들 중 특정 컬러채널 값의 평균이 소정 임계값보다 큰지 여부에 따라 판단할 수 있다. 또는, 각 컬러채널 값의 평균을 서로 비교하여 그 차이가 소정 임계값보다 큰지 여부에 따라 판단할 수도 있을 것이다. It is determined in
620단계에서 지나치게 편중되어 있는 것으로 판단되었다면, 630단계로 진행하여 배경 영상의 밝기 보정을 수행한다. 배경 영상의 밝기 보정은, 상기된 수학식 12의 대각선 모델 M을 다음 수학식에 따른 대각선 모델, 즉 성분 α, β, γ가 모두 동일한 값을 가지는 대각선 모델로 치환함으로써 나타내어질 수 있다.If it is determined in
상술한 바와 같이 선택적으로 밝기 보정 또는 색상 보정을 함으로써, 배경 영상 합성 시 발생할 수 있는 배경은 어둡고 전경은 밝아서 발생하는 부자연스러운 문제점 또는 배경과 전경의 색 비율이 다른 경우 발생하는 부자연스러운 문제점 등 이 해결됨으로써 보다 자연스러운 배경 합성이 이루어질 수 있다.By selectively performing brightness correction or color correction as described above, it is possible to solve unnatural problems caused by dark background and bright foreground, or unnatural problems caused when background and foreground color ratios are different from each other A more natural background composition can be achieved.
한편, 색과 밝기를 잘 보정하였다고 하더라도 배경과 사람의 경계부분이 부드럽게 처리되지 않으면 사람 영역을 가위로 오려 다른 배경에 붙인 듯한 느낌을 줄 수 있다. 이러한 문제점을 해결하기 위하여, 본 실시예에서 배경 영상 합성부(40)는 전경 영상과 배경 영상의 경계 영역에 블러링 효과를 주어 두 영상의 분리감을 최소화한다. 블러링 효과를 위해 5ㅧ5 마스크를 가지는 가우시안 완곡화 필터를 적용하였으며 가우시안 완곡화 필터의 형식은 다음 수학식에 따라 정의될 수 있다.On the other hand, even if the color and brightness are well corrected, if the boundary between the background and the human is not smoothly processed, it may give the impression that the human area is scissored and attached to another background. In order to solve such a problem, in the present embodiment, the
가우시안 완곡화 필터의 실시간 적용을 위하여 매번 계산하지 않고 미리 계산된 필터를 사용할 수 있으며, 이러한 필터의 형태를 도 8에 도시하였다. 그리고 필터의 적용 범위는, 전경과 배경으로 분할된 영상에서 에지를 구하고, 팽창 연산을 수행하여 블러링 마스크를 생성함으로써 적용 범위를 제한한다.For the real-time application of the Gaussian dithering filter, a pre-computed filter can be used without being calculated every time, and the form of such a filter is shown in FIG. And the application range of the filter is limited by applying the blurring mask by calculating the edge from the image divided into the foreground and the background and performing the dilation operation.
도 9는 블러링 마스크와 가우시안 완곡화 필터가 적용되는 모습을 보여주기위한 도면이다. 도 9에서, (a)는 필터를 사용하지 않은 배경 대체 결과에 따른 영상을, (b)는 필터를 적용하기 위한 블러링 마스크를, (c)는 블러링 마스크를 이용하여 가우시안 완곡화 필터를 적용한 결과에 따른 영상을 나타낸다. 9 is a view for showing a state in which a blurring mask and a Gaussian divergent filter are applied. In FIG. 9, (a) shows an image according to a background substitution result that does not use a filter, (b) shows a blurring mask for applying a filter, and (c) shows a Gaussian dithering filter using a blurring mask. It shows the image according to the applied result.
도 10은 상술한 본 발명의 실시예에 따라 입력 영상의 배경을 새로운 배경으 로 대체한 결과를 나타낸다. 도 9에서 (a-1), (a-2), (a-3)은 입력 영상을, (b-1), (b-2), (b-3)은 입력 영상의 배경을 새로운 배경으로 대체한 결과를 나타낸다. 10 shows a result of replacing the background of the input image with a new background according to the embodiment of the present invention described above. 9, (a-1), (a-2) and (a-3) As shown in Fig.
한편, 상술한 본 발명의 실시예들은 컴퓨터에서 실행될 수 있는 프로그램으로 작성가능하고, 컴퓨터로 읽을 수 있는 기록매체를 이용하여 상기 프로그램을 동작시키는 범용 디지털 컴퓨터에서 구현될 수 있다. 상기 컴퓨터로 읽을 수 있는 기록매체는 마그네틱 저장매체(예를 들면, 롬, 플로피 디스크, 하드 디스크 등), 광학적 판독 매체(예를 들면, 시디롬, 디브이디 등) 및 캐리어 웨이브(예를 들면, 인터넷을 통한 전송)와 같은 저장매체를 포함한다.The above-described embodiments of the present invention can be embodied in a general-purpose digital computer that can be embodied as a program that can be executed by a computer and operates the program using a computer-readable recording medium. The computer readable recording medium may be a magnetic storage medium such as a ROM, a floppy disk, a hard disk, etc., an optical reading medium such as a CD-ROM or a DVD and a carrier wave such as the Internet Lt; / RTI > transmission).
이제까지 본 발명에 대하여 그 바람직한 실시예들을 중심으로 살펴보았다. 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자는 본 발명이 본 발명의 본질적인 특성에서 벗어나지 않는 범위에서 변형된 형태로 구현될 수 있음을 이해할 수 있을 것이다. 그러므로 개시된 실시예들은 한정적인 관점이 아니라 설명적인 관점에서 고려되어야 한다. 본 발명의 범위는 전술한 설명이 아니라 특허청구범위에 나타나 있으며, 그와 동등한 범위 내에 있는 모든 차이점은 본 발명에 포함된 것으로 해석되어야 할 것이다.The present invention has been described with reference to the preferred embodiments. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims. Therefore, the disclosed embodiments should be considered in an illustrative rather than a restrictive sense. The scope of the present invention is defined by the appended claims rather than by the foregoing description, and all differences within the scope of equivalents thereof should be construed as being included in the present invention.
도 1은 본 발명의 일 실시예에 따른 영상을 전경과 배경으로 분리하는 장치의 블록도이다.1 is a block diagram of an apparatus for separating an image into foreground and background according to an embodiment of the present invention.
도 2는 본 발명의 일 실시예에 따라서 입력 영상이 전경과 배경으로 분리된 결과를 보여준다. FIG. 2 shows a result obtained by dividing an input image into a foreground and background according to an embodiment of the present invention.
도 3은 본 발명의 일 실시예에 따라 입력 영상이 전경과 배경으로 분리되는 과정을 나타낸다. FIG. 3 illustrates a process in which an input image is divided into foreground and background according to an embodiment of the present invention.
도 4는 본 발명의 다른 실시예에 따른 영상을 전경과 배경으로 분리하는 장치의 블록도이다. 4 is a block diagram of an apparatus for separating an image into foreground and background according to another embodiment of the present invention.
도 5는 본 발명에 따른 시간적 전경 확률 모델을 나타내는 도면이다.5 is a diagram illustrating a temporal foreground probability model according to the present invention.
도 6은 본 발명의 일 실시예에 따른, 영상을 전경과 배경으로 분리하여 배경을 대체하는 장치의 블록도이다.FIG. 6 is a block diagram of an apparatus for separating backgrounds into foreground and background images according to an embodiment of the present invention. Referring to FIG.
도 7은 본 발명의 일 실시예에 따라 배경 영상의 색상 또는 밝기를 선택적으로 보정하는 방법을 나타낸 흐름도이다.FIG. 7 is a flowchart illustrating a method of selectively correcting hue or brightness of a background image according to an exemplary embodiment of the present invention. Referring to FIG.
도 8은 가우시안 완곡화 필터의 실시간 적용을 위하여 미리 계산된 필터의 형태를 나타낸다.FIG. 8 shows the form of a pre-computed filter for real-time application of the Gaussian convolution filter.
도 9는 블러링 마스크와 가우시안 완곡화 필터가 적용되는 모습을 보여주기위한 도면이다. 9 is a view for showing a state in which a blurring mask and a Gaussian divergent filter are applied.
도 10은 본 발명의 일 실시예에 따라 입력 영상의 배경을 새로운 배경으로 대체한 결과를 나타낸다.10 shows a result of replacing the background of an input image with a new background according to an embodiment of the present invention.
Claims (26)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020080037563A KR101471199B1 (en) | 2008-04-23 | 2008-04-23 | Method and apparatus for separating foreground and background from image, Method and apparatus for substituting separated background |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020080037563A KR101471199B1 (en) | 2008-04-23 | 2008-04-23 | Method and apparatus for separating foreground and background from image, Method and apparatus for substituting separated background |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20090111939A KR20090111939A (en) | 2009-10-28 |
KR101471199B1 true KR101471199B1 (en) | 2014-12-09 |
Family
ID=41553181
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020080037563A KR101471199B1 (en) | 2008-04-23 | 2008-04-23 | Method and apparatus for separating foreground and background from image, Method and apparatus for substituting separated background |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR101471199B1 (en) |
Families Citing this family (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101158728B1 (en) * | 2010-03-31 | 2012-06-22 | 한국과학기술원 | Real-time Foreground Detection Method |
KR101648562B1 (en) * | 2010-04-26 | 2016-08-16 | 한화테크윈 주식회사 | Apparatus for detecting moving object |
WO2012020977A2 (en) * | 2010-08-10 | 2012-02-16 | 삼성전자주식회사 | Image processing device and method |
KR20120069331A (en) | 2010-12-20 | 2012-06-28 | 삼성전자주식회사 | Method of separating front view and background |
CN102707864A (en) * | 2011-03-28 | 2012-10-03 | 日电(中国)有限公司 | Object segmentation method and system based on mixed marks |
KR101297396B1 (en) * | 2011-12-28 | 2013-08-14 | 충북대학교 산학협력단 | Method of shadow removal based on relative similarity |
KR101739025B1 (en) | 2012-03-13 | 2017-05-24 | 한화테크윈 주식회사 | Method for processing image |
KR101624801B1 (en) | 2014-10-15 | 2016-05-26 | 포항공과대학교 산학협력단 | Matting method for extracting object of foreground and apparatus for performing the matting method |
KR101954851B1 (en) * | 2015-02-16 | 2019-03-06 | 삼성전자주식회사 | Metadata-based image processing method and apparatus |
KR101918159B1 (en) * | 2015-05-19 | 2018-11-13 | 에스케이 텔레콤주식회사 | Method and Apparatus for Segmenting Background Motion Region From Image |
WO2020085694A1 (en) * | 2018-10-23 | 2020-04-30 | 삼성전자 주식회사 | Image-capturing device and method for controlling same |
KR102578292B1 (en) * | 2020-12-15 | 2023-09-15 | 한국과학기술연구원 | Object/region detection and classification system with improved computer memory efficiency |
WO2023287250A1 (en) * | 2021-07-16 | 2023-01-19 | Samsung Electronics Co., Ltd. | Brightness adjustment method and apparatus thereof |
US12003859B2 (en) | 2021-07-16 | 2024-06-04 | Samsung Electronics Co., Ltd. | Brightness adjustment method, and apparatus thereof |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20080020595A (en) * | 2005-05-31 | 2008-03-05 | 오브젝트비디오 인코퍼레이티드 | Human detection and tracking for security applications |
-
2008
- 2008-04-23 KR KR1020080037563A patent/KR101471199B1/en active IP Right Grant
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20080020595A (en) * | 2005-05-31 | 2008-03-05 | 오브젝트비디오 인코퍼레이티드 | Human detection and tracking for security applications |
Also Published As
Publication number | Publication date |
---|---|
KR20090111939A (en) | 2009-10-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101471199B1 (en) | Method and apparatus for separating foreground and background from image, Method and apparatus for substituting separated background | |
KR101670282B1 (en) | Video matting based on foreground-background constraint propagation | |
US8594439B2 (en) | Image processing | |
US6912313B2 (en) | Image background replacement method | |
JP4746050B2 (en) | Method and system for processing video data | |
US8773548B2 (en) | Image selection device and image selecting method | |
Hillman et al. | Alpha channel estimation in high resolution images and image sequences | |
US20200258196A1 (en) | Image processing apparatus, image processing method, and storage medium | |
US20100098331A1 (en) | System and method for segmenting foreground and background in a video | |
Karaman et al. | Comparison of static background segmentation methods | |
Cavallaro et al. | Shadow-aware object-based video processing | |
KR102142567B1 (en) | Image composition apparatus using virtual chroma-key background, method and computer program | |
CA3039239C (en) | Conformance of media content to original camera source using optical character recognition | |
Wang et al. | Simultaneous matting and compositing | |
CN111815528A (en) | Bad weather image classification enhancement method based on convolution model and feature fusion | |
JP2011054080A (en) | Image processing apparatus, method and program | |
Kim et al. | Effective character segmentation for license plate recognition under illumination changing environment | |
Gallego et al. | Enhanced bayesian foreground segmentation using brightness and color distortion region-based model for shadow removal | |
Arsic et al. | Improved lip detection algorithm based on region segmentation and edge detection | |
CN113253890A (en) | Video image matting method, system and medium | |
CN111160340A (en) | Moving target detection method and device, storage medium and terminal equipment | |
JP2008129864A (en) | Image processor, image processing method and image processing program | |
Calagari et al. | Data driven 2-D-to-3-D video conversion for soccer | |
Ekin et al. | Spatial detection of TV channel logos as outliers from the content | |
CN113222870A (en) | Image processing method, device and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A201 | Request for examination | ||
E902 | Notification of reason for refusal | ||
E902 | Notification of reason for refusal | ||
E701 | Decision to grant or registration of patent right | ||
GRNT | Written decision to grant |