CN110213457B - Image transmission method and device - Google Patents

Image transmission method and device Download PDF

Info

Publication number
CN110213457B
CN110213457B CN201910483949.4A CN201910483949A CN110213457B CN 110213457 B CN110213457 B CN 110213457B CN 201910483949 A CN201910483949 A CN 201910483949A CN 110213457 B CN110213457 B CN 110213457B
Authority
CN
China
Prior art keywords
image
value
difference
gray
character string
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910483949.4A
Other languages
Chinese (zh)
Other versions
CN110213457A (en
Inventor
张会杰
胡仁伟
陈效友
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Knownsec Information Technology Co Ltd
Original Assignee
Beijing Knownsec Information 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 Knownsec Information Technology Co Ltd filed Critical Beijing Knownsec Information Technology Co Ltd
Priority to CN201910483949.4A priority Critical patent/CN110213457B/en
Publication of CN110213457A publication Critical patent/CN110213457A/en
Application granted granted Critical
Publication of CN110213457B publication Critical patent/CN110213457B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • G06T3/4007Interpolation-based scaling, e.g. bilinear interpolation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/32Circuits or arrangements for control or supervision between transmitter and receiver or between image input and image output device, e.g. between a still-image camera and its memory or between a still-image camera and a printer device

Abstract

The application provides an image transmission method and an image transmission device, wherein the method is used for improving the existing image transmission mechanism and comprises the following steps: calculating a character string of the acquired first image to obtain a first character string; comparing the difference between the first character string and a plurality of second character strings to obtain a plurality of difference values, wherein the plurality of second character strings are character strings obtained by calculating a plurality of second images, and the plurality of second images are a plurality of images acquired before the acquisition time of the first image; and if the plurality of difference values are smaller than a preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is larger than or equal to a preset time period, transmitting the first image to the server. In the implementation process, image transmission is determined by two dimensions of difference values and time between pictures, so that the condition that the images are not sent for a long time is effectively improved.

Description

Image transmission method and device
Technical Field
The present application relates to the field of image analysis technologies, and in particular, to an image transmission method and apparatus.
Background
At present, images acquired by a fixed thermal infrared imager need to be transmitted back to a data center for processing, and the traditional method is that the fixed thermal infrared imager acquires and stores the images in real time, then two adjacent frames of images in the storage are compared, and if the difference value of the two adjacent frames of images is greater than a threshold value, the images acquired in real time are transmitted; otherwise, if the difference value of the two adjacent frames of images is not greater than the threshold value, the images collected in real time are not transmitted.
Disclosure of Invention
An object of the embodiments of the present application is to provide an image transmission method and apparatus, which are used to improve an existing image transmission mechanism.
The embodiment of the application provides an image transmission method, which comprises the following steps: calculating a character string of the acquired first image to obtain a first character string; comparing differences between the first character string and a plurality of second character strings to obtain a plurality of difference values, wherein the plurality of second character strings are character strings obtained by calculating a plurality of second images, and the plurality of second images are a plurality of images acquired before the acquisition time of the first image; and if the plurality of difference values are smaller than a preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is larger than or equal to a preset time period, transmitting the first image to a server. In the implementation process, image transmission is determined by two dimensions of difference values and time between pictures, so that the condition that the images are not sent for a long time is effectively improved.
Optionally, in this embodiment of the application, after the comparing the difference between the first character string and the plurality of second character strings to obtain a plurality of difference values, the method further includes: and if the plurality of difference values are smaller than a preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is smaller than a preset time period, stopping the transmission of the first image. In the implementation process, the transmission of the images is stopped through two dimensions of the difference value between the images and the time, so that unnecessary image transmission is prevented, and the problem of network bandwidth resource waste in the process of transmitting the images by the thermal infrared imager is effectively solved.
Optionally, in this embodiment of the application, after the comparing the difference between the first character string and the plurality of second character strings to obtain a plurality of difference values, the method further includes: if any difference value in the plurality of difference values is larger than or equal to the preset threshold value, the first image is transmitted to a server. In the implementation process, the image transmission is determined by the difference value between the pictures, so that the efficiency of transmitting the images with difference is ensured.
Optionally, in this embodiment of the present application, the calculating a character string of the acquired first image includes: zooming and carrying out gray scale processing on the first image to obtain a first gray scale image, wherein the first gray scale image comprises gray scale values corresponding to a plurality of pixel points; calculating the average value of the gray values corresponding to the plurality of pixel points to obtain a first average value; and comparing the first average value with the gray value corresponding to each pixel point in the plurality of pixel points to obtain a character string. In the implementation process, the character string of the picture is calculated and used for obtaining the difference value of the picture, so that the efficiency of comparing the picture and obtaining the difference value is effectively improved, and the efficiency of transmitting the images with difference is ensured.
Optionally, in this embodiment of the present application, the scaling and gray-scale processing the first image to obtain a first gray-scale map includes: zooming the first image to a preset size to obtain a second image; and carrying out gray processing on the second image by using a maximum value method or an average value method to obtain a first gray image. In the implementation process, the image is zoomed and subjected to gray level processing, so that the processing efficiency of the image is effectively improved, and the efficiency of transmitting the differential image is ensured.
Optionally, in this embodiment of the application, the calculating an average value of the gray scale values corresponding to the plurality of pixel points to obtain a first average value includes: according to
Figure GDA0002904394580000031
Calculating the average value of the gray values corresponding to the plurality of pixel points to obtain a first average value; wherein the content of the first and second substances,
Figure GDA0002904394580000032
is the first average value, i is the ith pixel point in the plurality of pixel points, xiAnd n is the number of the pixel points, wherein the gray value is corresponding to the ith pixel point in the pixel points. In the implementation process, the gray level processing is carried out on the picture, so that the processing efficiency of the picture is effectively improved, and the efficiency of transmitting the image with difference is ensured.
Optionally, in this embodiment of the application, the comparing the first average value with the gray value corresponding to each of the plurality of pixel points to obtain the character string includes: if the first average value is less than or equal to the gray value corresponding to each pixel point in the plurality of pixel points, recording a comparison result as one; if the first average value is larger than the gray value corresponding to each pixel point in the plurality of pixel points, recording the comparison result as zero; and determining the character strings obtained by sequentially connecting the comparison results as character strings. In the implementation process, the character string of the picture is calculated and used for obtaining the difference value of the picture, so that the efficiency of comparing the picture and obtaining the difference value is effectively improved, and the efficiency of transmitting the images with difference is ensured.
Optionally, in this embodiment of the application, the comparing the difference between the first character string and the plurality of second character strings to obtain a plurality of difference values includes: performing XOR operation on each second character string in the plurality of second character strings and the first character string to obtain a plurality of third character strings; and accumulating the numerical values in each third string in the plurality of third strings to obtain a plurality of difference values. In the implementation process, the character string of the picture is calculated and used for obtaining the difference value of the picture, so that the efficiency of comparing the picture and obtaining the difference value is effectively improved, and the efficiency of transmitting the images with difference is ensured.
An embodiment of the present application further provides an image transmission apparatus, including: the first obtaining module is used for calculating a character string of the acquired first image to obtain a first character string; a first comparing module, configured to compare differences between the first character string and a plurality of second character strings, to obtain a plurality of difference values, where the plurality of second character strings are character strings obtained by calculating a plurality of second images, and the plurality of second images are a plurality of images acquired before an acquisition time of the first image; and the first transmission module is used for transmitting the first image to a server if the plurality of difference values are smaller than a preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is greater than or equal to a preset time period.
Optionally, in an embodiment of the present application, the method further includes: and the first stopping module is used for stopping the transmission of the first image if the plurality of difference values are all smaller than a preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is smaller than a preset time period.
Optionally, in an embodiment of the present application, the method further includes: a second transmission module, configured to transmit the first image to a server if any one of the plurality of difference values is greater than or equal to the preset threshold.
Optionally, in an embodiment of the present application, the first obtaining module includes: the second obtaining module is used for carrying out scaling and gray scale processing on the first image to obtain a first gray scale image, and the first gray scale image comprises gray scale values corresponding to a plurality of pixel points; a third obtaining module, configured to calculate an average value of gray values corresponding to the multiple pixel points, so as to obtain a first average value; and the fourth obtaining module is used for comparing the first average value with the gray value corresponding to each pixel point in the plurality of pixel points to obtain the character string.
Optionally, in an embodiment of the present application, the second obtaining module includes: the image zooming module is used for zooming the first image to a preset size to obtain a second image; and the gray processing module is used for carrying out gray processing on the second image by using a maximum value method or an average value method to obtain a first gray image.
Optionally, in an embodiment of the present application, the third obtaining module includes: an average value obtaining module for obtaining an average value based on
Figure GDA0002904394580000041
Calculating the average value of the gray values corresponding to the plurality of pixel points to obtain a first average value; wherein x is the first average value, i is the ith pixel point in the plurality of pixel points, and xiAnd n is the number of the pixel points, wherein the gray value is corresponding to the ith pixel point in the pixel points.
Optionally, in an embodiment of the present application, the fourth obtaining module includes: the first result module is used for recording a comparison result as one if the first average value is less than or equal to the gray value corresponding to each pixel point in the plurality of pixel points; a second result module, configured to mark the comparison result as zero if the first average value is greater than a gray value corresponding to each of the plurality of pixel points; and the connection result module is used for determining the character strings obtained by sequentially connecting the comparison results as the character strings.
Optionally, in this embodiment of the present application, the first comparing module includes: a fifth obtaining module, configured to perform an exclusive or operation on each of the second character strings and the first character string to obtain a plurality of third character strings; a sixth obtaining module, configured to accumulate the numerical values in each of the third strings to obtain a plurality of difference values.
An embodiment of the present application further provides an electronic device, including: a processor and a memory storing machine-readable instructions executable by the processor, the machine-readable instructions when executed by the processor performing the method as described above.
The embodiment of the present application also provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method as described above is executed.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application;
FIG. 2 is a schematic flow chart illustrating an image transmission method provided by an embodiment of the present application;
fig. 3 is a flowchart illustrating a hash value calculation method provided in an embodiment of the present application;
fig. 4 shows a schematic structural diagram of an image transmission device provided in an embodiment of the present application.
Detailed Description
The technical solution in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
Referring to fig. 1, fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. An electronic device 101 provided in an embodiment of the present application includes: a processor 102 and a memory 103, the memory 103 storing machine readable instructions executable by the processor 102, the machine readable instructions when executed by the processor 102 performing the following method.
Referring to fig. 1, the embodiment of the present application further provides a storage medium 104, where the storage medium 104 stores a computer program, and the computer program is executed by the processor 102 to perform the following method.
The storage medium 104 may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as a Static Random Access Memory (SRAM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), an Erasable Programmable Read-Only Memory (EPROM), a Programmable Read-Only Memory (PROM), a Read-Only Memory (ROM), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.
In the existing fixed thermal infrared imager, images can be collected and stored in real time, then two adjacent frames of images in storage are compared, and if the difference value of the two adjacent frames of images is greater than a threshold value, the images collected in real time are transmitted; otherwise, if the difference value of the two adjacent frames of images is not greater than the threshold value, the images collected in real time are not transmitted. In practical cases, of course, the difference value between two adjacent frames of images may also be the difference value between multiple adjacent frames of images.
To illustrate in a detailed example, there may be a case such as: if the number of the plurality of difference values is 4, the difference values of the three adjacent images are all smaller than a preset threshold, specifically, for convenience of description, the images are sequentially numbered, and there are 10 numbered images in total, and the numbers of the 10 numbered images are respectively from 1 to 10; the number of the difference values is smaller than the preset threshold value, for example, 1, 2 and 3, 2, 3 and 4, and so on, the difference values of 8, 9 and 10 are also smaller than the preset threshold value, but the difference value between the image number 1 and the image number 10 exceeds the preset threshold value. If whether the image is transmitted is judged only from the condition that whether the image difference value is larger than the preset threshold value, the images numbered from 1 to 10 are not sent, and the situation that the image is not sent for a long time occurs at the moment.
First embodiment
Fig. 2 shows a schematic flowchart of an image transmission method provided in an embodiment of the present application, which may be executed by an image acquisition device, for example: thermal infrared imagers, surveillance cameras, or terminals with cameras, for example: a mobile phone, a tablet computer or a notebook computer, etc. The method may also be performed by a device terminal (hereinafter referred to as device terminal) having a function of executing a computer program after the image acquisition device transmits the acquired image to the terminal, and the device terminal may for example: personal computers, network switches, network routers, or desktop hosts, etc. Of course, in a specific implementation process, the image capturing device and the device terminal may be connected through a high-speed transmission line, where the high-speed transmission line may rapidly transmit the image data, and the high-speed transmission line includes, but is not limited to: optical fiber, serial port, parallel bus or universal serial bus, etc.
Application scenarios of the image transmission method include, but are not limited to, scenarios in which images are acquired at a high frequency and the images need to be sent to a server for processing, such as: video security monitoring and high-resolution image data acquisition, etc.
The image transmission method illustrated in fig. 2 described above may include the steps of:
step S100: and calculating the character string of the acquired first image to obtain a first character string.
The method for acquiring and processing the first image can have several conditions, and in the first condition, the first image can be acquired by the image acquisition device and processed by the image acquisition device; in the second case, the first image is captured by the image capture device, which then sends the first image to the device terminal, where it is processed.
It is understood that the first image may refer to an infrared image obtained by acquiring the intensity of infrared light of the object, or may be a multi-channel image or a single-channel image obtained by acquiring the intensity of visible light of the object; the first image may be, for example, an image collected by an infrared imager with a resolution of 640 x 480.
The character string of the image may refer to a hash value obtained by processing the image, where the hash value may be understood as a fingerprint or an identifier of the image, and the hash value is used to obtain a difference value or a similarity of a plurality of images, so as to determine whether the image is sent or not according to the difference value or the similarity of the images.
In some of the embodiments of the present application, step S100 may include:
step S110: and carrying out scaling and gray scale processing on the first image to obtain a first gray scale map, wherein the first gray scale map comprises gray scale values corresponding to a plurality of pixel points.
Performing scaling processing on the image, namely removing partial details to keep the structure of the image so as to enable the size of the image to be uniform, wherein the size refers to the height and the width of the image; ways to remove some details are for example: removing the difference in aspect ratio, or scaling according to aspect ratio using interpolation, for example: bicubic interpolation, nearest neighbor interpolation, bilinear interpolation and the like.
Gray processing, which is a process of converting a color image into a gray image; for example, in the RGB model, when R ═ G ═ B, the color represents a gray scale color, where the value of R ═ G ═ B is called the gray scale value, so that each pixel of the gray scale image only needs one byte to store the gray scale value (also called the intensity value, luminance value), and the gray scale range is 0 to 255. In a specific implementation, the color image may be grayed by four methods, such as a component method, a maximum value method, an average value method, and a weighted average method, and for convenience of understanding, the maximum value method and the average value method will be described in the following examples.
In some of the embodiments of the present application, step S110 may include:
step S111: and zooming the first image to a preset size to obtain a second image.
The preset size here may mean that the height of the image is a preset height, and the width of the image is a preset width, for example, the size of the image is 32 × 24, where 32 pixels are the width of the image, and 24 pixels are the height of the image. One embodiment of scaling the first image to the preset size may be scaling the first image to 32 × 24 image size, and using the 32 × 24 image as the second image.
Step S112: and carrying out gray processing on the second image by using a maximum value method or an average value method to obtain a first gray image.
In some embodiments of the present application, the formula using the maximum method is represented as: gray (i, j) ═ max { R (i, j), G (i, j), B (i, j) } performs Gray processing on the second image to obtain a first Gray map; or expressed as a formula using an average method
Figure GDA0002904394580000091
Carrying out gray level processing on the second image to obtain a first gray level image;
wherein, Gray (i, j) is a Gray value of the ith row and the jth column of the first Gray scale image, R (i, j) is a first channel value of the ith row and the jth column of the second image, G (i, j) is a second channel value of the ith row and the jth column of the second image, B (i, j) is a third channel value of the ith row and the jth column of the second image, and max represents that the maximum value is obtained.
Step S120: and calculating the average value of the gray values corresponding to the plurality of pixel points to obtain a first average value.
In particular embodiments, may be according to
Figure GDA0002904394580000092
Calculating the average value of the gray values corresponding to the plurality of pixel points to obtain a first average value;
wherein the content of the first and second substances,
Figure GDA0002904394580000101
is a first average value, i is the ith pixel point in the plurality of pixel points, xiThe number n is the number of the pixel points, and the number n is the gray value corresponding to the ith pixel point in the pixel points.
Step S130: and comparing the first average value with the gray value corresponding to each pixel point in the plurality of pixel points to obtain the character string.
As described above, the character string herein may refer to a hash value obtained by processing an image, where the hash value may be understood as a fingerprint or an identifier of the image, and the hash value herein is used to obtain a difference value or a similarity of a plurality of images, so as to determine whether the image is sent or not according to the difference value or the similarity of the images, and a specific obtaining method of the character string herein is described as follows.
Referring to fig. 3, fig. 3 is a schematic flow chart illustrating a hash value calculation method according to an embodiment of the present application. In some embodiments of the present application, step S130 may be implemented by using an average hash algorithm (also referred to as a mean hash algorithm) or a perceptual hash algorithm, where the average hash algorithm is described as an example, and the method includes the following steps:
step S131: and if the first average value is less than or equal to the gray value corresponding to each pixel point in the plurality of pixel points, recording the comparison result as one.
The specific implementation manner of the method is as follows: the first average value is 200, the gray value corresponding to the first pixel point is 100, and the result is marked as 1 after comparison; the gray value corresponding to the third pixel point is 100, and the gray value is marked as 1 after comparison; the gray value corresponding to the fourth pixel point is 100, and then the result is recorded as 1.
Step S132: and if the first average value is larger than the gray value corresponding to each pixel point in the plurality of pixel points, recording the comparison result as zero.
The specific implementation manner of the method is as follows: the first average value is 200, the gray value corresponding to the second pixel point is 300, and the gray value is marked as 0 after comparison; the gray value corresponding to the fifth pixel point is 300, and the gray value is marked as 0 after comparison; the gray value corresponding to the sixth pixel point is 300, and then the result is recorded as 0 after comparison.
Step S133: and determining character strings obtained by sequentially connecting the comparison results as character strings.
Continuing with the above example, if the character string obtained by connecting the comparison results in sequence is determined to be a character string, then it is 101100, and then 101100 is the character string or hash value of the first image.
In some implementations in the examples of the present application, the method can be: the gray value of each pixel is compared to the first average value. If the gray value of the pixel point is larger than or equal to the average value, marking as 1; if the gray value of the pixel point is smaller than the average value, the gray value is marked as 0. The comparison results are combined to form a 768-bit string consisting of 0 or 1, which is the string or hash value of the picture.
Step S200: and comparing the difference between the first character string and the plurality of second character strings to obtain a plurality of difference values.
Wherein the plurality of second character strings are character strings obtained by calculating a plurality of second images, the plurality of second images being a plurality of images acquired before an acquisition time of the first image. It is understood that the first image is stored by the image capturing apparatus or the device terminal after being captured, and when the first images captured at a plurality of different time points are stored, a plurality of images are obtained. The plurality of images may be a plurality of images acquired by the image acquisition device before the acquisition time of the first image, or a plurality of images accessed by the device terminal before the first image is accessed. Of course, in a specific implementation process, the first image and the plurality of images may be numbered, and may be numbered in a time sequence, or may be numbered by using a timestamp, for example: numbering each collected frame image, and including date and sequence number; the number may be in the form of a "chronological order" such as: 201905081234567.
it is to be understood that the specific manner of calculating the plurality of second character strings according to the plurality of second images is the same as the manner of calculating the first character string according to the first image, and therefore, the process of obtaining the plurality of second character strings may refer to the above step S110 to step S130, and is not repeated herein. Here, a specific manner of comparing the difference between the first character string and the plurality of second character strings will be described in detail below:
in one implementation manner in the embodiment of the present application, the difference method for comparing the first character string with the plurality of second character strings in step S200 may include the following steps:
step S210: and performing XOR operation on each second character string in the second character strings and the first character string to obtain a plurality of third character strings.
The specific way of performing the xor operation on each of the second character strings and the first character string may be to perform the xor operation on one second character string and one first character string, accumulate the number of all the pixel bits in the result as 1, and output the value, which is also called a hamming distance.
Step S220: and accumulating the numerical values in each third string in the plurality of third strings to obtain a plurality of difference values.
As above, the number of all pixel bits in the result is accumulated to be 1, and this value, also called hamming distance, is output. The values in each of the third strings are accumulated to obtain a plurality of difference values.
Step S300: and if the plurality of difference values are smaller than a preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is larger than or equal to a preset time period, transmitting the first image to the server.
One embodiment of the foregoing determining whether the image is transmitted is as follows: if the number of the plurality of difference values is 4, the number of the first image is 201905081234571, and the number of the last transmission picture is 201905081234567, the difference value is 4, and the difference value between the number of the first image and the transmission number of the latest image is equal to the value of the preset time period, and thus, the first image is transmitted to the server. Of course, in a specific implementation, the determination can be made according to two conditions, for example: and transmitting the first image to the server under the condition that the difference value between the number of the first image and the transmission number of the latest image is equal to the value of a preset time period and the difference values are less than a preset threshold value.
As another example, two conditions are judged together, for example: if the number of the plurality of difference values is 4, assuming that the preset time period is the processing time of 4 images, 10 numbered images are provided in total, the number of each of the 10 numbered images is from 1 to 10, and the adjacent three images are similar, that is, the difference values of the adjacent three images are smaller than the preset threshold value; if the condition that a plurality of difference values are smaller than a preset threshold value is met, the 10 images are sent, and the 10 images are not sent; if the condition that the multiple difference values are smaller than the preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is larger than or equal to the preset time period is met, the condition that the multiple difference values are smaller than the preset threshold value is met, but the condition that the difference value between the acquisition time of the first image and the transmission time of the latest image is larger than or equal to the preset time period is not met, so that the transmission is carried out once every 4 images, and as can be understood, the transmission is carried out by 1, 5 and 9, or the transmission is carried out by 2, 6 and 10, or the transmission is carried out by 3 and 7, or the transmission is carried out by 4 and 8. The method has the advantage that when the server does not receive the image for a long time, the server can judge that the transmission network between the server and the image sender fails, rather than the condition that a plurality of difference values are all smaller than the preset threshold value is met, so that the image is not transmitted.
Continuing with the above example, there may be a situation such as: if the number of the plurality of difference values is 4, the difference values of the three adjacent images are all smaller than the preset threshold, specifically, the numbers of the difference values that are all smaller than the preset threshold, for example, 1, 2 and 3, 2, 3 and 4, and so on, the difference values of 8, 9 and 10 are also smaller than the preset threshold, but the difference value between the image with the number of 1 and the image with the number of 10 already exceeds the preset threshold. If whether the image is transmitted is judged only from the condition that whether the image difference value is larger than the preset threshold value, the images numbered from 1 to 10 are not sent, and the situation that the image is not sent for a long time occurs at the moment. Therefore, the method provided by the embodiment of the present application adopts two conditions of the image difference value and the time to perform the judgment together, which is beneficial to effectively avoid the situation that the images with the numbers 1 to 10 are not transmitted, that is, effectively improve the situation that the images are not transmitted for a long time.
Step S400: and if the plurality of difference values are smaller than the preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is smaller than the preset time period, stopping the transmission of the first image.
The preset threshold may be a specific value, such as 100 or 120, or a value generated by a function, such as: the set function may be: (x) 50 × (1-e)-x)/(1+ex) Wherein e is a natural constant in mathematics and is also an infinite non-cyclic decimal, and x is the difference value between the number of the picture of the frame and the number of the comparison picture. The preset time period may also be a specific time period, for example: a time period of 5 seconds or 10 seconds, or a difference value between one picture number and another picture number as a preset time period, for example: the preset time period is 4, for example: the number of the first image is 201905081234571, the number of the last frame transmission picture is 201905081234567, and the difference value is 4, and the difference value between the number of the first image and the transmission number of the latest image is smaller than the value of the preset time period, and therefore, the first image should not be transmitted.
Before calculating the difference between the acquisition time of the first image and the transmission time of the latest image, the images may be numbered, may be numbered in chronological order, or may be numbered with a timestamp, for example: the picture number of the present frame is 201905081234571, the picture number of the previous frame is 201905081234567, and so on. The specific calculation manner of the difference between the acquisition time of the first image and the transmission time of the latest image may be to subtract the number of the last sent image from the number of the current image, where the above data is taken as an example, the difference between the acquisition time of the first image and the transmission time of the latest image is 4.
In the implementation process, the transmission of the images is stopped through two dimensions of the difference value and the time between the images, so that unnecessary image transmission is prevented, and the problem that the images are not sent for a long time in the process of transmitting the images by the thermal infrared imager is effectively solved.
In the embodiment of the present application, after step S300, the method may further include:
step S500: if any difference value in the plurality of difference values is larger than or equal to a preset threshold value, the first image is transmitted to the server.
One embodiment of the foregoing determining whether the image is transmitted is as follows: character strings of pictures numbered 201905081234570, 201905081234569, 201905081234568, 201905081234567, that is, hash values of images are compared in order. If any one of the plurality of difference values is greater than or equal to a preset threshold, where the preset threshold is, for example, 100, the first image is transmitted to the server. In the implementation process, the image transmission is determined by the difference value between the pictures, so that the efficiency of transmitting the images with difference is ensured.
Second embodiment
Referring to fig. 4, fig. 4 is a schematic structural diagram of an image transmission apparatus according to an embodiment of the present application. The embodiment of the application provides an image transmission device 100, and the image transmission device 100 comprises:
the first obtaining module 110 is configured to calculate a character string of the acquired first image, and obtain the first character string.
The first comparing module 120 is configured to compare differences between the first character string and a plurality of second character strings, to obtain a plurality of difference values, where the plurality of second character strings are character strings obtained by calculating a plurality of second images, and the plurality of second images are a plurality of images acquired before the acquisition time of the first image.
The first transmission module 130 is configured to transmit the first image to the server if the plurality of difference values are all smaller than a preset threshold and a difference value between the acquisition time of the first image and the transmission time of the latest image is greater than or equal to a preset time period.
In the implementation process described above, image transmission is determined by two dimensions of difference values and time between pictures, and the situation that images are not sent for a long time is effectively improved.
Optionally, in an embodiment of the present application, the apparatus further includes:
the first stopping module is used for stopping the transmission of the first image if the plurality of difference values are smaller than a preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is smaller than a preset time period.
Optionally, in this embodiment of the present application, the apparatus may further include:
the second transmission module is used for transmitting the first image to the server if any one of the plurality of difference values is larger than or equal to a preset threshold value.
Optionally, in an embodiment of the present application, the first obtaining module includes:
and the second obtaining module is used for carrying out scaling and gray scale processing on the first image to obtain a first gray scale image, and the first gray scale image comprises gray scale values corresponding to the plurality of pixel points.
And the third obtaining module is used for calculating the average value of the gray values corresponding to the plurality of pixel points to obtain the first average value.
And the fourth obtaining module is used for comparing the first average value with the gray value corresponding to each pixel point in the plurality of pixel points to obtain the character string.
Optionally, in an embodiment of the present application, the second obtaining module includes:
and the image scaling module is used for scaling the first image to a preset size to obtain a second image.
And the gray processing module is used for carrying out gray processing on the second image by using a maximum value method or an average value method to obtain a first gray image.
Optionally, in an embodiment of the present application, the third obtaining module includes:
an average value obtaining module for obtaining an average value based on
Figure GDA0002904394580000161
Calculating the average value of the gray values corresponding to the plurality of pixel points to obtain a first average value; wherein the content of the first and second substances,
Figure GDA0002904394580000162
is a first average value, i is the ith pixel point in the plurality of pixel points, xiThe number n is the number of the pixel points, and the number n is the gray value corresponding to the ith pixel point in the pixel points.
Optionally, in an embodiment of the present application, the fourth obtaining module includes:
and the first result module is used for recording the comparison result as one if the first average value is less than or equal to the gray value corresponding to each pixel point in the plurality of pixel points.
And the second result module is used for recording the comparison result as zero if the first average value is greater than the gray value corresponding to each pixel point in the plurality of pixel points.
And the connection result module is used for determining the character strings obtained by sequentially connecting the comparison results as the character strings.
Optionally, in this embodiment of the present application, the first comparing module includes:
and the fifth obtaining module is used for carrying out XOR operation on each second character string in the second character strings and the first character string to obtain a plurality of third character strings.
And a sixth obtaining module, configured to accumulate the numerical values in each of the third strings to obtain a plurality of difference values.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application are essentially or partially implemented in the form of software products, which are stored in storage media and include several instructions for causing computer devices to execute all or part of the steps of the methods of the embodiments of the present application. The aforementioned computer device includes: various devices having the capability of executing program codes, such as a personal computer, a server, a mobile device, an intelligent wearable device, a network device, and a virtual device, the storage medium includes: u disk, removable hard disk, read only memory, random access memory, magnetic disk, magnetic tape, or optical disk.
The above description is only an alternative embodiment of the embodiments of the present application, but the scope of the embodiments of the present application is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present application, and all the changes or substitutions should be covered by the scope of the embodiments of the present application.

