CN110392182B - Image motion detection method and electronic device - Google Patents

Image motion detection method and electronic device Download PDF

Info

Publication number
CN110392182B
CN110392182B CN201810352698.1A CN201810352698A CN110392182B CN 110392182 B CN110392182 B CN 110392182B CN 201810352698 A CN201810352698 A CN 201810352698A CN 110392182 B CN110392182 B CN 110392182B
Authority
CN
China
Prior art keywords
image
threshold
blocks
mode
block
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201810352698.1A
Other languages
Chinese (zh)
Other versions
CN110392182A (en
Inventor
甘家铭
杨得炜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Himax Technologies Ltd
Original Assignee
Himax Technologies Ltd
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 Himax Technologies Ltd filed Critical Himax Technologies Ltd
Priority to CN201810352698.1A priority Critical patent/CN110392182B/en
Publication of CN110392182A publication Critical patent/CN110392182A/en
Application granted granted Critical
Publication of CN110392182B publication Critical patent/CN110392182B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/14Picture signal circuitry for video frequency region
    • H04N5/144Movement detection

Abstract

The invention provides a method for detecting the action of an image, which comprises the following steps: acquiring 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 a block difference value between each first block and the corresponding second block; calculating the number of difference blocks, wherein the number of difference blocks indicates that the difference values of a plurality of blocks are greater than a first critical value; and if the number of the difference blocks is larger than the second critical value, judging that the action mode is a dynamic mode, otherwise, judging that the action 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 second critical value in the static mode.

Description

Image motion detection method and electronic device
Technical Field
The present invention relates to an image motion detection method, and more particularly, to a motion detection method using different thresholds in different modes.
Background
Motion detection of video has a wide range of applications, for example, a monitor may start recording video when motion is detected, or may activate an alarm or send some specific information when motion is detected. In some applications, the motion detection algorithm is executed by Always-on (Always-on) sensor in combination with an arithmetic circuit, and such applications need to achieve very low power consumption, so how to provide a low power consumption and effective motion detection algorithm is an issue of interest to those skilled in the art.
Disclosure of Invention
The embodiment of the invention provides an image motion detection method which is suitable for an electronic device. The motion detection method comprises the following steps: acquiring 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, wherein the first blocks correspond to the second blocks respectively; calculating a block difference value between each first block and the corresponding second block, and judging whether the block difference value is greater than a first critical value; calculating the number of difference blocks, wherein the number of difference blocks indicates that the difference values of a plurality of blocks in the first image or the second image are larger than a first critical value; and if the number of the difference blocks is larger than the second critical value, judging that the action mode is a dynamic mode, otherwise, judging that the action 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 second critical value in the static mode.
In some embodiments, the step of calculating the block difference value between the first block and the corresponding second block comprises: calculating a first histogram for pixels within the first block; calculating a second histogram for pixels within each second block; and calculating the difference between the first histogram and the corresponding second histogram as a block difference value.
In some embodiments, the block difference value is a sum of absolute differences.
In some embodiments, the motion detection method further comprises: and setting a first critical value or a second critical value according to the time distance between the first image and the second image, wherein the time distance is positively correlated with the first critical value, or the time distance is positively correlated with the second critical value.
In some embodiments, the motion detection method further comprises: and judging the action mode between the second image and the third image, wherein the time distance between the first image and the second image is less than the time distance between the second image and the third image.
In another aspect, an electronic device includes an always-on sensor and an arithmetic circuit. The sensor is always activated to obtain the first image and the second image. The operation circuit is used for dividing the first image into a plurality of first blocks and dividing the second image into a plurality of second blocks, wherein the first blocks correspond to the second blocks respectively. The operation circuit is used for calculating the block difference value between each first block and the corresponding second block and judging whether the block difference value is larger than a first critical value or not. The operation circuit is used for calculating the number of difference blocks, wherein the number of difference blocks indicates that the difference value of a plurality of blocks in the first image or the second image is larger than a first critical value. If the number of the difference blocks is larger than the second critical value, the operation circuit judges that the action mode is a dynamic mode, otherwise, the action mode is a static mode. Wherein the first threshold value in the dynamic mode is smaller than the first threshold value in the static mode, or the second threshold value in the dynamic mode is smaller than the second threshold value in the static mode.
In some embodiments, the arithmetic circuitry is further configured to compute a first histogram for pixels within the first block, compute a second histogram for pixels within the second block, and compute a difference between the first histogram and the corresponding second histogram as the block difference value.
In some embodiments, the operation circuit is further configured to set the first threshold or the second threshold according to a time distance between the first image and the second image, wherein the time distance is positively correlated with the first threshold or the time distance is positively correlated with the second threshold.
In some embodiments, the operation circuit is further configured to determine an operation mode between the second image and the third image. Wherein 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 aforementioned and other features and advantages of the invention more comprehensible, embodiments accompanied with figures are described in detail below.
Drawings
Fig. 1 is a schematic diagram of an electronic device according to an embodiment.
FIG. 2 is a diagram illustrating multiple images on a time axis according to an embodiment.
Fig. 3A and 3B are schematic diagrams illustrating setting of different threshold values in different modes according to an embodiment.
FIG. 4 is a flow chart illustrating a method of motion detection according to one embodiment.
Detailed Description
As used herein, "first," "second," …, etc., do not denote any order or sequence, but rather are used to distinguish one element or operation from another element or operation described in the same technical language.
Fig. 1 is a schematic diagram of an electronic device according to an embodiment. Referring to fig. 1, the electronic device 100 is, for example, a monitor, a video camera, a computer system or any other suitable electronic device. The electronic device 100 includes an always-on (always-on) sensor 110, an arithmetic circuit 120, and a logic circuit 130. The sensor 110 is always activated to capture images, and the operation circuit 120 performs motion detection according to the images, and the detection result is sent 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, an application specific integrated circuit, or the like.
FIG. 2 is a diagram illustrating multiple images on a time axis according to an embodiment. The first image 210, the second image 220 and the third image 230 are used to describe the motion detection method, and the following steps are performed by the operation 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, the first blocks respectively correspond to the second blocks, for example, 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 the blocks is only illustrative, and the invention does not limit how many blocks the image is divided into, nor the size and shape of the blocks.
Next, a block difference value between each first block and the corresponding second block is calculated. In some embodiments, a histogram (histogram) is calculated, and then the block difference value is calculated according to the histogram. Specifically, the gray level (gray level) of a pixel may be first divided into a plurality of bins (bin), for example, a range of 0-255 may be divided into 8 bins. For each pixel in a first block, it can be determined in which bin the gray level of the pixel falls, so as to count that each bin has several pixels. Thus, a first histogram may be calculated for pixels within the first tile 211, and a second histogram may be calculated for pixels within the second tile 221. Next, the difference between the first histogram and the second histogram is calculated, and the difference can be used as the block difference value. In some embodiments, it is the sum of absolute differences (sum of absolute differences) between two histograms that is calculated as the block difference value, which can be represented as the following procedure (1).
SADi==∑j|bin1i,j-bin2i,J|...(1)
SADi representationThe block difference value corresponding to the ith block. bin1i,jThe value of the jth slot in the histogram of the ith block in the first image is represented. bin2i,jThe value of the jth slot in the histogram of the ith block in the second image is represented. However, in other embodiments, a sum of squared differences between two histograms or other suitable differences may be calculated as the block difference value. Alternatively, in some embodiments, the sum of the absolute differences or the squared differences of the gray-scale values between the first and second blocks 211 and 221 may also be calculated as the block difference value (without calculating the histogram). In some embodiments, in order to save memory or power consumption, down sampling (down sampling) may be performed on the pixels in the first block 211 and the second block 221 to calculate the block difference value. For example, if down-sampling is performed by 2 times, only 1/4 pixels in the block are used to calculate the block difference value, but the present invention does not limit the down-sampling magnification.
After the block difference value is calculated, whether the block difference value is larger than a first critical value is further judged, and if the block difference value is larger than the first critical value, an action occurs in the block. After calculating the block difference value for each block in the image and determining whether the difference value is greater than the first threshold, a difference block number can be calculated, wherein the difference block number indicates that the difference values of several blocks are greater than the first threshold. For example, in fig. 2, the block difference values corresponding to the blocks 211 and 221 are greater than the first threshold value; the block difference values corresponding to the blocks 212 and 222 are greater than a first threshold value; the block difference values corresponding to the blocks 213 and 223 are greater than the first threshold. Therefore, the block difference value of 3 blocks in total is greater than the first threshold, i.e. the number of difference blocks is 3.
In this embodiment, it is determined whether any action occurs, so that an action mode can be set, and the action mode can be a dynamic mode or a static mode. The action pattern may be represented by a value, for example, 0 represents a static pattern and 1 represents a dynamic pattern. However, the operation mode can also be represented by a character, a character string, or one or more bits, and the invention is not limited to what data type is used to represent the operation mode. The number of difference blocks can be used to determine the operation mode, and specifically, it can be determined whether the number of difference blocks is greater than a second threshold, which can be 4, 8, 12 or any other value. If the number of the difference blocks is larger than the second critical value, it indicates that there is motion in many blocks in the image, so the motion mode can be determined as dynamic mode, otherwise, the motion mode is determined as static mode. After determining the dynamic mode or the static mode, the electronic device 100 may execute any subsequent program, for example, start recording in the dynamic mode, and the invention does not limit what program is executed in the dynamic mode and the static mode.
In particular, different first threshold values or second threshold values are set in the dynamic mode and the static mode, respectively, so as to avoid frequent switching of the operation mode. Fig. 3A is a schematic diagram illustrating setting of different first threshold values in different modes according to an embodiment. Referring to fig. 3A, the first threshold value adopted in the static mode is T1,sThe first threshold value adopted in the dynamic mode is T1,dThe first threshold value T1,dIs less than the first critical value T1,s. When the first threshold is larger (in the static mode), the block difference value is larger to be considered as an action, so the calculated difference block number is smaller and is not easy to be judged as the dynamic mode, in other words, the difference block number is easier to be maintained in the static mode. On the contrary, when the first threshold is smaller (in the dynamic mode), the block difference value is easily larger than the first threshold and is considered to be an action, so the calculated difference block number is larger, and is not easily judged to be the static mode, and is easily maintained in the dynamic mode. If the same first threshold (e.g., T) is used for both the dynamic mode and the static mode1,s) The difference value of the blocks is at the first threshold value T1,sChanging around, it is easy to constantly switch between the dynamic mode and the static mode. The embodiment of fig. 3A is designed to use different first threshold values in different modes, so that the curve of fig. 3A for mode switching is similar to a hysteresis curve.
For the same reason, different second threshold values can be used in different modes, so that a hysteresis curve can be plotted for the second threshold values. Referring to fig. 3B, fig. 3B is a schematic diagram illustrating setting of different second threshold values in different modes according to an embodiment. The second threshold value adopted in the static mode is T2,sAnd the second threshold value adopted in the dynamic mode is T2,dWherein the second threshold value T is in dynamic mode2,dIs less than the second critical value T in the static mode2,s. When the second threshold is larger (in the static mode), the number of the difference blocks needs to be larger to be determined as the dynamic mode, so that the static mode is easily maintained. On the contrary, when the second threshold is smaller (in the dynamic mode), the number of the difference blocks needs to be smaller to be determined as the static mode, and thus the dynamic mode is easily maintained.
In some embodiments, the first threshold and the second threshold have different values in different modes, so that there are 4 thresholds T in total1,s、T1,d、T2,s、T2,d. However, in some embodiments, only the first threshold (or the second threshold) may be set to have different values in different modes, and the second threshold (or the first threshold) may have the same value in different modes, i.e. T2,s=T2,dOr T1,s=T1,dThis is for the convenience of controlling the switching of the operation mode, and there are 3 thresholds in such an embodiment.
Referring to fig. 2, the 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 thresholds can be used when the time distances are different. Specifically, the time distance between the first image 210 and the third image 230 is 1 second, but the time distance d between the first image 210 and the second image 220 is 1 second1Is smaller than the time distance d between the second image 220 and the third image 2302E.g. distance in time d11/30 seconds, and a time distance d229/30 seconds. Compared with the time distance d1Equal time distance d2The design of fig. 2 is to make the operation circuit 120 sleep for a long time after the operation mode between the first image 210 and the second image 220 is calculated, so as to achieve the purpose of power saving. In addition, when the distance between the two images is longer, the change between the two images is larger, so that a larger first critical value and a larger second critical value can be set to accurately judge the action mode. For example, the time distance may be positively correlated with the first threshold value, and the time distance may be positively correlated with the second threshold value. For example, due to the temporal distance d1Less than a time distance d2Therefore, when the motion mode between the first image 210 and the second image 220 is determined, the first threshold (or the second threshold) is smaller than the first threshold (or the second threshold) used when the motion mode between the second image 220 and the third image 230 is determined. In other words, the number of threshold values is multiplied by 2, and 6 or 8 threshold values can be set in total according to the description of the previous paragraph. In the embodiment, different threshold values are set according to the time interval and the operation mode, compared with the prior art that only fixed threshold values (only two threshold values) are used, the embodiment has at least the advantages of saving power consumption and accurately judging the operation mode.
The embodiment of fig. 2 is merely exemplary, and the time distance d may be set in some embodiments1Equal to the distance d in time2Or a time distance d1Greater than a time distance d2The invention is not limited thereto.
Referring to fig. 1, after the above-mentioned operation detection method is executed, the detection result is transmitted to the logic circuit 130, and the logic circuit 130 may execute any program according to the determination result, which is not limited herein. 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.
FIG. 4 is a flow chart illustrating a method of motion detection according to one 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, wherein the first blocks correspond to the second blocks respectively. In step 402, a block difference value between each first block and the corresponding second block is calculated, and whether the block difference value is greater than a first threshold is determined. In step 403, the number of difference blocks is calculated, wherein 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 threshold. 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 the dynamic mode. If the result of step 404 is negative, it is determined in step 406 that the operation mode is the static mode. However, the steps in fig. 4 have been described in detail above, and are not described again here. It is to be noted that, the steps in fig. 4 can be implemented as a plurality of program codes or circuits, and the invention is not limited thereto. In addition, the method of fig. 4 may be used with the above embodiments, or may be used alone, in other words, other steps may be added between the steps of fig. 4.
Although the present invention has been described with reference to the above embodiments, it should be understood that various changes and modifications can be made therein by those skilled in the art without departing from the spirit and scope of the invention.

