GoPiGo 小汽車︰朝向目標前進《三》

從一個概念── 背景去除 ──

Background subtraction

Background subtraction, also known as foreground detection, is a technique in the fields of image processing and computer vision wherein an image’s foreground is extracted for further processing (object recognition etc.). Generally an image’s regions of interest are objects (humans, cars, text etc.) in its foreground. After the stage of image preprocessing (which may include image denoising, post processing like morphology etc.) object localisation is required which may make use of this technique.

Background subtraction is a widely used approach for detecting moving objects in videos from static cameras. The rationale in the approach is that of detecting the moving objects from the difference between the current frame and a reference frame, often called “background image”, or “background model”. Background subtraction is mostly done if the image in question is a part of a video stream. Background subtraction provides important cues for numerous applications in computer vision, for example surveillance tracking or human poses estimation.

Background subtraction is generally based on a static background hypothesis which is often not applicable in real environments. With indoor scenes, reflections or animated images on screens lead to background changes. Similarly, due to wind, rain or illumination changes brought by weather, static backgrounds methods have difficulties with outdoor scenes. [1]

Conventional Approaches

A robust background subtraction algorithm should be able to handle lighting changes, repetitive motions from clutter and long-term scene changes.[2] The following analyses make use of the function of V(x,y,t) as a video sequence where t is the time dimension, x and y are the pixel location variables. e.g. V(1,2,3) is the pixel intensity at (1,2) pixel location of the image at t = 3 in the video sequence.

Using frame differencing

A motion detection algorithm begins with the segmentation part where foreground or moving objects are segmented from the background. The simplest way to implement this is to take an image as background and take the frames obtained at the time t, denoted by I(t) to compare with the background image denoted by B. Here using simple arithmetic calculations, we can segment out the objects simply by using image subtraction technique of computer vision meaning for each pixels in I(t), take the pixel value denoted by P[I(t)] and subtract it with the corresponding pixels at the same position on the background image denoted as P[B].

In mathematical equation, it is written as:

P[F(t)]=P[I(t)]-P[B]\,

The background is assumed to be the frame at time t. This difference image would only show some intensity for the pixel locations which have changed in the two frames. Though we have seemingly removed the background, this approach will only work for cases where all foreground pixels are moving and all background pixels are static.[2] [3] A threshold “Threshold” is put on this difference image to improve the subtraction (see Image thresholding).

|P[F(t)]-P[F(t+1)]|>\mathrm {Threshold} \,

This means that the difference image’s pixels’ intensities are ‘thresholded’ or filtered on the basis of value of Threshold. [4] The accuracy of this approach is dependent on speed of movement in the scene. Faster movements may require higher thresholds.

……

 

起始,到程式庫之建立與使用︰

How to Use Background Subtraction Methods

  • Background subtraction (BS) is a common and widely used technique for generating a foreground mask (namely, a binary image containing the pixels belonging to moving objects in the scene) by using static cameras.
  • As the name suggests, BS calculates the foreground mask performing a subtraction between the current frame and a background model, containing the static part of the scene or, more in general, everything that can be considered as background given the characteristics of the observed scene.

    Background_Subtraction_Tutorial_Scheme.png
  • Background modeling consists of two main steps:

    1. Background Initialization;
    2. Background Update.

    In the first step, an initial model of the background is computed, while in the second step that model is updated in order to adapt to possible changes in the scene.

  • In this tutorial we will learn how to perform BS by using OpenCV. As input, we will use data coming from the publicly available data set Background Models Challenge (BMC) .

Goals

In this tutorial you will learn how to:

  1. Read data from videos by using cv::VideoCapture or image sequences by using cv::imread ;
  2. Create and update the background model by using cv::BackgroundSubtractor class;
  3. Get and show the foreground mask by using cv::imshow ;
  4. Save the output by using cv::imwrite to quantitatively evaluate the results.

……

 

實難盡此概念的可能性乎??因此一顆顏色特殊的球, Adrian Rosebrock 先生玩的轉也︰

Ball Tracking with OpenCV

……

OpenCV Track Object Movement

 

※ 註︰

imutils

A series of convenience functions to make basic image processing functions such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and both Python 2.7 and Python 3.

For more information, along with a detailed code review check out the following posts on the PyImageSearch.com blog:

Installation

Provided you already have NumPy, SciPy, Matplotlib, and OpenCV already installed, the imutils package is completely pip-installable:

$ pip install imutils

 

如果將小汽車加裝『雷射指標』︰

Laser diode

A laser diode, or LD also known as injection laser diode or ILD, is an electrically pumped semiconductor laser in which the active laser medium is formed by a p-n junction of a semiconductor diode similar to that found in a light-emitting diode.

The laser diode is the most common type of laser produced with a wide range of uses that include fiber optic communications, barcode readers, laser pointers, CD/DVD/Blu-ray Disc reading and recording, laser printing, laser scanning and increasingly directional lighting sources.

 

能否依樣畫葫蘆耶!!

更別說

Wii

Wii任天堂公司所推出的家用遊戲主機,Wii開發時的代號為 「Revolution」(革命),表示「電視遊戲的革命」。Wii 本體和周邊製品型號的開頭均為「RVL」。任天堂於2006年4月28日[4]在其官方網站宣布了正式名稱,2006年11月19日正式發售。Wii使用前所未見的控制器使用方法、可購買下載遊戲軟體、生活資訊內容、網路的功能等各項服務等均為 Wii 的主要特色。

『Wii』聽起來像是『we』(我們),發音亦類似,強調該主機『老少咸宜』、能讓全家大小都樂在其中的概念。名稱中的「ii」不僅象徵著其獨特設計的控制器,也代表人們聚在一起同樂的形象。

Wii 在全球累計銷量為一億一百六十三萬台,軟體銷售數字則為九億一千六百一五套。[5]

下一代的主機Wii U在美國2012年11月18日發售,任天堂於2011年6月7日在美國洛杉磯舉行的E3遊戲展發表及出展此遊戲機。[6]

 

Wii控制器

 左方的雙節棍形式的模擬控制器連接著Wii控制器
  • Wii的標準控制器類似遙控器般的控制裝置。
  • 底部有外接擴充端子,以有線連接的方式,連接使用雙節棍控制器及Wii傳統控制器。
    • 原有的GC控制器和Wii專屬的DDR跳舞踏墊,可連接於Wii頂部的外接端子。

 

幹麻用那不可見的紅外線哩☆

  • 感應棒(Sensor Bar)
    • 纜線長度: 3.5m
作為Wii的指標功能,於棒的兩端安裝紅外線LED,紅外線發光後讓Wii遙控器所內建的 CMOS 感應器攝影捕捉後取得與電視的距離、遙控器的姿勢資料等移動資訊。最大的辨識距離為五公尺,建議使用的距離為1~3公尺。
與Wii本體以纜線連接,放置於顯示器的上或下方。