Claims (9)

1. An image transmission method, comprising:
calculating a character string of the acquired first image to obtain a first character string;
comparing differences between the first character string and a plurality of second character strings to obtain a plurality of difference values, wherein the plurality of second character strings are character strings obtained by calculating a plurality of second images, and the plurality of second images are a plurality of images acquired before the acquisition time of the first image;
if the plurality of difference values are smaller than a preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is larger than or equal to a preset time period, transmitting the first image to a server;
wherein comparing the differences between the first string and the plurality of second strings to obtain a plurality of difference values comprises: performing XOR operation on each second character string in the plurality of second character strings and the first character string to obtain a plurality of third character strings; and accumulating the numerical values in each third character string in the third character strings to obtain a plurality of difference values, wherein the difference values are Hamming distances.
2. The method of claim 1, wherein after comparing the difference between the first string and the plurality of second strings to obtain a plurality of difference values, further comprising:
and if the plurality of difference values are smaller than a preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is smaller than a preset time period, stopping the transmission of the first image.
3. The method of claim 1, wherein after comparing the differences between the first string and the plurality of second strings to obtain a plurality of difference values, further comprising:
if any difference value in the plurality of difference values is larger than or equal to the preset threshold value, the first image is transmitted to a server.
4. The method of claim 1, wherein computing the character string of the captured first image comprises:
zooming and carrying out gray scale processing on the first image to obtain a first gray scale image, wherein the first gray scale image comprises gray scale values corresponding to a plurality of pixel points;
calculating the average value of the gray values corresponding to the plurality of pixel points to obtain a first average value;
and comparing the first average value with the gray value corresponding to each pixel point in the plurality of pixel points to obtain a character string.
5. The method of claim 4, wherein scaling and grayscaling the first image to obtain a first grayscale map comprises:
zooming the first image to a preset size to obtain a second image;
and carrying out gray processing on the second image by using a maximum value method or an average value method to obtain a first gray image.
6. The method of claim 4, wherein calculating an average of the gray-scale values corresponding to the plurality of pixel points to obtain a first average comprises:
according to
Figure FDA0002904394570000021
Calculating the average value of the gray values corresponding to the plurality of pixel points to obtain a first average value; wherein the content of the first and second substances,
Figure FDA0002904394570000022
is the first average value, i is the ith pixel point in the plurality of pixel points, xiAnd n is the number of the pixel points, wherein the gray value is corresponding to the ith pixel point in the pixel points.
7. The method of claim 4, wherein comparing the first average value with a gray value corresponding to each of the plurality of pixels to obtain a string comprises:
if the first average value is less than or equal to the gray value corresponding to each pixel point in the plurality of pixel points, recording a comparison result as one;
if the first average value is larger than the gray value corresponding to each pixel point in the plurality of pixel points, recording the comparison result as zero;
and determining the character strings obtained by sequentially connecting the comparison results as character strings.
8. An image transmission apparatus, comprising:
the first obtaining module is used for calculating a character string of the acquired first image to obtain a first character string;
a first comparing module, configured to compare differences between the first character string and a plurality of second character strings, to obtain a plurality of difference values, where the plurality of second character strings are character strings obtained by calculating a plurality of second images, and the plurality of second images are a plurality of images acquired before an acquisition time of the first image;
the first transmission module is used for transmitting the first image to a server if the plurality of difference values are smaller than a preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is larger than or equal to a preset time period;
wherein comparing the differences between the first string and the plurality of second strings to obtain a plurality of difference values comprises: performing XOR operation on each second character string in the plurality of second character strings and the first character string to obtain a plurality of third character strings; and accumulating the numerical values in each third character string in the third character strings to obtain a plurality of difference values, wherein the difference values are Hamming distances.
9. The apparatus of claim 8, further comprising:
and the first stopping module is used for stopping the transmission of the first image if the plurality of difference values are all smaller than a preset threshold value and the difference value between the acquisition time of the first image and the transmission time of the latest image is smaller than a preset time period.
CN201910483949.4A 2019-06-04 2019-06-04 Image transmission method and device Active CN110213457B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910483949.4A CN110213457B (en) 2019-06-04 2019-06-04 Image transmission method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910483949.4A CN110213457B (en) 2019-06-04 2019-06-04 Image transmission method and device