Claims (10)

1. An image motion detection method is suitable for an electronic device, and comprises the following steps:
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, wherein the plurality of first blocks correspond to the plurality of second blocks respectively;
calculating a block difference value between each first block and the corresponding second block, and judging whether the block difference value is greater than a first critical value;
calculating the number of difference blocks, wherein the number of difference blocks indicates that the difference values of several blocks in the first image or the second image are greater than the first critical value; and
if the number of difference blocks is greater than a second threshold, determining that an operation mode is a dynamic mode, otherwise, the operation mode is a static mode, wherein the second threshold in the dynamic mode is equal to the second threshold in the static mode while the first threshold in the dynamic mode is less than the first threshold in the static mode, or the second threshold in the dynamic mode is less than the second threshold in the static mode while the first threshold in the dynamic mode is equal to the first threshold in the static mode.
2. The method of claim 1, wherein the step of calculating the block difference between each of the first blocks and the corresponding second block comprises:
calculating a first histogram for pixels within each of the first blocks;
calculating a second histogram for pixels within each of the second blocks; and
and calculating the difference between each first histogram and the corresponding second histogram as the block difference value.
3. The motion detection method according to claim 2, wherein the block difference value is a sum of absolute differences.
4. The motion detection method according to claim 1, further comprising:
setting the first threshold or the second threshold according to a time distance between the first image and the second image, wherein the time distance is positively correlated with the first threshold or the time distance is positively correlated with the second threshold.
5. The motion detection method according to claim 1, further comprising:
and judging the action mode between the second image and a third image, wherein 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.
6. An electronic device, comprising:
starting the sensor forever to obtain 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 second image into a plurality of second blocks, wherein the plurality of first blocks correspond to the plurality of second blocks respectively,
wherein the arithmetic circuit is used for calculating the block difference value between each first block and the corresponding second block and judging whether the block difference value is larger than a first critical value or not,
the arithmetic circuit is used for calculating the number of difference blocks, the number of difference blocks indicates that the difference values of a plurality of blocks in the first image or the second image are larger than the first critical value,
if the number of difference blocks is greater than a second threshold, the operation circuit determines that an operation mode is a dynamic mode, otherwise the operation mode is a static mode, wherein the second threshold in the dynamic mode is equal to the second threshold in the static mode while the first threshold in the dynamic mode is less than the first threshold in the static mode, or the second threshold in the dynamic mode is less than the second threshold in the static mode while the first threshold in the dynamic mode is equal to the first threshold in the static mode.
7. The electronic device of claim 6, wherein the arithmetic circuitry is further configured to compute a first histogram for pixels within each of the first blocks, compute a second histogram for pixels within each of the second blocks, and compute a difference between each of the first histograms and the corresponding second histograms as the block difference value.
8. The electronic device of claim 7, wherein the block difference value is a sum of absolute differences.
9. The electronic device of claim 6, wherein the arithmetic circuit is further configured to set the first threshold or the second threshold according to a time distance between the first image and the second image, wherein the time distance is positively correlated to the first threshold or the time distance is positively correlated to the second threshold.
10. The electronic device of claim 6, wherein the arithmetic circuit is further configured to determine the operation mode between the second image and a third image, wherein a temporal distance between the first image and the second image is smaller than a temporal distance between the second image and the third image.
CN201810352698.1A 2018-04-19 2018-04-19 Image motion detection method and electronic device Active CN110392182B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810352698.1A CN110392182B (en) 2018-04-19 2018-04-19 Image motion detection method and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810352698.1A CN110392182B (en) 2018-04-19 2018-04-19 Image motion detection method and electronic device

