CN113873097A - Motion detection method and device, storage medium and electronic equipment - Google Patents

Motion detection method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN113873097A
CN113873097A CN202111133842.0A CN202111133842A CN113873097A CN 113873097 A CN113873097 A CN 113873097A CN 202111133842 A CN202111133842 A CN 202111133842A CN 113873097 A CN113873097 A CN 113873097A
Authority
CN
China
Prior art keywords
image blocks
image
region
total number
interest
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.)
Pending
Application number
CN202111133842.0A
Other languages
Chinese (zh)
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.)
Beijing Ziguang Zhanrui Communication Technology Co Ltd
Original Assignee
Beijing Ziguang Zhanrui Communication Technology Co 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 Beijing Ziguang Zhanrui Communication Technology Co Ltd filed Critical Beijing Ziguang Zhanrui Communication Technology Co Ltd
Priority to CN202111133842.0A priority Critical patent/CN113873097A/en
Publication of CN113873097A publication Critical patent/CN113873097A/en
Pending legal-status Critical Current

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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/61Control of cameras or camera modules based on recognised objects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/667Camera operation mode switching, e.g. between still and video, sport and normal or high- and low-resolution modes

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention provides a motion detection method and device, a storage medium and electronic equipment. The method comprises the following steps: if the total number of the obtained moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a first condition, determining that the current scene is a global moving scene, and starting a slow recording mode; if the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a second condition, the current scene is determined to be a local moving scene, and a slow recording mode is started. According to the technical scheme provided by the embodiment of the invention, whether a moving object exists in the current scene can be effectively judged, if the moving object exists, a slow recording mode is started, and the efficiency of motion detection is improved.

Description