Publications (2)

Publication Number Publication Date
CN110213457A CN110213457A (en) 2019-09-06
CN110213457B true CN110213457B (en) 2021-04-13

Family

ID=67790775

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910483949.4A Active CN110213457B (en) 2019-06-04 2019-06-04 Image transmission method and device

Country Status (1)

Country Link
CN (1) CN110213457B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111192195A (en) * 2019-12-17 2020-05-22 中国平安财产保险股份有限公司 Picture processing method and device, computer equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100837406B1 (en) * 2006-11-13 2008-06-12 삼성전자주식회사 Portable terminal including a video surveillance apparatus and a video surveillance method, and a video surveillance system
CN105931269A (en) * 2016-04-22 2016-09-07 海信集团有限公司 Tracking method for target in video and tracking device thereof
CN106817410B (en) * 2016-12-28 2020-04-21 广州大气候农业科技有限公司 Image returning method, image storage method, node of Internet of things and server
CN108876756B (en) * 2017-05-09 2020-08-28 普天信息技术有限公司 Image similarity measurement method and device
CN107239518A (en) * 2017-05-24 2017-10-10 福建中金在线信息科技有限公司 A kind of image comparison method, contrast device, electronic equipment and storage medium
CN109241897B (en) * 2018-08-29 2021-02-12 深圳华远云联数据科技有限公司 Monitoring image processing method and device, gateway equipment and storage medium