Publications (2)

Publication Number Publication Date
CN110392182A CN110392182A (en) 2019-10-29
CN110392182B true CN110392182B (en) 2022-04-26

Family

ID=68283447

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810352698.1A Active CN110392182B (en) 2018-04-19 2018-04-19 Image motion detection method and electronic device

Country Status (1)

Country Link
CN (1) CN110392182B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060209957A1 (en) * 2002-11-26 2006-09-21 Koninklijke Philips Electronics N.V. Motion sequence pattern detection
CN102881260A (en) * 2009-09-16 2013-01-16 致伸科技股份有限公司 Image processing method and device
CN104967848A (en) * 2015-06-16 2015-10-07 谢维波 Scene analysis algorithm applied in network video monitoring system
CN106937090A (en) * 2017-04-01 2017-07-07 广东浪潮大数据研究有限公司 The method and device of a kind of video storage

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060209957A1 (en) * 2002-11-26 2006-09-21 Koninklijke Philips Electronics N.V. Motion sequence pattern detection
CN102881260A (en) * 2009-09-16 2013-01-16 致伸科技股份有限公司 Image processing method and device
CN104967848A (en) * 2015-06-16 2015-10-07 谢维波 Scene analysis algorithm applied in network video monitoring system
CN106937090A (en) * 2017-04-01 2017-07-07 广东浪潮大数据研究有限公司 The method and device of a kind of video storage