Motion detection method and device, storage medium and electronic equipment
[ technical field ] A method for producing a semiconductor device
The present invention relates to the field of video processing technologies, and in particular, to a motion detection method and apparatus, a storage medium, and an electronic device.
[ background of the invention ]
In the related art, the motion detection methods are mainly classified into two categories. One is to use the traditional method, and the other is to use the Artificial Intelligence (AI) recognition method.
According to the traditional method, whether a moving object exists in a scene is judged according to the movement speed of the target object, the position data of the target object in two adjacent frames of images is firstly obtained, the relative displacement of the target object is calculated according to the position data of the target object in the two adjacent frames of images, and the movement speed of the target object is calculated according to the relative displacement of the target object, so that the complexity of calculating the movement speed of the target object is high, the time consumption of movement detection is long, and the efficiency of movement detection is reduced.
The AI identification method needs to prepare a large amount of comprehensive training sets for training to obtain a better motion detection result, so that the time consumption of motion detection is long, and the efficiency of motion detection is reduced.
[ summary of the invention ]
In view of this, embodiments of the present invention provide a motion detection method, a motion detection apparatus, a storage medium, and an electronic device, so as to improve motion detection efficiency.
In one aspect, an embodiment of the present invention provides a motion detection method, including:
judging whether the total number of the obtained moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region meet a first condition or a second condition;
if the total number of the obtained moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a first condition, determining that the current scene is a global moving scene, and starting a slow recording mode;
if the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a second condition, the current scene is determined to be a local moving scene, and a slow recording mode is started.
Optionally, the method further comprises:
if the total number of the motion image blocks in the non-interesting area, the total number of the motion image blocks in the interesting area and the total number of the image blocks in the interesting area are judged not to meet the first condition and the second condition, whether the current scene is a global moving scene or not is judged according to the total number of the moving image blocks in the obtained large image blocks;
and if the current scene is judged to be the global moving scene, the slow recording mode is forbidden.
Optionally, before determining whether the obtained total number of moving image blocks in the non-region of interest, the total number of moving image blocks in the region of interest, and the total number of image blocks in the region of interest satisfy the first condition or the second condition, the method includes:
judging whether the current scene is an illumination change scene or not according to the obtained average brightness of the current frame image and the average brightness of the previous frame image;
if the current scene is judged to be an illumination change scene, the slow recording mode is forbidden;
and if the current scene is judged not to be the illumination change scene, continuing to execute the step of judging whether the total number of the motion image blocks in the non-interesting region, the total number of the motion image blocks in the image blocks of the interesting region and the total number of the image blocks of the interesting region meet the first condition or the second condition.
Optionally, the first condition comprises:
the first numerical value is greater than the second numerical value and the third numerical value is greater than the fourth numerical value, the first numerical value is the total number of the motion image blocks in the acquired region of non-interest, the second numerical value is the product of the total number of the acquired image blocks in the region of non-interest and the set global motion image block high threshold, the third numerical value is the total number of the motion image blocks in the acquired image blocks in the region of interest, and the fourth numerical value is the product of the total number of the acquired image blocks in the region of interest and the set local motion image block threshold.
Optionally, the second condition comprises:
the first numerical value is smaller than the second numerical value and the third numerical value is larger than the fourth numerical value, the first numerical value is the total number of the acquired moving image blocks in the region of non-interest, the second numerical value is the product of the total number of the acquired image blocks in the region of non-interest and the set global moving image block high threshold, the third numerical value is the total number of the acquired moving image blocks in the region of interest, and the fourth numerical value is the product of the total number of the acquired image blocks in the region of interest and the set local moving image block threshold.
Optionally, the determining whether the current scene is a global moving scene according to the total number of moving image blocks in the obtained large image block includes:
judging whether the total number of the mobile image blocks in the obtained large image blocks is greater than a set global mobile image block threshold or not;
and if the total number of the mobile image blocks in the obtained large image blocks is judged to be larger than the set global mobile image block threshold, judging that the current scene is a global mobile scene.
Optionally, the determining whether the current scene is an illumination change scene according to the obtained average brightness of the current frame image and the average brightness of the previous frame image includes:
judging whether the acquired fifth numerical value is larger than an acquired sixth numerical value, wherein the fifth numerical value is an absolute value of a difference between the average brightness of the acquired current frame image and the average brightness of the previous frame image, and the sixth numerical value is a product value of a set illumination change threshold, the acquired width value of each image block and the acquired height value of each image block;
and if the fifth numerical value is larger than the sixth numerical value, judging that the current scene is an illumination change scene.
Optionally, before the determining whether the acquired total number of moving image blocks in the non-region of interest, the total number of moving image blocks in the region of interest, and the total number of image blocks in the region of interest satisfy the first condition or the second condition, the method includes:
generating inter-frame difference of image blocks of the non-interesting area according to the brightness information of the image blocks of the non-interesting area of the current frame image and the brightness information of the image blocks of the non-interesting area of the previous frame image;
judging whether the inter-frame difference of the image blocks of the non-interesting area is larger than a set global motion threshold or not;
if the inter-frame difference of the image blocks of the non-interesting region is judged to be larger than the set global motion threshold, marking the image blocks of the non-interesting region as motion image blocks;
and counting the total number of the motion image blocks in the non-interested region according to the marked motion image blocks.
Optionally, before the determining whether the obtained total number of the moving image blocks in the non-region of interest, the total number of the moving image blocks in the region of interest, and the total number of the image blocks in the region of interest satisfy the first condition or the second condition, the method further includes:
generating inter-frame difference of image blocks of the region of interest according to the brightness information of the image blocks of the region of interest of the current frame image and the brightness information of the image blocks of the region of interest of the previous frame image;
judging whether the inter-frame difference of the image blocks of the region of interest is larger than a set local motion threshold;
if the inter-frame difference of the image blocks of the region of interest is judged to be larger than the set local motion threshold, marking the image blocks of the region of interest as motion image blocks;
and counting the total number of the motion image blocks in the region of interest according to the marked motion image blocks.
Optionally, the marking image blocks of the region of interest as moving image blocks includes:
dividing a first set number of image blocks of the obtained current frame image into a second set number of large image blocks;
generating the total number of moving image blocks in the large image block according to the total number of moving image blocks in the non-region of interest and the total number of moving image blocks in the region of interest;
judging whether the total number of the moving image blocks in the large image block is greater than a set global movement threshold or not;
if the total number of the moving image blocks in the large image block is judged to be larger than the set global movement threshold, the moving image blocks in the large image block are marked as moving image blocks;
and counting the total number of the moving image blocks in the large image block according to the marked moving image blocks.
Optionally, the generating the inter-frame difference of the image block of the non-interest region according to the luminance information of the image block of the non-interest region of the current frame image and the luminance information of the image block of the non-interest region of the previous frame image comprises:
acquiring a plurality of first channel values, a plurality of second channel values and a plurality of third channel values of an image block of a non-interesting area of a current frame image;
generating a first channel mean value, a second channel mean value and a third channel mean value according to a plurality of first channel values, a plurality of second channel values and a plurality of third channel values of an image block of a non-interesting area of a current frame image;
and generating the brightness information of the image blocks of the non-interested area of the current frame image according to the first channel mean value, the second channel mean value and the third channel mean value.
Optionally, before generating the inter-frame difference of the image block of the non-interest region according to the luminance information of the image block of the non-interest region of the current frame image and the luminance information of the image block of the non-interest region of the previous frame image, the method further includes:
acquiring a plurality of fourth channel values, a plurality of fifth channel values and a plurality of sixth channel values of image blocks of a non-interesting region of a previous frame of image;
generating a fourth channel mean value, a fifth channel mean value and a sixth channel mean value according to a plurality of fourth channel values, a plurality of fifth channel values and a plurality of sixth channel values of the image block of the non-interesting region of the previous frame of image;
and generating the brightness information of the image blocks of the non-interested area of the previous frame of image according to the fourth channel mean value, the fifth channel mean value and the sixth channel mean value.
Optionally, the generating the inter-frame difference of the image block of the region of interest according to the luminance information of the image block of the region of interest of the current frame image and the luminance information of the image block of the region of interest of the previous frame image before includes:
acquiring a plurality of seventh channel values, a plurality of eighth channel values and a plurality of ninth channel values of an image block of an interested area of the current frame image;
generating a seventh channel mean value, an eighth channel mean value and a ninth channel mean value according to a plurality of seventh channel values, a plurality of eighth channel values and a plurality of ninth channel values of the image block of the region of interest of the current frame image;
and generating brightness information of the image blocks of the region of interest of the current frame image according to the seventh channel mean value, the eighth channel mean value and the ninth channel mean value.
Optionally, the generating the inter-frame difference of the image block of the region of interest according to the luminance information of the image block of the region of interest of the current frame image and the luminance information of the image block of the region of interest of the previous frame image before includes:
acquiring a plurality of tenth channel values, a plurality of eleventh channel values and a plurality of twelfth channel values of image blocks of the region of interest of the previous frame of image;
generating a tenth channel mean value, an eleventh channel mean value and a twelfth channel mean value according to the tenth channel values, the eleventh channel values and the twelfth channel values of the image block of the region of interest of the previous frame of image;
and generating brightness information of image blocks of the region of interest of the previous frame of image according to the tenth channel mean value, the eleventh channel mean value and the twelfth channel mean value.
Optionally, the determining, according to the obtained average brightness of the current frame image and the average brightness of the previous frame image, whether the current scene is an illumination change scene includes:
dividing the acquired current frame image into a first set number of image blocks;
acquiring a plurality of thirteenth channel values, a plurality of fourteenth channel values and a plurality of fifteenth channel values of each image block of the current frame image;
calculating a thirteenth channel mean value, a fourteenth channel mean value and a fifteenth channel mean value of each image block of the current frame image according to the plurality of thirteenth channel values, the plurality of fourteenth channel values and the plurality of fifteenth channel values of each image block of the current frame image;
generating brightness information of each image block of the current frame image according to the thirteenth channel mean value, the fourteenth channel mean value and the fifteenth channel mean value of each image block of the current frame image;
and generating the average brightness of the current frame image according to the brightness information of each image block of the current frame image.
Optionally, the determining, according to the obtained average brightness of the current frame image and the average brightness of the previous frame image, whether the current scene is an illumination change scene includes:
dividing the obtained previous frame image into a first set number of image blocks;
acquiring a plurality of sixteenth channel values, a plurality of seventeenth channel values and a plurality of eighteenth channel values of each image block of the previous frame of image;
calculating a sixteenth channel mean value, a seventeenth channel mean value and an eighteenth channel mean value of each image block of the previous frame image according to the sixteenth channel values, the seventeenth channel values and the eighteenth channel values of each image block of the previous frame image;
generating brightness information of each image block of the previous frame image according to the sixteenth channel mean value, the seventeenth channel mean value and the eighteenth channel mean value of each image block of the previous frame image;
and generating the average brightness of the previous frame image according to the brightness information of each image block of the previous frame image.
In another aspect, an embodiment of the present invention provides a motion detection apparatus, including:
the first judging module is used for judging whether the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region meet a first condition or a second condition; if the total number of the obtained moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a first condition, a first determining module is triggered to determine that the current scene is a global moving scene, and a slow recording mode is started; if the total number of the obtained moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a second condition, a second determining module is triggered to determine that the current scene is a local moving scene, and a slow recording mode is started.
In another aspect, an embodiment of the present invention provides a storage medium, including: the storage medium includes a stored program, wherein the apparatus on which the storage medium is located is controlled to execute one of the above-described motion detection methods when the program is executed.
In another aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, where the memory is used to store information including program instructions, and the processor is used to control execution of the program instructions, where the program instructions are loaded into and executed by the processor to implement the steps of the above-mentioned motion detection method.
In the technical scheme of the motion detection method provided by the embodiment of the invention, if the total number of the motion image blocks in the non-interesting region, the total number of the motion image blocks in the image blocks of the interesting region and the total number of the image blocks of the interesting region are judged to meet a first condition, the current scene is determined to be a global motion scene, and a slow recording mode is started; if the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a second condition, the current scene is determined to be a local moving scene, and a slow recording mode is started. According to the technical scheme provided by the embodiment of the invention, whether a moving object exists in the current scene can be effectively judged, if the moving object exists, a slow recording mode is started, and the efficiency of motion detection is improved.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
Fig. 1 is a flowchart of a motion detection method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another motion detection method provided by the embodiment of the invention;
fig. 3 is a schematic structural diagram of a motion detection apparatus according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an electronic device according to an embodiment of the present invention.
[ detailed description ] embodiments
For better understanding of the technical solutions of the present invention, the following detailed descriptions of the embodiments of the present invention are provided with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely one type of associative relationship that describes an associated object, meaning that three types of relationships may exist, e.g., A and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
An embodiment of the present invention provides a motion detection method, and fig. 1 is a flowchart of the motion detection method provided in the embodiment of the present invention, as shown in fig. 1, the method includes:
step 102, judging whether the total number of the obtained moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region meet a first condition or a second condition, and if the first condition is met, executing step 104; if the second condition is satisfied, go to step 106.
In an embodiment of the present invention, the first condition includes:
the first numerical value is greater than the second numerical value and the third numerical value is greater than the fourth numerical value, the first numerical value is the total number Of the motion image blocks in the acquired Region Of non-Interest, the second numerical value is the product Of the total number Of the acquired image blocks in the Region Of non-Interest and the set global motion image block high threshold, the third numerical value is the total number Of the motion image blocks in the acquired Region Of Interest (ROI), and the fourth numerical value is the product Of the total number Of the acquired image blocks in the Region Of Interest and the set local motion image block threshold.
In an embodiment of the present invention, the second condition includes:
the first numerical value is smaller than the second numerical value and the third numerical value is larger than the fourth numerical value, the first numerical value is the total number of the motion image blocks in the acquired region of non-interest, the second numerical value is the product of the total number of the image blocks in the acquired region of non-interest and the set global motion image block high threshold, the third numerical value is the total number of the motion image blocks in the acquired region of interest, and the fourth numerical value is the product of the total number of the image blocks in the acquired region of interest and the set local motion image block threshold.
And step 104, determining that the current scene is a global motion scene, starting a slow recording mode, and ending the process.
In the embodiment of the invention, if the current scene is determined to be the global motion scene, the situation that a large-area moving object exists in the shooting scene is indicated. For example, a large area of a moving object is a large area of water flow.
And 106, determining that the current scene is a local motion scene, and starting a slow recording mode.
In the embodiment of the invention, if the current scene is determined to be the local motion scene, it indicates that a moving object exists in the region of interest in the shooting scene.
In the technical scheme provided by the embodiment of the invention, if the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a first condition, the current scene is determined to be a global moving scene, and a slow recording mode is started; if the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a second condition, the current scene is determined to be a local moving scene, and a slow recording mode is started. According to the technical scheme provided by the embodiment of the invention, whether a moving object exists in the current scene can be effectively judged, if the moving object exists, a slow recording mode is started, and the efficiency of motion detection is improved.
An embodiment of the present invention provides another motion detection method, and fig. 2 is a flowchart of another motion detection method provided in an embodiment of the present invention, as shown in fig. 2, the method includes:
step 202, dividing the acquired current frame image into a first set number of image blocks.
In the embodiment of the present invention, step 202 includes: in response to a recording instruction input by a user, image data is acquired every set frame number. The image data includes a current frame image and a previous frame image.
In the embodiment of the invention, the set frame number can be set according to the actual situation, and the set frame number is related to the frame rate of the image data.
In the embodiment of the invention, the first set number can be set according to the actual situation. For example, the first set number is n × n.
Step 204, obtaining a plurality of thirteenth channel values, a plurality of fourteenth channel values and a plurality of fifteenth channel values of each image block of the current frame image.
In the embodiment of the present invention, each image block of the current frame image has a plurality of thirteenth channel values, a plurality of fourteenth channel values, and a plurality of fifteenth channel values.
The thirteenth channel value is a Red (Red, R for short), the fourteenth channel value is a Green (G for short), and the fifteenth channel value is a Blue (B for short).
Step 206, calculating a thirteenth channel mean value, a fourteenth channel mean value and a fifteenth channel mean value of each image block of the current frame image according to the plurality of thirteenth channel values, the plurality of fourteenth channel values and the plurality of fifteenth channel values of each image block of the current frame image.
In the embodiment of the present invention, the plurality of thirteenth channel values are added to generate a sum of thirteenth channel values, and the sum of thirteenth channel values is divided by the number of the plurality of thirteenth channel values to generate a thirteenth channel mean value. For example, let the thirteenth channel mean be blk _ r [ i ] [ j ], where i and j represent the number of rows and columns in which the n × n divided image blocks are located, respectively.
And adding the fourteenth channel values to generate a fourteenth channel value sum, and dividing the fourteenth channel value sum by the number of the fourteenth channel values to generate a fourteenth channel mean. For example, the fourteenth channel mean is denoted as blk _ g [ i ] [ j ].
And adding the fifteenth channel values to generate a fifteenth channel value sum, and dividing the fifteenth channel value sum by the number of the fifteenth channel values to generate a fifteenth channel average. For example, the fifteenth channel mean is denoted as blk _ b [ i ] [ j ].
And 208, generating the brightness information of each image block of the current frame image according to the thirteenth channel mean value, the fourteenth channel mean value and the fifteenth channel mean value of each image block of the current frame image.
Specifically, the thirteenth channel average value, the fourteenth channel average value, and the fifteenth channel average value of each image block of the current frame image are calculated by the formula blk _ y [ i ] [ j ] ═ blk _ r [ i ] [ j ] + blk _ g [ i ] [ j ] + blk _ b [ i ] [ j ], and luminance information of each image block of the current frame image is generated. Wherein, blk _ r [ i ] [ j ] is the thirteenth channel mean value, blk _ g [ i ] [ j ] is the fourteenth channel mean value, blk _ b [ i ] [ j ] is the fifteenth channel mean value, and blk _ y [ i ] [ j ] is the brightness information of each image block of the current frame image.
Step 210, generating an average brightness of the current frame image according to the brightness information of each image block of the current frame image.
In this step, the luminance information of each image block of the current frame image is added, and then divided by the number of image blocks in the current frame image, so as to generate the average luminance of the current frame image.
In particular, by the formula
Figure BDA0003281512680000121
And calculating the brightness information of each image block of the current frame image to generate the average brightness of the current frame image. Where ave _ y is the average luminance, blk _ y [ i ]][j]The luminance information of the (i, j) th image block is referred, n refers to the fact that the whole frame of image is divided into n parts in the horizontal direction and the vertical direction, and a frame of image is divided into n multiplied by n image blocks.
Step 212, dividing the acquired previous frame image into a first set number of image blocks.
And step 214, acquiring a plurality of sixteenth channel values, a plurality of seventeenth channel values and a plurality of eighteenth channel values of each image block of the previous frame image.
In the embodiment of the present invention, each image block of the current frame image has a plurality of sixteenth channel values, a plurality of seventeenth channel values, and a plurality of eighteenth channel values.
The sixteenth channel value is a Red (Red, R for short), the seventeenth channel value is a Green (G) channel value, and the eighteenth channel value is a Blue (B) channel value.
And step 216, calculating a sixteenth channel mean value, a seventeenth channel mean value and an eighteenth channel mean value of each image block of the previous frame image according to the sixteenth channel values, the seventeenth channel values and the eighteenth channel values of each image block of the previous frame image.
And step 218, generating the brightness information of each image block of the previous frame image according to the sixteenth channel average value, the seventeenth channel average value and the eighteenth channel average value of each image block of the previous frame image.
And step 220, generating the average brightness of the previous frame of image according to the brightness information of each image block of the previous frame of image.
In the embodiment of the present invention, the calculation manner of steps 212 to 220 is the same as the calculation manner of steps 202 to 210, and is not described herein again.
Step 222, judging whether the current scene is an illumination change scene or not according to the obtained average brightness of the current frame image and the average brightness of the previous frame image, and if so, executing step 224; if not, go to step 226.
Specifically, whether the acquired fifth numerical value is larger than the acquired sixth numerical value is judged, wherein the fifth numerical value is an absolute value of a difference between the average brightness of the acquired current frame image and the average brightness of the previous frame image, and the sixth numerical value is a product value of a set illumination change threshold, the acquired width value of each image block and the acquired height value of each image block; if yes, determining that the current scene is an illumination change scene, and executing step 224; if not, the current scene is determined not to be the illumination change scene, and step 226 is executed.
Specifically, if abs (ave _ y)pre-ave_ycur)>ill_change×bAnd if the lk _ width is multiplied by blk _ height, the current scene is judged to be an illumination change scene. Wherein abs (ave _ y)pre-ave_ycur) Is a fifth value, ill _ change × blk _ width × blk _ height is a sixth value, ave _ ypreAverage luminance of the previous frame image, ave _ ycurAnd ill _ change is the average brightness of the current frame image, and is an illumination change threshold, blk _ width is the width value of each image block, and blk _ height is the height value of each image block.
In the embodiment of the invention, the illumination change threshold can be set according to actual conditions.
And step 224, disabling the slow recording mode, and ending the process.
Step 226, obtaining a plurality of first channel values, a plurality of second channel values and a plurality of third channel values of the image block of the non-interesting area of the current frame image.
In the embodiment of the invention, the current frame image is divided into the interested area and the non-interested area.
In the embodiment of the invention, each image block of the non-interesting area of the current frame image has a plurality of first channel values, a plurality of second channel values and a plurality of third channel values.
The first channel value is a Red (Red, R for short), the second channel value is a Green (G) channel value, and the third channel value is a Blue (Blue, B for short).
Step 228, generating a first channel mean value, a second channel mean value and a third channel mean value according to the plurality of first channel values, the plurality of second channel values and the plurality of third channel values of the image block of the non-interesting area of the current frame image.
And step 230, generating brightness information of the image blocks of the non-interesting area of the current frame image according to the first channel mean value, the second channel mean value and the third channel mean value.
Step 232, obtaining a plurality of fourth channel values, a plurality of fifth channel values and a plurality of sixth channel values of the image blocks of the non-interesting region of the previous frame of image.
And step 234, generating a fourth channel mean value, a fifth channel mean value and a sixth channel mean value according to the plurality of fourth channel values, the plurality of fifth channel values and the plurality of sixth channel values of the image block of the non-interesting region of the previous frame of image.
And step 236, generating the brightness information of the image block of the non-interesting area of the previous frame of image according to the fourth channel mean value, the fifth channel mean value and the sixth channel mean value.
In the embodiment of the present invention, the calculation manner of steps 226 to 236 is the same as the calculation manner of steps 202 to 210, and is not described herein again.
Step 238, a plurality of seventh channel values, a plurality of eighth channel values and a plurality of ninth channel values of the image block of the region of interest of the current frame image are obtained.
In the embodiment of the present invention, each image block of the non-region of interest of the current frame image has a plurality of seventh channel values, a plurality of eighth channel values, and a plurality of ninth channel values.
The seventh channel value is a Red (Red, R) channel value, the eighth channel value is a Green (G) channel value, and the ninth channel value is a Blue (B) channel value.
And 240, generating a seventh channel mean value, an eighth channel mean value and a ninth channel mean value according to the plurality of seventh channel values, the plurality of eighth channel values and the plurality of ninth channel values of the image block of the region of interest of the current frame image.
And 242, generating brightness information of the image block of the region of interest of the current frame image according to the seventh channel mean value, the eighth channel mean value and the ninth channel mean value.
And 244, acquiring a plurality of tenth channel values, a plurality of eleventh channel values and a plurality of twelfth channel values of the image block of the region of interest of the previous frame of image.
Step 246, generating a tenth channel mean value, an eleventh channel mean value and a twelfth channel mean value according to the tenth channel values, the eleventh channel values and the twelfth channel values of the image block of the region of interest of the previous frame image.
And step 248, generating the brightness information of the image block of the region of interest of the previous frame of image according to the tenth channel mean value, the eleventh channel mean value and the twelfth channel mean value.
In the embodiment of the present invention, the calculation manner of steps 238 to 248 is the same as the calculation manner of steps 202 to 210, and is not described herein again.
And step 250, generating inter-frame difference of the image blocks of the non-interest region according to the brightness information of the image blocks of the non-interest region of the current frame image and the brightness information of the image blocks of the non-interest region of the previous frame image.
In particular, by the formula diff [ i ]][j]=abs(blk_ycur[i][j]-blk_ypre[i][j]) And calculating the brightness information of the image blocks of the non-interested area of the current frame image and the brightness information of the image blocks of the non-interested area of the previous frame image to generate the inter-frame difference of the image blocks of the non-interested area. Wherein blk _ ycur[i][j]Is the luminance information, blk _ y, of the image block of the region of non-interest of the current frame imagepre[i][j]Luminance information, diff [ i ], for image blocks of a region of non-interest of the previous frame image][j]Is the inter-frame difference of the image blocks of the non-interesting area.
Step 252, judging whether the inter-frame difference of the image blocks of the non-interesting region is greater than a set global motion threshold, if so, executing step 256; if not, go to step 254.
According to the embodiment of the invention, the global motion threshold can be set according to the actual situation.
In the embodiment of the present invention, the image block weight of the image block in the region of non-interest is less than 50%.
In particular, by the formula
Figure BDA0003281512680000151
And calculating the width value of each image block, the height value of each image block, the width value of the (i, j) th image block in the region of interest and the height value of the (i, j) th image block in the region of interest to generate an image block weight. Wherein blk _ w [ i][j]For the image block weights, blk _ width is the width value of each image block, blk _ height is the height value of each image block, w _ in [ i [ i ] ]][j]Is the width value of the (i, j) th image block in the region of interest, h _ in [ i [ ] i][j]Is a firsti, j) height values of the image blocks in the region of interest.
In the embodiment of the present invention, if it is determined that the inter-frame difference of the image block of the non-interesting region is greater than the set global motion threshold, it indicates that the image block is a moving image block, and step 256 is executed; if the inter-frame difference of the image blocks in the region of non-interest is determined to be less than or equal to the set global motion threshold, it indicates that the image block is a non-moving image block, and step 254 is executed.
Step 254, mark the image blocks of the non-region of interest as non-moving image blocks.
And step 256, marking the image blocks of the non-interesting area as moving image blocks.
And step 258, counting the total number of the motion image blocks in the non-interesting area according to the marked motion image blocks.
In this step, the counted total number of the motion image blocks in the non-region of interest is recorded as num _ exc.
And step 260, generating inter-frame difference of the image blocks of the region of interest according to the brightness information of the image blocks of the region of interest of the current frame image and the brightness information of the image blocks of the region of interest of the previous frame image.
In the embodiment of the present invention, the calculation manner of step 260 is the same as the calculation manner of step 250, and is not described herein again.
Step 262, judging whether the inter-frame difference of the image blocks of the region of interest is greater than a set local motion threshold, if so, executing step 266; if not, go to step 264.
According to the embodiment of the invention, the local motion threshold can be set according to the actual situation.
In the embodiment of the invention, the image block weight of the image block of the non-interesting area is more than 50%.
In the embodiment of the present invention, if it is determined that the inter-frame difference of the image block of the region of interest is greater than the set local motion threshold, it indicates that the image block is a moving image block, and step 266 is executed; if the inter-frame difference of the image blocks in the region of interest is determined to be less than or equal to the set local motion threshold, it indicates that the image block is a non-moving image block, and step 264 is executed.
Step 264, mark the image block of the region of interest as a non-moving image block.
Step 266, mark the image block of the region of interest as a moving image block.
And 268, counting the total number of the moving image blocks in the region of interest according to the marked moving image blocks.
In this step, the counted total number of the moving image blocks in the region of interest is recorded as num _ roi.
Step 270, dividing the first set number of image blocks of the obtained current frame image into a second set number of large image blocks.
In the embodiment of the invention, the second set number can be set according to the actual situation. For example, the second set number is 4 × 4.
As an alternative, n × n image blocks of the acquired current frame image are divided into 4 × 4 large image blocks.
And 272, generating the total number of the moving image blocks in the large image block according to the total number of the moving image blocks in the non-region of interest and the total number of the moving image blocks in the region of interest.
In this step, the total number of moving image blocks in the large image block is recorded according to the total number of moving image blocks in the region of non-interest and the total number of moving image blocks in the region of interest, and the total number of moving image blocks in the large image block is recorded as blk _ num [ p ] [ q ].
Step 274, determining whether the total number of the moving image blocks in the large image block is greater than a set global movement threshold, if so, executing step 278; if not, go to step 276.
According to the embodiment of the invention, the global moving threshold can be set according to the actual situation.
In the embodiment of the present invention, if it is determined that the total number of moving image blocks in a large image block is greater than the set global movement threshold, it indicates that the image block is a moving image block, step 278 is executed; if the total number of moving image blocks in the large image block is determined to be less than or equal to the set global motion threshold, it indicates that the image block is a non-moving image block, and step 276 is executed.
Step 276, mark the moving image block in the large image block as a non-moving image block.
Step 278, mark the moving image block in the large image block as a moving image block.
Step 280, counting the total number of the moving image blocks in the large image block according to the marked moving image blocks.
In this step, the counted total number of moving image blocks in the large image block is recorded as num _ move.
282, judging whether the total number of the obtained moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region meet a first condition or a second condition, and if the first condition is met, executing 284; if the second condition is satisfied, go to step 286; if the first condition and the second condition are not satisfied, step 288 is executed.
In an embodiment of the present invention, the first condition includes:
the first numerical value is larger than the second numerical value and the third numerical value is larger than the fourth numerical value, the first numerical value is the total number of the motion image blocks in the acquired region of non-interest, the second numerical value is the product of the total number of the acquired image blocks in the region of non-interest and the set global motion image block high threshold, the third numerical value is the total number of the motion image blocks in the acquired image blocks in the region of interest, and the fourth numerical value is the product of the total number of the acquired image blocks in the region of interest and the set local motion image block threshold.
In an embodiment of the present invention, the second condition includes:
the first numerical value is smaller than the second numerical value and the third numerical value is larger than the fourth numerical value, the first numerical value is the total number of the motion image blocks in the acquired region of non-interest, the second numerical value is the product of the total number of the image blocks in the acquired region of non-interest and the set global motion image block high threshold, the third numerical value is the total number of the motion image blocks in the acquired region of interest, and the fourth numerical value is the product of the total number of the image blocks in the acquired region of interest and the set local motion image block threshold.
Step 284, determine that the current scene is a global motion scene, and start the slow recording mode, and the process ends.
In the embodiment of the invention, if the current scene is determined to be the global motion scene, the situation that a large-area moving object exists in the shooting scene is indicated. For example, a large area of a moving object is a large area of water flow.
And 286, determining that the current scene is a local motion scene, starting a slow recording mode, and ending the process.
In the embodiment of the invention, if the current scene is determined to be the local motion scene, it indicates that a moving object exists in the region of interest in the shooting scene.
288, determining whether the current scene is a global moving scene according to the total number of the moving image blocks in the obtained large image block, if so, executing step 224; if not, go to step 202.
Specifically, judging whether the total number of the mobile image blocks in the acquired large image blocks is greater than a set global mobile image block threshold; and if the total number of the mobile image blocks in the obtained large image blocks is judged to be larger than the set global mobile image block threshold, judging that the current scene is a global mobile scene.
In the embodiment of the present invention, if it is determined that the current scene is a global moving scene, it indicates that there is no moving object in the shooting scene but the shooting device moves, and step 224 is executed; if the current scene is determined not to be the global moving scene, it indicates that the current scene is not the global moving scene, and step 202 is executed.
In the embodiment of the invention, when a moving object is detected, the motion detection is finished and the slow recording mode is started, otherwise, the step 202 is returned to continue the motion detection until the user stops recording.
In the technical scheme provided by the embodiment of the invention, if the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a first condition, the current scene is determined to be a global moving scene, and a slow recording mode is started; if the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a second condition, the current scene is determined to be a local moving scene, and a slow recording mode is started. According to the technical scheme provided by the embodiment of the invention, whether a moving object exists in the current scene can be effectively judged, if the moving object exists, a slow recording mode is started, and the efficiency of motion detection is improved.
According to the technical scheme provided by the embodiment of the invention, whether a moving object exists in the shot picture of the electronic equipment can be effectively detected, the time complexity is relatively low, and the real-time requirement under the mode is met to a higher degree.
In the technical scheme provided by the embodiment of the invention, a Bayer image data stream acquired by a CMOS image sensor can be used as input, and the Bayer data of adjacent frames are counted and compared to determine whether a moving object exists in the current scene so as to determine whether the electronic equipment starts a slow recording mode or not.
The technical scheme provided by the embodiment of the invention has lower algorithm complexity, does not need to process each frame of image, can meet the requirement of real-time detection to a higher degree, supports the distinguishing of two conditions of moving objects and global movement, and can effectively improve the recording experience of users.
The embodiment of the invention provides a motion detection device. Fig. 3 is a schematic structural diagram of a motion detection apparatus according to an embodiment of the present invention, as shown in fig. 3, the apparatus includes: a first judging module 11, a first determining module 12 and a second determining module 13.
The first judging module 11 is configured to judge whether the total number of the acquired moving image blocks in the region of non-interest, the total number of the moving image blocks in the region of interest, and the total number of the image blocks in the region of interest satisfy a first condition or a second condition; if the total number of the motion image blocks in the non-interesting region, the total number of the motion image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a first condition, triggering the first determining module 12 to determine that the current scene is a global motion scene, and starting a slow recording mode; if the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet the second condition, the second determining module 13 is triggered to determine that the current scene is a local moving scene, and the slow recording mode is started.
In the embodiment of the present invention, the apparatus further includes: a second decision block 14.
The first judging module 11 is further configured to trigger the second judging module 14 to judge whether the current scene is a global moving scene according to the total number of moving image blocks in the acquired large image blocks if it is judged that the total number of the acquired moving image blocks in the non-region of interest, the total number of the moving image blocks in the region of interest, and the total number of the image blocks in the region of interest do not satisfy the first condition and the second condition; and if the current scene is judged to be the global moving scene, the slow recording mode is forbidden.
In the embodiment of the present invention, the apparatus further includes: and a third judging module 15.
The third judging module 15 is configured to judge whether the current scene is an illumination change scene according to the obtained average brightness of the current frame image and the average brightness of the previous frame image; if the current scene is judged to be an illumination change scene, the slow recording mode is forbidden; if the current scene is judged not to be the illumination change scene, the first judging module 11 is triggered to continue to execute the step of judging whether the total number of the motion image blocks in the non-interesting region, the total number of the motion image blocks in the interesting region and the total number of the image blocks in the interesting region meet the first condition or the second condition.
In an embodiment of the present invention, the first condition includes:
the first numerical value is greater than the second numerical value and the third numerical value is greater than the fourth numerical value, the first numerical value is the total number of the motion image blocks in the acquired region of non-interest, the second numerical value is the product of the total number of the acquired image blocks in the region of non-interest and the set global motion image block high threshold, the third numerical value is the total number of the motion image blocks in the acquired image blocks in the region of interest, and the fourth numerical value is the product of the total number of the acquired image blocks in the region of interest and the set local motion image block threshold.
In an embodiment of the present invention, the second condition includes:
the first numerical value is smaller than the second numerical value and the third numerical value is larger than the fourth numerical value, the first numerical value is the total number of the acquired moving image blocks in the region of non-interest, the second numerical value is the product of the total number of the acquired image blocks in the region of non-interest and the set global moving image block high threshold, the third numerical value is the total number of the acquired moving image blocks in the region of interest, and the fourth numerical value is the product of the total number of the acquired image blocks in the region of interest and the set local moving image block threshold.
In the embodiment of the present invention, the second determining module 14 is specifically configured to determine whether the total number of the mobile image blocks in the obtained large image block is greater than a set global mobile image block threshold; and if the total number of the mobile image blocks in the obtained large image blocks is judged to be larger than the set global mobile image block threshold, judging that the current scene is a global mobile scene.
In this embodiment of the present invention, the third determining module 15 is specifically configured to determine whether an acquired fifth numerical value is greater than an acquired sixth numerical value, where the fifth numerical value is an absolute value of a difference between an average luminance of an acquired current frame image and an average luminance of a previous frame image, and the sixth numerical value is a product value of a set illumination change threshold, an acquired width value of each image block, and a height value of each image block; and if the fifth numerical value is larger than the sixth numerical value, judging that the current scene is an illumination change scene.
In the embodiment of the present invention, the apparatus further includes: a first generation module 16, a fourth judgment module 17, a first marking module 18 and a first statistic module 19.
The first generating module 16 is configured to generate an inter-frame difference between image blocks of a non-interest region according to luminance information of the image blocks of the non-interest region of a current frame image and luminance information of the image blocks of the non-interest region of a previous frame image.
The fourth judging module 17 is configured to judge whether an inter-frame difference of the image block of the non-interesting region is greater than a set global motion threshold; if the inter-frame difference of the image blocks of the non-interesting area is judged to be larger than the set global motion threshold, the first marking module 18 is triggered to mark the image blocks of the non-interesting area as motion image blocks.
The first statistic module 19 is configured to count the total number of the motion image blocks in the region of non-interest according to the marked motion image blocks.
In the embodiment of the present invention, the apparatus further includes: a second generation module 20, a fifth judgment module 21, a second marking module 22 and a second statistic module 23.
The second generating module 20 is configured to generate an inter-frame difference between image blocks of the region of interest according to the luminance information of the image block of the region of interest of the current frame image and the luminance information of the image block of the region of interest of the previous frame image.
The fifth judging module 21 is configured to judge whether an inter-frame difference of the image block of the region of interest is greater than a set local motion threshold; if the inter-frame difference of the image blocks of the region of interest is judged to be greater than the set local motion threshold, the second marking module 22 is triggered to mark the image blocks of the region of interest as motion image blocks.
The second statistical module 23 is configured to perform statistics on the total number of the motion image blocks in the region of interest according to the marked motion image blocks.
In the embodiment of the present invention, the apparatus further includes: a first dividing module 24, a third generating module 25, a sixth judging module 26, a third marking module 27 and a third counting module 28.
The first dividing module 24 is configured to divide a first set number of image blocks of the acquired current frame image into a second set number of large image blocks.
The third generating module 25 is configured to generate the total number of moving image blocks in the large image block according to the total number of moving image blocks in the region of non-interest and the total number of moving image blocks in the region of interest.
The sixth determining module 26 is configured to determine whether the total number of the moving image blocks in the large image block is greater than a set global moving threshold; if the total number of the moving image blocks in the large image block is judged to be greater than the set global moving threshold, the third marking module 27 is triggered to mark the moving image blocks in the large image block as moving image blocks.
The third counting module 28 is configured to count the total number of moving image blocks in the large image block according to the marked moving image blocks.
In the embodiment of the present invention, the apparatus further includes: a first obtaining module 29, a fourth generating module 30 and a fifth generating module 31.
The first obtaining module 29 is configured to obtain a plurality of first channel values, a plurality of second channel values, and a plurality of third channel values of an image block of a non-region of interest of a current frame image.
The fourth generating module 30 is configured to generate a first channel mean value, a second channel mean value, and a third channel mean value according to the plurality of first channel values, the plurality of second channel values, and the plurality of third channel values of the image block of the non-interesting region of the current frame image.
The fifth generating module 31 is configured to generate luminance information of an image block of a non-interesting region of the current frame image according to the first channel mean value, the second channel mean value, and the third channel mean value.
In the embodiment of the present invention, the apparatus further includes: a second obtaining module 32, a sixth generating module 33 and a seventh generating module 34.
The second obtaining module 32 is configured to obtain a plurality of fourth channel values, a plurality of fifth channel values, and a plurality of sixth channel values of image blocks of a non-region of interest of a previous frame of image.
The sixth generating module 33 is configured to generate a fourth channel mean value, a fifth channel mean value, and a sixth channel mean value according to a plurality of fourth channel values, a plurality of fifth channel values, and a plurality of sixth channel values of an image block of a non-region of interest of a previous frame of image.
The seventh generating module 34 is configured to generate luminance information of an image block of a non-region of interest of the previous frame of image according to the fourth channel mean value, the fifth channel mean value, and the sixth channel mean value.
In the embodiment of the present invention, the apparatus further includes: a third obtaining module 35, an eighth generating module 36 and a ninth generating module 37.
The third obtaining module 35 is configured to obtain a plurality of seventh channel values, a plurality of eighth channel values, and a plurality of ninth channel values of an image block of the region of interest of the current frame image.
The eighth generating module 36 is configured to generate a seventh channel mean value, an eighth channel mean value, and a ninth channel mean value according to the multiple seventh channel values, the multiple eighth channel values, and the multiple ninth channel values of the image block of the region of interest of the current frame image.
The ninth generating module 37 is configured to generate luminance information of an image block of the region of interest of the current frame image according to the seventh channel mean value, the eighth channel mean value, and the ninth channel mean value.
In the embodiment of the present invention, the apparatus further includes: a fourth obtaining module 38, a tenth generating module 39 and an eleventh generating module 40.
The fourth obtaining module 38 is configured to obtain a plurality of tenth channel values, a plurality of eleventh channel values, and a plurality of twelfth channel values of image blocks of the region of interest of the previous frame image.
The tenth generating module 39 is configured to generate a tenth channel mean value, an eleventh channel mean value, and a twelfth channel mean value according to the tenth channel values, the eleventh channel values, and the twelfth channel values of the image block of the region of interest of the previous frame image.
The eleventh generating module 40 is configured to generate luminance information of an image block of the region of interest of the previous frame image according to the tenth channel mean value, the eleventh channel mean value, and the twelfth channel mean value.
In the embodiment of the present invention, the apparatus further includes: a second dividing module 41, a fifth obtaining module 42, a first calculating module 43, a twelfth generating module 44 and a thirteenth generating module 45.
The second dividing module 41 is configured to divide the acquired current frame image into a first set number of image blocks.
The fifth obtaining module 42 is configured to obtain a plurality of thirteenth channel values, a plurality of fourteenth channel values, and a plurality of fifteenth channel values for each image block of the current frame image.
The first calculating module 43 is configured to calculate a thirteenth channel mean value, a fourteenth channel mean value, and a fifteenth channel mean value of each image block of the current frame image according to the plurality of thirteenth channel values, the plurality of fourteenth channel values, and the plurality of fifteenth channel values of each image block of the current frame image.
The twelfth generating module 44 is configured to generate luminance information of each image block of the current frame image according to the thirteenth channel mean value, the fourteenth channel mean value, and the fifteenth channel mean value of each image block of the current frame image.
The thirteenth generating module 45 is configured to generate an average luminance of the current frame image according to the luminance information of each image block of the current frame image.
In the embodiment of the present invention, the apparatus further includes: a third dividing module 46, a sixth obtaining module 47, a second calculating module 48, a fourteenth generating module 49 and a fifteenth generating module 50.
The third dividing module 46 is configured to divide the acquired previous frame image into a first set number of image blocks.
The sixth obtaining module 47 is configured to obtain a plurality of sixteenth channel values, a plurality of seventeenth channel values, and a plurality of eighteenth channel values of each image block of the previous frame image.
The second calculating module 48 is configured to calculate a sixteenth channel mean value, a seventeenth channel mean value, and an eighteenth channel mean value of each image block of the previous frame image according to the sixteenth channel values, the seventeenth channel values, and the eighteenth channel values of each image block of the previous frame image.
The fourteenth generating module 49 is configured to generate luminance information of each image block of the previous frame image according to the sixteenth channel mean value, the seventeenth channel mean value and the eighteenth channel mean value of each image block of the previous frame image.
The fifteenth generating module 50 is configured to generate an average luminance of the previous frame image according to the luminance information of each image block of the previous frame image.
In the technical scheme provided by the embodiment of the invention, if the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a first condition, the current scene is determined to be a global moving scene, and a slow recording mode is started; if the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a second condition, the current scene is determined to be a local moving scene, and a slow recording mode is started. According to the technical scheme provided by the embodiment of the invention, whether a moving object exists in the current scene can be effectively judged, if the moving object exists, a slow recording mode is started, and the efficiency of motion detection is improved.
The motion detection apparatus provided in this embodiment may be used to implement the motion detection method in fig. 1 and fig. 2, and for specific description, reference may be made to an embodiment of the motion detection method, and a description thereof is not repeated here.
Embodiments of the present invention provide a storage medium, where the storage medium includes a stored program, where, when the program runs, a device on which the storage medium is located is controlled to execute each step of the above-described embodiment of the motion detection method, and for a specific description, reference may be made to the above-described embodiment of the motion detection method.
Embodiments of the present invention provide an electronic device, including a memory and a processor, where the memory is configured to store information including program instructions, and the processor is configured to control execution of the program instructions, and the program instructions are loaded and executed by the processor to implement steps of the embodiments of the motion detection method.
Fig. 4 is a schematic diagram of an electronic device according to an embodiment of the present invention. As shown in fig. 4, the electronic apparatus 60 of this embodiment includes: the processor 61, the memory 62, and the computer program 63 stored in the memory 62 and capable of running on the processor 61, where the computer program 63 is executed by the processor 61 to implement the motion detection method applied in the embodiments, and in order to avoid repetition, the details are not repeated herein. Alternatively, the computer program is executed by the processor 61 to implement the functions of the models/units applied to the motion detection apparatus in the embodiments, which are not repeated herein to avoid repetition.
The electronic device 60 includes, but is not limited to, a processor 61, a memory 62. Those skilled in the art will appreciate that fig. 4 is merely an example of an electronic device 60 and does not constitute a limitation of the electronic device 60 and may include more or fewer components than shown, or combine certain components, or different components, e.g., the electronic device may also include input-output devices, network access devices, buses, etc.
The Processor 61 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 62 may be an internal storage unit of the electronic device 60, such as a hard disk or a memory of the electronic device 60. The memory 62 may also be an external storage device of the electronic device 60, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc., provided on the electronic device 60. Further, the memory 62 may also include both internal storage units and external storage devices of the electronic device 60. The memory 62 is used to store computer programs and other programs and data required by the electronic device. The memory 62 may also be used to temporarily store data that has been output or is to be output.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions in actual implementation, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a Processor (Processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (19)

1. A motion detection method, comprising:
judging whether the total number of the obtained moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region meet a first condition or a second condition;
if the total number of the obtained moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a first condition, determining that the current scene is a global moving scene, and starting a slow recording mode;
if the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a second condition, the current scene is determined to be a local moving scene, and a slow recording mode is started.
2. The method of claim 1, further comprising:
if the total number of the motion image blocks in the non-interesting area, the total number of the motion image blocks in the interesting area and the total number of the image blocks in the interesting area are judged not to meet the first condition and the second condition, whether the current scene is a global moving scene or not is judged according to the total number of the moving image blocks in the obtained large image blocks;
and if the current scene is judged to be the global moving scene, the slow recording mode is forbidden.
3. The method according to claim 1, wherein before determining whether the obtained total number of moving image blocks in the non-region of interest, the total number of moving image blocks in the region of interest, and the total number of image blocks in the region of interest satisfy the first condition or the second condition, the method comprises:
judging whether the current scene is an illumination change scene or not according to the obtained average brightness of the current frame image and the average brightness of the previous frame image;
if the current scene is judged to be an illumination change scene, the slow recording mode is forbidden;
and if the current scene is judged not to be the illumination change scene, continuing to execute the step of judging whether the total number of the motion image blocks in the non-interesting region, the total number of the motion image blocks in the image blocks of the interesting region and the total number of the image blocks of the interesting region meet the first condition or the second condition.
4. The method of claim 1, wherein the first condition comprises:
the first numerical value is greater than the second numerical value and the third numerical value is greater than the fourth numerical value, the first numerical value is the total number of the motion image blocks in the acquired region of non-interest, the second numerical value is the product of the total number of the acquired image blocks in the region of non-interest and the set global motion image block high threshold, the third numerical value is the total number of the motion image blocks in the acquired image blocks in the region of interest, and the fourth numerical value is the product of the total number of the acquired image blocks in the region of interest and the set local motion image block threshold.
5. The method of claim 1, wherein the second condition comprises:
the first numerical value is smaller than the second numerical value and the third numerical value is larger than the fourth numerical value, the first numerical value is the total number of the acquired moving image blocks in the region of non-interest, the second numerical value is the product of the total number of the acquired image blocks in the region of non-interest and the set global moving image block high threshold, the third numerical value is the total number of the acquired moving image blocks in the region of interest, and the fourth numerical value is the product of the total number of the acquired image blocks in the region of interest and the set local moving image block threshold.
6. The method according to claim 2, wherein said determining whether the current scene is a global moving scene according to the total number of moving image blocks in the obtained large image block comprises:
judging whether the total number of the mobile image blocks in the obtained large image blocks is greater than a set global mobile image block threshold or not;
and if the total number of the mobile image blocks in the obtained large image blocks is judged to be larger than the set global mobile image block threshold, judging that the current scene is a global mobile scene.
7. The method of claim 3, wherein the determining whether the current scene is an illumination change scene according to the obtained average brightness of the current frame image and the average brightness of the previous frame image comprises:
judging whether the acquired fifth numerical value is larger than an acquired sixth numerical value, wherein the fifth numerical value is an absolute value of a difference between the average brightness of the acquired current frame image and the average brightness of the previous frame image, and the sixth numerical value is a product value of a set illumination change threshold, the acquired width value of each image block and the acquired height value of each image block;
and if the fifth numerical value is larger than the sixth numerical value, judging that the current scene is an illumination change scene.
8. The method according to claim 1, wherein before determining whether the obtained total number of moving image blocks in the non-region of interest, the total number of moving image blocks in the region of interest, and the total number of image blocks in the region of interest satisfy the first condition or the second condition, the method comprises:
generating inter-frame difference of image blocks of the non-interesting area according to the brightness information of the image blocks of the non-interesting area of the current frame image and the brightness information of the image blocks of the non-interesting area of the previous frame image;
judging whether the inter-frame difference of the image blocks of the non-interesting area is larger than a set global motion threshold or not;
if the inter-frame difference of the image blocks of the non-interesting region is judged to be larger than the set global motion threshold, marking the image blocks of the non-interesting region as motion image blocks;
and counting the total number of the motion image blocks in the non-interested region according to the marked motion image blocks.
9. The method according to claim 1, wherein before determining whether the obtained total number of moving image blocks in the non-region of interest, the total number of moving image blocks in the region of interest, and the total number of image blocks in the region of interest satisfy the first condition or the second condition, the method further comprises:
generating inter-frame difference of image blocks of the region of interest according to the brightness information of the image blocks of the region of interest of the current frame image and the brightness information of the image blocks of the region of interest of the previous frame image;
judging whether the inter-frame difference of the image blocks of the region of interest is larger than a set local motion threshold;
if the inter-frame difference of the image blocks of the region of interest is judged to be larger than the set local motion threshold, marking the image blocks of the region of interest as motion image blocks;
and counting the total number of the motion image blocks in the region of interest according to the marked motion image blocks.
10. The method as claimed in claim 9, wherein the counting the total number of the motion image blocks in the region of interest according to the marked motion image blocks comprises:
dividing a first set number of image blocks of the obtained current frame image into a second set number of large image blocks;
generating the total number of moving image blocks in the large image block according to the total number of moving image blocks in the non-region of interest and the total number of moving image blocks in the region of interest;
judging whether the total number of the moving image blocks in the large image block is greater than a set global movement threshold or not;
if the total number of the moving image blocks in the large image block is judged to be larger than the set global movement threshold, the moving image blocks in the large image block are marked as moving image blocks;
and counting the total number of the moving image blocks in the large image block according to the marked moving image blocks.
11. The method according to claim 8, wherein the generating the inter-frame difference of the image blocks of the non-interest region according to the luminance information of the image blocks of the non-interest region of the current frame image and the luminance information of the image blocks of the non-interest region of the previous frame image comprises:
acquiring a plurality of first channel values, a plurality of second channel values and a plurality of third channel values of an image block of a non-interesting area of a current frame image;
generating a first channel mean value, a second channel mean value and a third channel mean value according to a plurality of first channel values, a plurality of second channel values and a plurality of third channel values of an image block of a non-interesting area of a current frame image;
and generating the brightness information of the image blocks of the non-interested area of the current frame image according to the first channel mean value, the second channel mean value and the third channel mean value.
12. The method according to claim 8, wherein the generating the inter-frame difference of the image blocks of the non-interest region according to the luminance information of the image blocks of the non-interest region of the current frame image and the luminance information of the image blocks of the non-interest region of the previous frame image further comprises:
acquiring a plurality of fourth channel values, a plurality of fifth channel values and a plurality of sixth channel values of image blocks of a non-interesting region of a previous frame of image;
generating a fourth channel mean value, a fifth channel mean value and a sixth channel mean value according to a plurality of fourth channel values, a plurality of fifth channel values and a plurality of sixth channel values of the image block of the non-interesting region of the previous frame of image;
and generating the brightness information of the image blocks of the non-interested area of the previous frame of image according to the fourth channel mean value, the fifth channel mean value and the sixth channel mean value.
13. The method according to claim 9, wherein the generating the inter-frame difference of the image blocks of the region of interest based on the luminance information of the image blocks of the region of interest of the current frame image and the luminance information of the image blocks of the region of interest of the previous frame image comprises:
acquiring a plurality of seventh channel values, a plurality of eighth channel values and a plurality of ninth channel values of an image block of an interested area of the current frame image;
generating a seventh channel mean value, an eighth channel mean value and a ninth channel mean value according to a plurality of seventh channel values, a plurality of eighth channel values and a plurality of ninth channel values of the image block of the region of interest of the current frame image;
and generating brightness information of the image blocks of the region of interest of the current frame image according to the seventh channel mean value, the eighth channel mean value and the ninth channel mean value.
14. The method according to claim 9, wherein the generating the inter-frame difference of the image blocks of the region of interest based on the luminance information of the image blocks of the region of interest of the current frame image and the luminance information of the image blocks of the region of interest of the previous frame image comprises:
acquiring a plurality of tenth channel values, a plurality of eleventh channel values and a plurality of twelfth channel values of image blocks of the region of interest of the previous frame of image;
generating a tenth channel mean value, an eleventh channel mean value and a twelfth channel mean value according to the tenth channel values, the eleventh channel values and the twelfth channel values of the image block of the region of interest of the previous frame of image;
and generating brightness information of image blocks of the region of interest of the previous frame of image according to the tenth channel mean value, the eleventh channel mean value and the twelfth channel mean value.
15. The method of claim 3, wherein the determining whether the current scene is a scene with changed illumination according to the obtained average brightness of the current frame image and the average brightness of the previous frame image comprises:
dividing the acquired current frame image into a first set number of image blocks;
acquiring a plurality of thirteenth channel values, a plurality of fourteenth channel values and a plurality of fifteenth channel values of each image block of the current frame image;
calculating a thirteenth channel mean value, a fourteenth channel mean value and a fifteenth channel mean value of each image block of the current frame image according to the plurality of thirteenth channel values, the plurality of fourteenth channel values and the plurality of fifteenth channel values of each image block of the current frame image;
generating brightness information of each image block of the current frame image according to the thirteenth channel mean value, the fourteenth channel mean value and the fifteenth channel mean value of each image block of the current frame image;
and generating the average brightness of the current frame image according to the brightness information of each image block of the current frame image.
16. The method of claim 3, wherein the determining whether the current scene is a scene with changed illumination according to the obtained average brightness of the current frame image and the average brightness of the previous frame image comprises:
dividing the obtained previous frame image into a first set number of image blocks;
acquiring a plurality of sixteenth channel values, a plurality of seventeenth channel values and a plurality of eighteenth channel values of each image block of the previous frame of image;
calculating a sixteenth channel mean value, a seventeenth channel mean value and an eighteenth channel mean value of each image block of the previous frame image according to the sixteenth channel values, the seventeenth channel values and the eighteenth channel values of each image block of the previous frame image;
generating brightness information of each image block of the previous frame image according to the sixteenth channel mean value, the seventeenth channel mean value and the eighteenth channel mean value of each image block of the previous frame image;
and generating the average brightness of the previous frame image according to the brightness information of each image block of the previous frame image.
17. A motion detection apparatus, comprising:
the first judging module is used for judging whether the total number of the acquired moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region meet a first condition or a second condition; if the total number of the obtained moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a first condition, a first determining module is triggered to determine that the current scene is a global moving scene, and a slow recording mode is started; if the total number of the obtained moving image blocks in the non-interesting region, the total number of the moving image blocks in the interesting region and the total number of the image blocks in the interesting region are judged to meet a second condition, a second determining module is triggered to determine that the current scene is a local moving scene, and a slow recording mode is started.
18. A storage medium, comprising: the storage medium includes a stored program, wherein the apparatus in which the storage medium is located is controlled to perform a motion detection method according to any one of claims 1 to 16 when the program is executed.
19. An electronic device comprising a memory for storing information comprising program instructions and a processor for controlling the execution of the program instructions, wherein the program instructions are loaded and executed by the processor to implement the steps of a motion detection method according to any of claims 1 to 16.
CN202111133842.0A 2021-09-27 2021-09-27 Motion detection method and device, storage medium and electronic equipment Pending CN113873097A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111133842.0A CN113873097A (en) 2021-09-27 2021-09-27 Motion detection method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111133842.0A CN113873097A (en) 2021-09-27 2021-09-27 Motion detection method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN113873097A true CN113873097A (en) 2021-12-31

Family

ID=78990950

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111133842.0A Pending CN113873097A (en) 2021-09-27 2021-09-27 Motion detection method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113873097A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103281539A (en) * 2013-06-07 2013-09-04 华为技术有限公司 Method, device and terminal for image encoding and decoding processing
WO2018076614A1 (en) * 2016-10-31 2018-05-03 武汉斗鱼网络科技有限公司 Live video processing method, apparatus and device, and computer readable medium
US20200077019A1 (en) * 2018-09-04 2020-03-05 Samsung Electronics Co., Ltd. Electronic device for obtaining images by controlling frame rate for external moving object through point of interest, and operating method thereof
CN113206949A (en) * 2021-04-01 2021-08-03 广州大学 Semi-direct monocular vision SLAM method based on entropy weighted image gradient

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103281539A (en) * 2013-06-07 2013-09-04 华为技术有限公司 Method, device and terminal for image encoding and decoding processing
WO2018076614A1 (en) * 2016-10-31 2018-05-03 武汉斗鱼网络科技有限公司 Live video processing method, apparatus and device, and computer readable medium
US20200077019A1 (en) * 2018-09-04 2020-03-05 Samsung Electronics Co., Ltd. Electronic device for obtaining images by controlling frame rate for external moving object through point of interest, and operating method thereof
CN113206949A (en) * 2021-04-01 2021-08-03 广州大学 Semi-direct monocular vision SLAM method based on entropy weighted image gradient

Similar Documents

Publication Publication Date Title
CN109145840B (en) Video scene classification method, device, equipment and storage medium
CN108492287B (en) Video jitter detection method, terminal equipment and storage medium
CN104424634B (en) Object tracking method and device
US9179071B2 (en) Electronic device and image selection method thereof
CN105631418B (en) People counting method and device
CN111047676B (en) Image rendering method, device and storage medium
CN108038422A (en) Camera device, the method for recognition of face and computer-readable recording medium
US20100067863A1 (en) Video editing methods and systems
JP6553692B2 (en) Moving image background removal method and moving image background removal system
CN109005409A (en) A kind of intelligent video coding method based on object detecting and tracking
CN108509917B (en) Video scene segmentation method and device based on lens class correlation analysis
CN111988561B (en) Adaptive adjustment method and device for video analysis, computer equipment and medium
CN111898511A (en) High-altitude parabolic detection method, device and medium based on deep learning
JP2016095854A (en) Image processing and device
CN110782433A (en) Dynamic information violent parabolic detection method and device based on time sequence and storage medium
US20140105498A1 (en) System and method for low complexity change detection in a sequence of images through background estimation
CN101930367B (en) Implementation method of switching images and mobile terminal
CN112380960A (en) Crowd counting method, device, equipment and storage medium
CN109583355A (en) A kind of device and method of stream of people's statistics based on boundary selection
CN111105434A (en) Motion trajectory synthesis method and electronic equipment
JP2006270301A (en) Scene change detecting apparatus and scene change detection program
CN115588147A (en) Video key frame extraction method, system, storage medium and terminal
CN110472561B (en) Football goal type identification method, device, system and storage medium
US10440313B2 (en) Method, system and apparatus for spatially arranging a plurality of video frames for display
CN113269790B (en) Video clipping method, device, electronic equipment, server and storage medium

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