Also Published As

Publication number Publication date
CN110213457A (en) 2019-09-06

Similar Documents

Publication Publication Date Title
US11800969B2 (en) Method and device for monitoring colonoscope withdrawal speed
CN110633682B (en) Infrared image anomaly monitoring method, device and equipment based on double-light fusion
CN108805265B (en) Neural network model processing method and device, image processing method and mobile terminal
CN110580428A (en) image processing method, image processing device, computer-readable storage medium and electronic equipment
KR101167567B1 (en) Fish monitoring digital image processing apparatus and method
CN107862658B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN109327626B (en) Image acquisition method and device, electronic equipment and computer readable storage medium
WO2022105019A1 (en) Snapshot quality evaluation method and apparatus for vehicle bayonet device, and readable medium
CN107622497B (en) Image cropping method and device, computer readable storage medium and computer equipment
CN110059666B (en) Attention detection method and device
CN107563979B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
CN110121031B (en) Image acquisition method and device, electronic equipment and computer readable storage medium
CN110532746B (en) Face checking method, device, server and readable storage medium
CN112104869B (en) Video big data storage and transcoding optimization system
KR20170038144A (en) Attention detection apparatus and attention detection method
CN112085094B (en) Document image reproduction detection method, device, computer equipment and storage medium
CN110858316A (en) Classifying time series image data
CN110213457B (en) Image transmission method and device
CN113158773B (en) Training method and training device for living body detection model
CN107578372B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN107464225B (en) Image processing method, image processing device, computer-readable storage medium and mobile terminal
CN111507119A (en) Identification code identification method and device, electronic equipment and computer readable storage medium
CN111222446B (en) Face recognition method, face recognition device and mobile terminal
CN110689486A (en) Image processing method, device, equipment and computer storage medium
CN111369557B (en) Image processing method, device, computing equipment 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
GR01 Patent grant
GR01 Patent grant