TWI663575B - Method and electrical device for image motion detection - Google Patents

Method and electrical device for image motion detection Download PDF

Info

Publication number
TWI663575B
TWI663575B TW107110336A TW107110336A TWI663575B TW I663575 B TWI663575 B TW I663575B TW 107110336 A TW107110336 A TW 107110336A TW 107110336 A TW107110336 A TW 107110336A TW I663575 B TWI663575 B TW I663575B
Authority
TW
Taiwan
Prior art keywords
image
blocks
block
value
difference
Prior art date
Application number
TW107110336A
Other languages
Chinese (zh)
Other versions
TW201941161A (en
Inventor
甘家銘
楊得煒
Original Assignee
奇景光電股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 奇景光電股份有限公司 filed Critical 奇景光電股份有限公司
Priority to TW107110336A priority Critical patent/TWI663575B/en
Application granted granted Critical
Publication of TWI663575B publication Critical patent/TWI663575B/en
Publication of TW201941161A publication Critical patent/TW201941161A/en

Links

Abstract

本發明提出一種影像的動作偵測方法,包括:取得第一影像與第二影像,將第一影像分為多個第一區塊,並將第二影像分為多個第二區塊;計算每一個第一區塊與對應的第二區塊之間的區塊差異值;計算差異區塊數目,此差異區塊數目表示有幾個區塊差異值是大於第一臨界值;以及若差異區塊數目大於第二臨界值,判斷動作模式為動態模式,否則動作模式為靜態模式,其中在動態模式下的第一臨界值小於靜態模式下的第一臨界值,或者在動態模式下的第二臨界值小於靜態模式下的第二臨界值。 The invention proposes an image motion detection method, which includes: obtaining a first image and a second image, dividing the first image into a plurality of first blocks, and dividing the second image into a plurality of second blocks; calculating Block difference value between each first block and corresponding second block; calculate the number of difference blocks, and the number of difference blocks indicates how many blocks have a difference value greater than the first threshold value; and if the difference If the number of blocks is greater than the second threshold, it is determined that the action mode is a dynamic mode, otherwise the action mode is a static mode, where the first threshold value in the dynamic mode is smaller than the first threshold value in the static mode or the first threshold value in the dynamic mode. The second critical value is smaller than the second critical value in the static mode.

Description

影像的動作偵測方法與電子裝置 Image motion detection method and electronic device

本發明是有關於一種影像的動作偵測方法,且特別是有關於一種在不同模式下採用不同臨界值的動作偵測方法。 The invention relates to an image motion detection method, and in particular to an image motion detection method using different threshold values in different modes.

影像的動作偵測具有廣泛的應用,例如監視器可以在偵測到動作時才開始錄影,或者在偵測到動作時啟動警報或發出一些特定的訊息。在一些應用中,是由永遠啟動(Always-on)感測器搭配運算電路來執行動作偵測演算法,這樣的應用中需要達到非常低的功率消耗,因此如何提出一個低功耗且有效的動作偵測演算法,為此領域技術人員所關心的議題。 Video motion detection has a wide range of applications. For example, a monitor can start recording when motion is detected, or trigger an alarm or send some specific messages when motion is detected. In some applications, an always-on sensor and an arithmetic circuit are used to execute a motion detection algorithm. In such applications, very low power consumption is required, so how to propose a low power consumption and effective Motion detection algorithms are a topic of concern to those skilled in the art.

本發明的實施例提出一種影像的動作偵測方法,適用於電子裝置。此動作偵測方法包括:取得第一影像與第二影像,將第一影像分為多個第一區塊,並將第二影像分為多個第二區塊,其中第一區塊是分別對應至第二區塊; 計算每一個第一區塊與對應的第二區塊之間的一區塊差異值,並判斷區塊差異值是否大於第一臨界值;計算差異區塊數目,此差異區塊數目表示第一影像或第二影像中有幾個區塊差異值是大於第一臨界值;以及若差異區塊數目大於第二臨界值,判斷動作模式為動態模式,否則動作模式為靜態模式,其中在動態模式下的第一臨界值小於靜態模式下的第一臨界值,或者在動態模式下的第二臨界值小於靜態模式下的第二臨界值。 An embodiment of the present invention provides an image motion detection method, which is suitable for an electronic device. The motion detection method includes: obtaining a first image and a second image, dividing the first image into a plurality of first blocks, and dividing the second image into a plurality of second blocks, where the first block is respectively Corresponds to the second block; Calculate a block difference value between each first block and the corresponding second block, and determine whether the block difference value is greater than the first critical value; calculate the number of difference blocks, and the number of difference blocks represents the first There are several blocks in the image or the second image whose difference value is greater than the first threshold value; and if the number of difference blocks is greater than the second threshold value, it is judged that the motion mode is a dynamic mode, otherwise the motion mode is a static mode, in which the The first critical value in the lower mode is smaller than the first critical value in the static mode, or the second critical value in the dynamic mode is smaller than the second critical value in the static mode.

在一些實施例中,計算第一區塊與對應的第二區塊之間的區塊差異值的步驟包括:對於第一區塊內的像素計算第一直方圖;對於每一第二區塊內的像素計算第二直方圖;以及計算第一直方圖與對應的第二直方圖之間的差異作為區塊差異值。 In some embodiments, the step of calculating a block difference value between the first block and the corresponding second block includes: calculating a first histogram for pixels in the first block; and for each second region The pixels in the block calculate a second histogram; and calculate the difference between the first histogram and the corresponding second histogram as a block difference value.

在一些實施例中,上述的區塊差異值為絕對差和。 In some embodiments, the above block difference value is an absolute difference sum.

在一些實施例中,動作偵測方法更包括:根據第一影像與第二影像之間的時間距離來設定第一臨界值或第二臨界值,其中時間距離與第一臨界值呈正相關,或者時間距離與第二臨界值呈正相關。 In some embodiments, the motion detection method further includes: setting a first threshold value or a second threshold value according to a time distance between the first image and the second image, wherein the time distance is positively correlated with the first threshold value, or The time distance is positively correlated with the second critical value.

在一些實施例中,動作偵測方法更包括:判斷第二影像與第三影像之間的動作模式,其中第一影像與第二影像之間的時間距離小於第二影像與第三影像之間的時間距離。 In some embodiments, the motion detection method further includes: determining a motion mode between the second image and the third image, wherein a time distance between the first image and the second image is smaller than a distance between the second image and the third image Time distance.

以另外一個角度來說,本發明的實施例提出一 種電子裝置,包括永遠啟動感測器與運算電路。永遠啟動感測器用以取得第一影像與第二影像。運算電路用以將第一影像分為多個第一區塊,並將第二影像分為多個第二區塊,其中第一區塊是分別對應至第二區塊。運算電路用以計算每一個第一區塊與對應的第二區塊之間的一區塊差異值,並判斷區塊差異值是否大於第一臨界值。運算電路用以計算一差異區塊數目,此差異區塊數目表示第一影像或第二影像中有幾個區塊差異值是大於第一臨界值。若判斷差異區塊數目大於第二臨界值,運算電路判斷動作模式為動態模式,否則動作模式為靜態模式。其中在動態模式下的第一臨界值小於靜態模式下的第一臨界值,或者在動態模式下的第二臨界值小於靜態模式下的第二臨界值。 From another perspective, the embodiment of the present invention proposes a An electronic device includes an always-on sensor and a computing circuit. The sensor is always activated to obtain the first image and the second image. The arithmetic circuit is used to divide the first image into a plurality of first blocks and the second image into a plurality of second blocks, wherein the first block is respectively corresponding to the second block. The arithmetic circuit is configured to calculate a block difference value between each first block and a corresponding second block, and determine whether the block difference value is greater than a first critical value. The arithmetic circuit is used to calculate a number of difference blocks. The number of difference blocks indicates that the difference value of several blocks in the first image or the second image is greater than the first critical value. If it is determined that the number of difference blocks is greater than the second critical value, the arithmetic circuit determines that the operation mode is a dynamic mode, otherwise the operation mode is a static mode. The first critical value in the dynamic mode is smaller than the first critical value in the static mode, or the second critical value in the dynamic mode is smaller than the second critical value in the static mode.

在一些實施例中,運算電路還用以對於第一區塊內的像素計算第一直方圖,對於第二區塊內的像素計算第二直方圖,並且計算第一直方圖與對應的第二直方圖之間的差異作為區塊差異值。 In some embodiments, the arithmetic circuit is further configured to calculate a first histogram for the pixels in the first block, calculate a second histogram for the pixels in the second block, and calculate the first histogram and the corresponding The difference between the second histograms is used as the block difference value.

在一些實施例中,運算電路還用以根據第一影像與第二影像之間的一時間距離來設定第一臨界值或第二臨界值,其中時間距離與第一臨界值呈正相關,或者時間距離與第二臨界值呈正相關。 In some embodiments, the arithmetic circuit is further configured to set the first threshold value or the second threshold value according to a time distance between the first image and the second image, where the time distance is positively correlated with the first threshold value, or time The distance is positively related to the second critical value.

在一些實施例中,運算電路還用以判斷第二影像與第三影像之間的動作模式。其中第一影像與第二影像之間的時間距離小於第二影像與第三影像之間的時間距離。 In some embodiments, the arithmetic circuit is further configured to determine an action mode between the second image and the third image. The time distance between the first image and the second image is smaller than the time distance between the second image and the third image.

為讓本發明的上述特徵和優點能更明顯易懂, 下文特舉實施例,並配合所附圖式作詳細說明如下。 In order to make the above features and advantages of the present invention more comprehensible, The embodiments are exemplified below and described in detail with the accompanying drawings.

100‧‧‧電子裝置 100‧‧‧ electronic device

110‧‧‧永遠啟動感測器 110‧‧‧Always activate the sensor

120‧‧‧運算電路 120‧‧‧ Operation Circuit

130‧‧‧邏輯電路 130‧‧‧Logic Circuit

210‧‧‧第一影像 210‧‧‧ first image

220‧‧‧第二影像 220‧‧‧Second image

230‧‧‧第三影像 230‧‧‧ third image

211~213、221~223‧‧‧區塊 Blocks 211 ~ 213, 221 ~ 223‧‧‧

d1、d2‧‧‧時間距離 d 1 , d 2 ‧‧‧ time distance

T1,s、T1,d‧‧‧第一臨界值 T 1, s , T 1, d ‧‧‧ first critical value

T2,s、T2,d‧‧‧第二臨界值 T 2, s , T 2, d ‧‧‧ second critical value

401~406‧‧‧步驟 401 ~ 406‧‧‧step

[圖1]是根據一實施例繪示電子裝置的示意圖。 1 is a schematic diagram illustrating an electronic device according to an embodiment.

[圖2]是根據一實施例繪示時間軸上的多張影像的示意圖。 FIG. 2 is a schematic diagram illustrating multiple images on a time axis according to an embodiment.

[圖3A]與[圖3B]是根據一實施例繪示在不同模式下設定不同臨界值的示意圖。 [FIG. 3A] and [FIG. 3B] are schematic diagrams illustrating setting different thresholds in different modes according to an embodiment.

[圖4]是根據一實施例繪示動作偵測方法的流程圖。 4 is a flowchart illustrating a motion detection method according to an embodiment.

關於本文中所使用之『第一』、『第二』、...等,並非特別指次序或順位的意思,其僅為了區別以相同技術用語描述的元件或操作。 Regarding the "first", "second", ... and the like used herein, they do not specifically mean the order or the order, but merely the difference between the elements or operations described in the same technical terms.

圖1是根據一實施例繪示電子裝置的示意圖。請參照圖1,電子裝置100例如為監視器、攝影機、電腦系統或其他任意適合的電子裝置。電子裝置100包括永遠啟動(always-on)感測器110、運算電路120與邏輯電路130。永遠啟動感測器110用以持續的擷取影像,而運算電路120會根據這些影像來執行動作偵測,偵測的結果會傳送至邏輯電路130以做後續的處理。在一些實施例中,運算電路120可以是中央處理器、微處理器、微控制器、數位信號處理器、影像處理晶片、特殊應用積體電路等。 FIG. 1 is a schematic diagram illustrating an electronic device according to an embodiment. Referring to FIG. 1, the electronic device 100 is, for example, a monitor, a camera, a computer system, or any other suitable electronic device. The electronic device 100 includes an always-on sensor 110, an arithmetic circuit 120 and a logic circuit 130. The sensor 110 is always activated to continuously capture images, and the arithmetic circuit 120 performs motion detection based on these images, and the detection results are transmitted to the logic circuit 130 for subsequent processing. In some embodiments, the arithmetic circuit 120 may be a central processing unit, a microprocessor, a microcontroller, a digital signal processor, an image processing chip, a special application integrated circuit, and the like.

圖2是根據一實施例繪示時間軸上的多張影像的示意圖。在此以第一影像210、第二影像220與第三影像230來說明動作偵測方法,以下的步驟是由運算電路120所執行,將不再贅述。首先,將第一影像210分為多個第一區塊,並將第二影像220分為多個第二區塊,這些第一區塊是分別對應至第二區塊,例如第一區塊211是對應至第二區塊221,第一區塊212是對應至第二區塊222,以此類推。在圖2的實施例中,第一影像210與第二影像220各有16個區塊,但此區塊的數目僅是示意,本發明並不限制要將影像分為多少個區塊,也不限制這些區塊的大小與形狀。 FIG. 2 is a schematic diagram illustrating multiple images on a time axis according to an embodiment. Here, the first image 210, the second image 220, and the third image 230 are used to describe the motion detection method. The following steps are performed by the arithmetic circuit 120 and will not be described again. First, the first image 210 is divided into a plurality of first blocks, and the second image 220 is divided into a plurality of second blocks. These first blocks are respectively corresponding to the second blocks, such as the first block. 211 corresponds to the second block 221, the first block 212 corresponds to the second block 222, and so on. In the embodiment of FIG. 2, the first image 210 and the second image 220 each have 16 blocks, but the number of this block is only for illustration. The present invention does not limit how many blocks the image is divided into. There are no restrictions on the size and shape of these blocks.

接下來,計算每一個第一區塊與對應的第二區塊之間的區塊差異值。在一些實施例中是先計算直方圖(histogram),再根據直方圖來計算區塊差異值。具體來說,可先將像素的灰階(grey level)分為多個槽(bin),例如將0-255的範圍分為8個槽。對於某個第一區塊內的每個像素,可以判斷像素的灰階是落在哪一個槽中,藉此統計每個槽具有幾個像素,本領域具有通常知識者當可理解直方圖的計算,在此並不詳細贅述。因此,對於第一區塊211內的像素可以計算出一個第一直方圖,而對於第二區塊221內的像素可以計算出一個第二直方圖。接下來,計算第一直方圖與第二直方圖之間的差異,便可以作為上述的區塊差異值。在一些實施例中,是計算兩個直方圖之間的絕對差和(sum of absolute difference)作為區塊差異值,可表示為以下方程式(1)。 Next, calculate a block difference value between each first block and the corresponding second block. In some embodiments, a histogram is calculated first, and then a block difference value is calculated based on the histogram. Specifically, the gray level of the pixel may be first divided into a plurality of bins, for example, a range from 0 to 255 is divided into 8 bins. For each pixel in a certain first block, you can determine which slot the pixel's gray level falls in, so as to count how many pixels each slot has. Those skilled in the art can understand the histogram. The calculation is not detailed here. Therefore, a first histogram can be calculated for the pixels in the first block 211, and a second histogram can be calculated for the pixels in the second block 221. Next, calculate the difference between the first histogram and the second histogram, which can be used as the block difference value. In some embodiments, the sum of absolute difference between two histograms is calculated as the block difference value, which can be expressed as the following equation (1).

SADi j |bin1 i,j -bin2 i,j |…(1) SAD i = Σ j | bin 1 i, j - bin 2 i, j | ... (1)

SADi表示第i個區塊所對應的區塊差異值。bin1 i,j 表示第一影像中第i個區塊的直方圖中第j個槽的數值。bin2 i,j 表示第二影像中第i個區塊的直方圖中第j個槽的數值。然而,在其他實施例中,也可以計算兩個直方圖之間的平方差和或其他合適的差值作為上述的區塊差異值。或者,在一些實施例中也可以計算第一區塊211與第二區塊221之間灰階值的絕對差和或平方差和以作為區塊差異值(不計算直方圖)。在一些實施例中,為了節省記憶體的使用或節省功率消耗,也可以對第一區塊211以及第二區塊221中的像素執行降取樣(down sampling)再計算區塊差異值。舉例來說,若進行2倍的降取樣,則區塊中只有1/4的像素會用來計算上述的區塊差異值,但本發明並不限制降取樣的倍率是多少。 SAD i represents the block difference value corresponding to the i-th block. bin 1 i, j represents the value of the j th slot in the histogram of the i th block in the first image. bin 2 i, j represents the value of the j th slot in the histogram of the i th block in the second image. However, in other embodiments, the sum of square differences between the two histograms or other suitable differences may be calculated as the above-mentioned block difference value. Alternatively, in some embodiments, the absolute difference sum or the square difference sum of the grayscale values between the first block 211 and the second block 221 may be calculated as the block difference value (the histogram is not calculated). In some embodiments, in order to save memory usage or power consumption, pixels in the first block 211 and the second block 221 may also be subjected to down sampling to calculate the block difference value. For example, if 2 times downsampling is performed, only 1/4 of the pixels in the block will be used to calculate the above-mentioned block difference value, but the present invention does not limit the downsampling magnification.

在計算出區塊差異值以後,再進一步判斷區塊差異值是否大於一個第一臨界值,若大於第一臨界值,則表示此區塊之內有動作發生。對於影像中的每個區塊都計算出區塊差異值並判斷是否大於第一臨界值以後,便可以計算出一個差異區塊數目,此差異區塊數目表示有幾個區塊差異值是大於第一臨界值。舉例來說,在圖2中區塊211、221所對應的區塊差異值是大於第一臨界值;區塊212、222所對應的區塊差異值是大於第一臨界值;區塊213、223所對應的區塊差異值是大於第一臨界值。因此,共有3個區塊的區塊差異值是大於第一臨界值,即上述的差異區塊數目為3。 After the block difference value is calculated, it is further judged whether the block difference value is greater than a first threshold value. If it is greater than the first threshold value, it indicates that an action has occurred in this block. After calculating the block difference value for each block in the image and determining whether it is greater than the first critical value, a number of difference blocks can be calculated. The number of difference blocks indicates that the number of block differences is greater than First critical value. For example, in FIG. 2, the block difference values corresponding to blocks 211 and 221 are greater than the first critical value; the block difference values corresponding to blocks 212 and 222 are greater than the first critical value; blocks 213, The block difference value corresponding to 223 is greater than the first critical value. Therefore, the block difference value of a total of 3 blocks is greater than the first critical value, that is, the number of the above-mentioned difference blocks is three.

在此實施例中是要判斷是否有動作發生,因此可設定一個動作模式,此動作模式可以為動態模式或是靜態模式。此動作模式可以用一個數值來表示,例如0表示靜態模式,1表示動態模式。然而,此動作模式也可以用字元、字串、一或多個位元來表示,本發明並不限制用什麼資料型態來表示動作模式。上述的差異區塊數目可用來判斷動作模式,具體來說,可判斷差異區塊數目是否大於一個第二臨界值,此第二臨界值可為4、8、12或其他任意的數值。如果差異區塊數目大於第二臨界值,則表示影像中有許多個區塊內有動作發生,因此可判斷動作模式為動態模式,否則判斷動作模式為靜態模式。在判斷出動態模式或靜態模式以後,電子裝置100可執行任意後續的程序,例如在動態模式下則開始錄影等,本發明並不限制動態模式下與靜態模式下要執行什麼程序。 In this embodiment, it is to determine whether an action occurs, so an action mode can be set, and the action mode can be a dynamic mode or a static mode. This action mode can be represented by a numerical value, such as 0 for static mode and 1 for dynamic mode. However, this action mode can also be represented by characters, strings, or one or more bits, and the present invention is not limited to what data type is used to represent the action mode. The above number of difference blocks can be used to determine the operation mode. Specifically, it can be determined whether the number of difference blocks is greater than a second critical value, and the second critical value can be 4, 8, 12, or any other value. If the number of difference blocks is greater than the second critical value, it means that there are actions in many blocks in the image, so it can be judged that the action mode is a dynamic mode, otherwise it is judged that the action mode is a static mode. After determining the dynamic mode or the static mode, the electronic device 100 can execute any subsequent programs, for example, start recording in the dynamic mode, etc. The present invention does not limit what programs are to be executed in the dynamic mode and the static mode.

特別的是,在動態模式與靜態模式下分別會設定不同的第一臨界值或第二臨界值,目的是要讓動作模式不要頻繁的切換。圖3A是根據一實施例繪示在不同模式下設定不同第一臨界值的示意圖。請參照圖3A,在靜態模式時所採用的第一臨界值為T1,s,而在動態模式時所採用的第一臨界值為T1,d,此第一臨界值T1,d是小於第一臨界值T1,s。當第一臨界值越大(靜態模式下)時,表示區塊差異值要越大才會被視為是有動作,因此上述計算出的差異區塊數目會比較小而不容易被判斷為動態模式,換言之比較容易維持在靜態模式下。相反地,當第一臨界值越小(動態模式下)時,區 塊差異值容易大於第一臨界值而被視為是有動作,因此上述計算出的差異區塊數目會比較大,比較不容易被判斷為靜態模式,容易維持在動態模式下。如果動態模式與靜態模式都採用相同的第一臨界值(例如T1,s),又區塊差異值在第一臨界值T1,s附近來回改變,則容易不斷地在動態模式與靜態模式之間切換。圖3A的實施例中設計了在不同模式下採用不同的第一臨界值,使得圖3A中關於模式切換的曲線是類似於磁滯曲線。 In particular, different first and second critical values are set in the dynamic mode and the static mode, respectively, in order to prevent the operation mode from being frequently switched. FIG. 3A is a schematic diagram illustrating setting different first thresholds in different modes according to an embodiment. Referring to FIG. 3A, the first critical value used in the static mode is T 1, s , and the first critical value used in the dynamic mode is T 1, d . The first critical value T 1, d is Less than the first critical value T 1, s . When the first critical value is larger (in the static mode), it means that the larger the block difference value is, it will be regarded as an action. Therefore, the number of the difference blocks calculated above will be smaller and it will not be easily judged as dynamic In other words, it is easier to maintain the static mode. Conversely, when the first threshold value is smaller (in the dynamic mode), the block difference value is likely to be greater than the first threshold value and it is considered to be an action. Therefore, the number of the difference blocks calculated above will be larger and less likely. It is easy to be judged as static mode, and it is easy to maintain in dynamic mode. If both the dynamic mode and the static mode use the same first critical value (for example, T 1, s ), and the block difference value changes back and forth around the first critical value T 1, s , then it is easy to continuously change between the dynamic mode and the static mode. Switch between. The embodiment of FIG. 3A is designed to use different first thresholds in different modes, so that the curve of mode switching in FIG. 3A is similar to the hysteresis curve.

依照同樣的理由,不同的模式下也可以採用不同的第二臨界值,因此對於第二臨界值也可以繪示出一個磁滯曲線。請參照圖3B,圖3B是根據一實施例繪示在不同模式下設定不同第二臨界值的示意圖。在靜態模式時所採用的第二臨界值為T2,s,而在動態模式時所採用的第二臨界值為T2,d,其中動態模式下的第二臨界值T2,d是小於靜態模式下的第二臨界值T2,s。當第二臨界值越大時(靜態模式下),差異區塊數目必須要更大才會被判斷為動態模式,因此容易維持在靜態模式。相反地,當第二臨界值越小時(動態模式下),差異區塊數目必須要更小才會被判斷為靜態模式,因此容易維持在動態模式。 For the same reason, different second thresholds can also be used in different modes, so a hysteresis curve can also be plotted for the second threshold. Please refer to FIG. 3B. FIG. 3B is a schematic diagram illustrating setting different second thresholds in different modes according to an embodiment. When the second threshold value used in static mode T 2, s, and when the second threshold value used in the dynamic mode T 2, d, wherein the second threshold value in the dynamic mode T 2, d is less than The second critical value T 2, s in the static mode. When the second critical value is larger (in the static mode), the number of difference blocks must be larger to be judged as the dynamic mode, so it is easy to maintain the static mode. Conversely, when the second critical value is smaller (in the dynamic mode), the number of difference blocks must be smaller to be judged as the static mode, so it is easy to maintain the dynamic mode.

在一些實施例中,上述的第一臨界值與第二臨界值在不同模式下都有不同的數值,因此總共有4個臨界值T1,s、T1,d、T2,s、T2,d。然而,在一些實施例中,也可以只設定第一臨界值(或第二臨界值)在不同模式下有不同的數值,而第二臨界值(或第一臨界值)則在不同模式下都採用 相同的數值,即T2,s=T2,d或是T1,s=T1,d,這是為了方便控制動作模式的切換,在這樣的實施例中則有3個臨界值。 In some embodiments, the above-mentioned first threshold value and the second threshold value have different values in different modes, so there are a total of 4 threshold values T 1, s , T 1, d , T 2, s , T 2, d . However, in some embodiments, it is also possible to set only the first threshold (or the second threshold) to have different values in different modes, and the second threshold (or the first threshold) to have different values in different modes. The same value is used, that is, T 2, s = T 2, d or T 1, s = T 1, d . This is to facilitate the switching of the control operation mode. In this embodiment, there are 3 critical values.

請參照圖2,上述關於第一影像210與第二影像220之間的動作偵測方法也可以應用在第二影像220與第三影像230之間,但時間距離不同時可採用不同的臨界值。具體來說,第一影像210與第三影像230之間的時間距離為1秒,但第一影像210與第二影像220之間的時間距離d1小於第二影像220與第三影像230之間的時間距離d2,例如時間距離d1為1/30秒,而時間距離d2為29/30秒。相較於時間距離d1相等於時間距離d2的設計,圖2的設計是為了讓運算電路120可以在計算完第一影像210與第二影像220之間的動作模式以後休眠較長的時間,藉此達到省電的目的。此外,當時間距離較長時,兩張影像之間的變化也較大,因此可以設定較大的第一臨界值與第二臨界值,以準確地判斷出動作模式。例如,可以設定時間距離與第一臨界值呈正相關,並且時間距離與第二臨界值呈正相關。舉例來說,由於時間距離d1小於時間距離d2,因此在判斷第一影像210與第二影像220之間的動作模式時,所採用的第一臨界值(或第二臨界值)是小於判斷第二影像220與第三影像230之間的動作模式時所採用的第一臨界值(或第二臨界值)。換言之,臨界值的數目會乘以2,參照上一個段落的說明,總共可設定6或8個臨界值。在實施例中是根據時間間隔以及動作模式而設定不同的臨界值,相較於只使用固定臨界值(只需兩個)的先前技術來說,本實施例至少具有節省功率消耗以及準確判斷動 作模式的優點。 Please refer to FIG. 2. The above motion detection method between the first image 210 and the second image 220 can also be applied between the second image 220 and the third image 230, but different threshold values can be adopted when the time distance is different. . Specifically, the time distance between the first image 210 and the third image 230 is 1 second, but the time distance d 1 between the first image 210 and the second image 220 is smaller than that between the second image 220 and the third image 230. The time distance d 2 is , for example, the time distance d 1 is 1/30 seconds, and the time distance d 2 is 29/30 seconds. Compared to the design in which the time distance d 1 is equal to the time distance d 2 , the design in FIG. 2 is to allow the arithmetic circuit 120 to sleep for a longer time after calculating the action mode between the first image 210 and the second image 220. To achieve the purpose of power saving. In addition, when the time distance is long, the change between the two images is also large, so a larger first threshold value and a second threshold value can be set to accurately determine the action mode. For example, the time distance can be set to have a positive correlation with the first threshold, and the time distance has a positive correlation to the second threshold. For example, since the time distance d 1 is less than the time distance d 2 , when determining the action mode between the first image 210 and the second image 220, the first threshold value (or the second threshold value) used is less than The first critical value (or the second critical value) used when determining an operation mode between the second image 220 and the third image 230. In other words, the number of critical values will be multiplied by two, referring to the description in the previous paragraph, a total of 6 or 8 critical values can be set. In the embodiment, different thresholds are set according to the time interval and the operation mode. Compared with the prior art which only uses fixed thresholds (only two are required), this embodiment has at least the power consumption saving and accurate judgment of the action. Advantages of the model.

圖2中的實施例僅是範例,在一些實施例中也可以設定時間距離d1等於時間距離d2,或者時間距離d1大於時間距離d2,本發明並不在此限。 The embodiment in FIG. 2 is merely an example. In some embodiments, the time distance d 1 may be set equal to the time distance d 2 , or the time distance d 1 is greater than the time distance d 2 , and the present invention is not limited thereto.

請參照圖1,在執行上述的動作偵測方法以後,偵測的結果會傳送至邏輯電路130,邏輯電路130可以根據此判斷結果執行任意的程序,本發明並不在此限。舉例來說,在判斷出動態模式以後,邏輯電路130可以將擷取到的影像儲存起來或是再判斷影像中是否有特定的物體等等。 Referring to FIG. 1, after the above-mentioned motion detection method is executed, the detection result is transmitted to the logic circuit 130, and the logic circuit 130 can execute an arbitrary program according to the judgment result, and the present invention is not limited thereto. For example, after determining the dynamic mode, the logic circuit 130 may store the captured image or determine whether there is a specific object in the image, and so on.

圖4是根據一實施例繪示動作偵測方法的流程圖。請參照圖4,在步驟401中,取得第一影像與第二影像,將第一影像分為多個第一區塊,並將第二影像分為多個第二區塊,其中第一區塊是分別對應至第二區塊。在步驟402中,計算每一個第一區塊與對應的第二區塊之間的一區塊差異值,並判斷區塊差異值是否大於第一臨界值。在步驟403中,計算差異區塊數目,此差異區塊數目表示第一影像或第二影像中有幾個區塊差異值是大於第一臨界值。在步驟404中,判斷差異區塊數目是否大於第二臨界值。若步驟404的結果為是,在步驟405中判斷動作模式為動態模式。若步驟404的結果為否,在步驟406中判斷動作模式為靜態模式。然而,圖4中各步驟已詳細說明如上,在此便不再贅述。值得注意的是,圖4中各步驟可以實作為多個程式碼或是電路,本發明並不在此限。此外,圖4的方法可以搭配以上實施例使用,也可以單獨使用,換言之,圖4的各步驟之間也 可以加入其他的步驟。 FIG. 4 is a flowchart illustrating a motion detection method according to an embodiment. Referring to FIG. 4, in step 401, a first image and a second image are obtained, the first image is divided into a plurality of first blocks, and the second image is divided into a plurality of second blocks. The blocks are respectively corresponding to the second blocks. In step 402, a block difference value between each first block and a corresponding second block is calculated, and it is determined whether the block difference value is greater than a first critical value. In step 403, the number of difference blocks is calculated. The number of difference blocks indicates that the difference value of several blocks in the first image or the second image is greater than the first critical value. In step 404, it is determined whether the number of difference blocks is greater than a second threshold. If the result of step 404 is YES, it is determined in step 405 that the operation mode is a dynamic mode. If the result of step 404 is no, it is determined in step 406 that the operation mode is a static mode. However, the steps in FIG. 4 have been described in detail above, and will not be repeated here. It should be noted that each step in FIG. 4 can be implemented as multiple codes or circuits, and the present invention is not limited thereto. In addition, the method of FIG. 4 can be used in conjunction with the above embodiments, or it can be used alone. In other words, the steps of FIG. 4 are also used. Other steps can be added.

雖然本發明已以實施例揭露如上,然其並非用以限定本發明,任何所屬技術領域中具有通常知識者,在不脫離本發明的精神和範圍內,當可作些許的更動與潤飾,故本發明的保護範圍當視後附的申請專利範圍所界定者為準。 Although the present invention has been disclosed as above with the examples, it is not intended to limit the present invention. Any person with ordinary knowledge in the technical field can make some modifications and retouching without departing from the spirit and scope of the present invention. The protection scope of the present invention shall be determined by the scope of the attached patent application.

Claims (10)

一種影像的動作偵測方法,由一電子裝置執行,該動作偵測方法包括:取得一第一影像與一第二影像,將該第一影像分為多個第一區塊,並將該第二影像分為多個第二區塊,其中該些第一區塊是分別對應至該些第二區塊;計算每一該些第一區塊與對應的該第二區塊之間的一區塊差異值,並判斷該區塊差異值是否大於一第一臨界值;計算一差異區塊數目,該差異區塊數目表示該第一影像或該第二影像中有幾個該區塊差異值是大於該第一臨界值;以及若該差異區塊數目大於一第二臨界值,判斷一動作模式為一動態模式,否則該動作模式為一靜態模式,其中在該動態模式下的該第一臨界值小於該靜態模式下的該第一臨界值,或者在該動態模式下的該第二臨界值小於該靜態模式下的該第二臨界值。An image motion detection method is executed by an electronic device. The motion detection method includes: acquiring a first image and a second image, dividing the first image into a plurality of first blocks, and dividing the first image into a plurality of first blocks. The two images are divided into a plurality of second blocks, where the first blocks are respectively corresponding to the second blocks; one between each of the first blocks and the corresponding second block is calculated Block difference value, and determine whether the block difference value is greater than a first critical value; calculate a number of difference blocks, and the number of difference blocks indicates how many of the block differences are in the first image or the second image The value is greater than the first critical value; and if the number of difference blocks is greater than a second critical value, it is judged that an action mode is a dynamic mode, otherwise the action mode is a static mode, where the first A critical value is less than the first critical value in the static mode, or the second critical value in the dynamic mode is less than the second critical value in the static mode. 如申請專利範圍第1項所述之動作偵測方法,其中計算每一該些第一區塊與對應的該第二區塊之間的該區塊差異值的步驟包括:對於每一該些第一區塊內的像素計算一第一直方圖;對於每一該些第二區塊內的像素計算一第二直方圖;以及計算每一該些第一直方圖與對應的該第二直方圖之間的差異作為該區塊差異值。The motion detection method according to item 1 of the scope of patent application, wherein the step of calculating the block difference value between each of the first blocks and the corresponding second block includes: for each of the A first histogram is calculated for pixels in the first block; a second histogram is calculated for each pixel in the second blocks; and each of the first histograms and the corresponding first histogram are calculated. The difference between the two histograms is used as the difference value of the block. 如申請專利範圍第2項所述之動作偵測方法,其中該區塊差異值為絕對差和。The motion detection method as described in item 2 of the scope of patent application, wherein the block difference value is an absolute difference sum. 如申請專利範圍第1項所述之動作偵測方法,更包括:根據該第一影像與該第二影像之間的一時間距離來設定該第一臨界值或該第二臨界值,其中該時間距離與該第一臨界值呈正相關,或者該時間距離與該第二臨界值呈正相關。The motion detection method according to item 1 of the scope of patent application, further comprising: setting the first threshold value or the second threshold value according to a time distance between the first image and the second image, wherein the The time distance is positively correlated with the first critical value, or the time distance is positively correlated with the second critical value. 如申請專利範圍第1項所述之動作偵測方法,更包括:判斷該第二影像與一第三影像之間的該動作模式,其中該第一影像與該第二影像之間的時間距離小於該第二影像與該第三影像之間的時間距離。The motion detection method according to item 1 of the scope of patent application, further comprising: determining the motion mode between the second image and a third image, wherein the time distance between the first image and the second image Less than the time distance between the second image and the third image. 一種電子裝置,包括:一永遠啟動感測器,用以取得一第一影像與一第二影像;以及一運算電路,用以將該第一影像分為多個第一區塊,並將該第二影像分為多個第二區塊,其中該些第一區塊是分別對應至該些第二區塊,其中該運算電路用以計算每一該些第一區塊與對應的該第二區塊之間的一區塊差異值,並判斷該區塊差異值是否大於一第一臨界值,該運算電路用以計算一差異區塊數目,該差異區塊數目表示該第一影像或該第二影像中有幾個該區塊差異值是大於該第一臨界值,若判斷該差異區塊數目大於一第二臨界值,該運算電路判斷一動作模式為一動態模式,否則該動作模式為一靜態模式,其中在該動態模式下的該第一臨界值小於該靜態模式下的該第一臨界值,或者在該動態模式下的該第二臨界值小於該靜態模式下的該第二臨界值。An electronic device includes: a permanently activated sensor for obtaining a first image and a second image; and an arithmetic circuit for dividing the first image into a plurality of first blocks and dividing the first image into a plurality of first blocks. The second image is divided into a plurality of second blocks, where the first blocks are respectively corresponding to the second blocks, and the operation circuit is used to calculate each of the first blocks and the corresponding first block. A block difference value between two blocks, and determining whether the block difference value is greater than a first critical value, the operation circuit is used to calculate a number of difference blocks, and the number of difference blocks indicates the first image or There are several difference values of the block in the second image that are greater than the first threshold value. If it is determined that the number of difference blocks is greater than a second threshold value, the arithmetic circuit determines that an action mode is a dynamic mode, otherwise the action The mode is a static mode, wherein the first critical value in the dynamic mode is smaller than the first critical value in the static mode, or the second critical value in the dynamic mode is smaller than the first critical value in the static mode. Two critical values. 如申請專利範圍第6項所述之電子裝置,其中該運算電路還用以對於每一該些第一區塊內的像素計算一第一直方圖,對於每一該些第二區塊內的像素計算一第二直方圖,並且計算每一該些第一直方圖與對應的該第二直方圖之間的差異作為該區塊差異值。The electronic device according to item 6 of the scope of patent application, wherein the operation circuit is further configured to calculate a first histogram for each pixel in the first blocks, and for each of the second blocks Calculate a second histogram, and calculate the differences between each of the first histograms and the corresponding second histograms as the block difference value. 如申請專利範圍第7項所述之電子裝置,其中該區塊差異值為絕對差和。The electronic device according to item 7 of the scope of patent application, wherein the block difference value is an absolute difference sum. 如申請專利範圍第6項所述之電子裝置,其中該運算電路還用以根據該第一影像與該第二影像之間的一時間距離來設定該第一臨界值或該第二臨界值,其中該時間距離與該第一臨界值呈正相關,或者該時間距離與該第二臨界值呈正相關。The electronic device according to item 6 of the scope of patent application, wherein the arithmetic circuit is further configured to set the first threshold value or the second threshold value according to a time distance between the first image and the second image, The time distance is positively correlated with the first critical value, or the time distance is positively correlated with the second critical value. 如申請專利範圍第6項所述之電子裝置,其中該運算電路還用以判斷該第二影像與一第三影像之間的該動作模式,其中該第一影像與該第二影像之間的時間距離小於該第二影像與該第三影像之間的時間距離。The electronic device according to item 6 of the scope of patent application, wherein the arithmetic circuit is further configured to determine the action mode between the second image and a third image, wherein the first image and the second image are between the first image and the second image. The time distance is less than the time distance between the second image and the third image.
TW107110336A 2018-03-26 2018-03-26 Method and electrical device for image motion detection TWI663575B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW107110336A TWI663575B (en) 2018-03-26 2018-03-26 Method and electrical device for image motion detection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW107110336A TWI663575B (en) 2018-03-26 2018-03-26 Method and electrical device for image motion detection

Publications (2)

Publication Number Publication Date
TWI663575B true TWI663575B (en) 2019-06-21
TW201941161A TW201941161A (en) 2019-10-16

Family

ID=67764634

Family Applications (1)

Application Number Title Priority Date Filing Date
TW107110336A TWI663575B (en) 2018-03-26 2018-03-26 Method and electrical device for image motion detection

Country Status (1)

Country Link
TW (1) TWI663575B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200616446A (en) * 2004-11-04 2006-05-16 Himax Tech Inc Caption detection and compensation for interlaced image
TW200901755A (en) * 2007-06-27 2009-01-01 Ind Tech Res Inst An image extraction apparatus and method for automatically detecting the focused area
TW201042577A (en) * 2009-05-27 2010-12-01 Chip Goal Electronics Corp Motion image data generator, system using motion image data, and methods thereof
TW201344630A (en) * 2012-04-25 2013-11-01 Hon Hai Prec Ind Co Ltd Moving subject detecting system and method
TW201612698A (en) * 2014-09-25 2016-04-01 Ncku Res & Dev Foundation Gesture recognition system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200616446A (en) * 2004-11-04 2006-05-16 Himax Tech Inc Caption detection and compensation for interlaced image
TW200901755A (en) * 2007-06-27 2009-01-01 Ind Tech Res Inst An image extraction apparatus and method for automatically detecting the focused area
TW201042577A (en) * 2009-05-27 2010-12-01 Chip Goal Electronics Corp Motion image data generator, system using motion image data, and methods thereof
TW201344630A (en) * 2012-04-25 2013-11-01 Hon Hai Prec Ind Co Ltd Moving subject detecting system and method
TW201612698A (en) * 2014-09-25 2016-04-01 Ncku Res & Dev Foundation Gesture recognition system

Also Published As

Publication number Publication date
TW201941161A (en) 2019-10-16

Similar Documents

Publication Publication Date Title
Wang et al. A fast self-tuning background subtraction algorithm
US10445590B2 (en) Image processing apparatus and method and monitoring system
CN106878668B (en) Movement detection of an object
US10248222B2 (en) Method for processing event signal and event-based sensor performing the same
JP5701005B2 (en) Object detection apparatus, object detection method, surveillance camera system, and program
JP2018501531A5 (en)
JP2019504379A (en) Smoke detection apparatus, method and image processing apparatus
US20150146006A1 (en) Display control apparatus and display control method
JP2013161405A5 (en) Subject determination device, subject determination method, and program
US20170061184A1 (en) Portable electronic device and operation method thereof
TWI663575B (en) Method and electrical device for image motion detection
CN108810527B (en) Method and device for detecting abnormity of diffuser and electronic equipment
JP4717445B2 (en) Image processing system, image processing device, game device, program, information storage medium, and image processing method
TWI632504B (en) Method and electronic apparatus for wave detection
US9876966B2 (en) System and method for determining image variation tendency and controlling image resolution
Presti et al. Real-time object detection in embedded video surveillance systems
CN110392182B (en) Image motion detection method and electronic device
US20200065979A1 (en) Imaging system and method with motion detection
JP6399122B2 (en) Face detection apparatus and control method thereof
CN107943536B (en) Method and device for adjusting threshold, storage medium and electronic equipment
TW201931079A (en) Electronic device, control device, storage medium, and control method
Tavakkoli et al. Robust recursive learning for foreground region detection in videos with quasi-stationary backgrounds
JP4619082B2 (en) Image determination device
JP3994416B1 (en) Abnormality detection device, program, and abnormality detection method
TWI790523B (en) Method and device for detecting human skeleton