Also Published As

Publication number Publication date
CN110392182A (en) 2019-10-29

Similar Documents

Publication Publication Date Title
CN106878668B (en) Movement detection of an object
US10445590B2 (en) Image processing apparatus and method and monitoring system
KR100670003B1 (en) The apparatus for detecting the homogeneous region in the image using the adaptive threshold value
US20150146006A1 (en) Display control apparatus and display control method
KR20220143967A (en) Generating static images with an event camera
CN110325951B (en) Finger touch classification method according to finger pressure and fingerprint sensing system
KR20180014572A (en) Method for processing event signal and event-based sensor performing the same
JP2008241707A (en) Automatic monitoring system
CN100375530C (en) Movement detecting method
CN110573990A (en) Ultra low power mode for low cost force sensing devices
US20170061184A1 (en) Portable electronic device and operation method thereof
WO2017028047A1 (en) Background model extracting method and apparatus and image processing device
CN110392182B (en) Image motion detection method and electronic device
JP4717445B2 (en) Image processing system, image processing device, game device, program, information storage medium, and image processing method
CN107992361B (en) Background application cleaning method and device, storage medium and electronic equipment
JP4664878B2 (en) Image processing device
CN107943536B (en) Method and device for adjusting threshold, storage medium and electronic equipment
CN109963075B (en) Intelligent motion detection device and related judgment method thereof
US10916016B2 (en) Image processing apparatus and method and monitoring system
US20200065979A1 (en) Imaging system and method with motion detection
TWI663575B (en) Method and electrical device for image motion detection
TWI632504B (en) Method and electronic apparatus for wave detection
CN112927258A (en) Target tracking method and device
CN109844686B (en) Electronic device, power saving control method, and recording medium
CN112437274B (en) Transmission method of snapshot picture and snapshot machine

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant