Picture transmission method and system
Technical Field
The invention relates to the technical field of image processing, in particular to a picture transmission method and a picture transmission system.
Background
The intelligent terminals such as the mobile phone and the ipad have the functions of GPS positioning, photographing uploading, track recording and the like, so that the life of people is greatly enriched, and meanwhile, convenience is brought to many industries, such as onshore/overwater duty, forestry patrol and the like. Generally, when a person on duty on land/water is performing law enforcement work or a forestry patroller performs patrol work, the collected law enforcement records such as voice, video or pictures need to be transmitted to a monitoring center in time. For example, if an inspector finds abnormal situations such as hunting, hacking and the like at a certain place in the process of patrolling, the inspector should take a picture or record a video in time, attach corresponding written descriptions and upload the video to a specified system platform.
However, the application scenarios of such industries to intelligent terminals are complex, such as mountain forests, water, elevators, etc., and these environments usually have unstable network signals, which makes it difficult to guarantee the timeliness of law enforcement records. This phenomenon is particularly prominent when transmitting large-capacity pictures, and due to the high requirements for the transmission network, the situation that transmission is impossible or transmission is abnormal at the transmission terminal or the like due to the large transmission data volume often occurs.
Disclosure of Invention
Based on the above problems, the present invention provides a method and a system for transmitting pictures, which can effectively avoid abnormal transmission caused by poor network environment.
In view of the above, an aspect of the present invention provides a method for transmitting a picture, including:
generating a high-definition picture based on the photographing operation of a user, and detecting whether the current network is stable;
when the current network is unstable, compressing the high-definition picture to generate a compressed picture, and sending the compressed picture to a server;
and detecting whether a confirmation signal fed back by the server is received or not within a preset time, and executing the previous step when the detection result is negative.
Further, the picture transmission method further includes:
and when the current network is stable, sending the high-definition picture to the server based on picture sending operation of a user.
Further, the "compressing the high definition picture to generate a compressed picture" includes:
performing resolution reduction processing on the high-definition picture to acquire the data volume of the processed high-definition picture;
comparing whether the data volume is below a stored data volume threshold;
and when the comparison result is yes, generating the compressed picture based on the processed high-definition picture.
Further, the "compressing the high definition picture to generate a compressed picture" includes:
performing size cutting processing on the high-definition picture to obtain the data volume of the processed high-definition picture;
comparing whether the data volume is below a stored data volume threshold;
and when the comparison result is yes, generating the compressed picture based on the processed high-definition picture.
Further, the comparing whether the data amount is below a stored data amount threshold includes:
detecting the signal intensity of a current network, and acquiring a data volume threshold corresponding to the intensity of the current network based on the corresponding relation between the stored signal intensity interval and the data volume threshold;
comparing whether the data amount is below a data amount threshold corresponding to the strength of the current network.
Another aspect of the present invention provides a picture transmission system, including:
the network detection module is used for generating a high-definition picture based on the photographing operation of the user and detecting whether the current network is stable;
the image compression module is used for compressing the high-definition image to generate a compressed image when the current network is unstable, and sending the compressed image to the server;
and the transmission detection module is used for detecting whether the confirmation signal fed back by the server is received or not within preset time, and executing the previous step when the detection result is negative.
Further, the picture transmission system further includes:
and the picture transmission module is used for sending the high-definition picture to the server based on the picture sending operation of the user when the current network is stable.
Further, the picture compression module comprises:
the picture processing unit is used for carrying out resolution reduction processing on the high-definition picture and acquiring the data volume of the processed high-definition picture;
a comparison unit for comparing whether the data amount is lower than a stored data amount threshold;
and the generating unit is used for generating the compressed picture based on the processed high-definition picture when the comparison result is yes.
Further, the picture compression module comprises:
the picture processing unit is used for processing the cutting size of the high-definition picture and acquiring the data volume of the processed high-definition picture;
a comparison unit for comparing whether the data amount is lower than a stored data amount threshold;
and the generating unit is used for generating the compressed picture based on the processed high-definition picture when the comparison result is yes.
Further, the comparing unit is further configured to detect a signal strength of a current network, acquire a data volume threshold corresponding to the strength of the current network based on a correspondence between the stored signal strength interval and the data volume threshold, and compare whether the data volume is lower than the data volume threshold corresponding to the strength of the current network.
According to the picture transmission method and the picture transmission system, under the condition that the current network is unstable, the compressed picture with low requirement on the transmission network bandwidth is transmitted to the server, so that the server can know picture information to a certain extent according to the received compressed picture, the picture transmission efficiency is greatly improved, and the timeliness of information transmission is guaranteed.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
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, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic flow chart illustrating a picture transmission method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a picture transmission system according to an embodiment of the present invention.
Description of the main element symbols:
100-picture transmission system; 10-a network detection module; 20-a picture compression module; 30-transmission detection module.
Detailed Description
In order to facilitate understanding of the present invention, the picture transmission method and system will be described more clearly and completely with reference to the accompanying drawings. The preferred embodiments of the picture transmission method and system are given in the accompanying drawings. The picture transmission method and system can be implemented in many different forms and are not limited to the embodiments described herein. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
Example 1
Fig. 1 shows a flowchart of a picture transmission method according to an embodiment of the present invention.
As shown in fig. 1, the image transmission method provided in the embodiment of the present invention is applied to an intelligent terminal with image capturing and image remote transmission functions, such as a mobile phone, a digital camera with image transmission function, and the like, and includes:
step S1, generating a high-definition picture based on the photographing operation of the user, and detecting whether the current network is stable.
Specifically, when a user takes a picture by using an intelligent terminal such as a mobile phone, picture information taken by the user is acquired, and a high-definition picture is generated according to the picture information. It can be understood that the pixel resolution of the high-definition picture depends on the pixel number of the camera in a specific intelligent terminal. In addition, the pixel depth of the high-definition picture depends on the color display scale number of the display in the intelligent terminal, because the color display scale number of the display determines the number of colors that can be represented by the intelligent terminal. For example, the colors of a color display are synthesized from three primary colors, and assuming that the three primary colors of a color display, red, green, and blue, are represented by 4-bit binary numbers, the color display can represent 4096 different colors.
Further, the pixel resolution and the pixel depth of a high definition picture determine the data size of the high definition picture, for example, a high definition picture with true color (24 bits) and pixel resolution of 1024 × 768, and the data size is about 2.25MB before any digital compression or the like is performed. Of course, the data size of the high definition picture is also related to its size. The data volume of the high-definition pictures acquired by the intelligent terminal is large.
Further, after the user finishes picture shooting, the signal intensity change frequency of the current network is detected. The signal strength change frequency refers to the number of times that the current network changes from one signal strength to another signal strength in a unit time. And comparing the signal intensity change frequency of the current network with the stored change frequency threshold value so as to judge whether the current network is stable. It is easy to understand that when the signal strength change frequency of the current network reaches the change frequency threshold, the current network is not stable; otherwise, it indicates that the current network is stable.
Step S2, when the current network is unstable, compressing the high definition picture to generate a compressed picture, and sending the compressed picture to a server.
And if the current network is unstable, compressing the high-definition picture to generate a compressed picture. The data volume of the compressed picture is usually smaller than that of the high-definition picture, and in the embodiment, the data volume of the compressed picture is usually below 150Kb, so that the requirement of the transmission of the compressed picture on network bandwidth is lower.
Specifically, the signal strength of the current network is detected. And judging which signal intensity interval the signal intensity of the current network belongs to according to the stored corresponding relation between the signal intensity interval and the data volume threshold, and acquiring the data volume threshold corresponding to the intensity of the current network. The setting of the data volume threshold value is convenient for compression processing of high-definition pictures in different degrees, and it is easy to understand that the lower the network signal intensity is, the smaller the corresponding data volume threshold value is, so that the higher the compression degree of the high-definition pictures is. Of course, when the intelligent terminal transmits the picture to the server or data transmission is performed between the intelligent terminals, the data volume threshold most suitable for fast transmission of the picture can be set according to experience.
Further, in this embodiment, the compression of the high definition pictures includes two embodiments. One embodiment is to reduce the resolution of the high-definition pictures, for example, to convert color high-definition pictures into black and white high-definition pictures, thereby reducing the data amount of the high-definition pictures. Specifically, a difference value between the data volume of the high-definition picture and a data volume threshold corresponding to the signal strength of the current network is calculated, the size of the resolution to be reduced is determined, and then the reduction of the resolution is completed once or for multiple times, and the resolution of the specified value is reduced each time until the data volume of the high-definition picture is lower than the corresponding data volume threshold.
Another embodiment is to crop the high definition picture to reduce the size of the high definition picture, for example, crop a border or a background of the high definition picture, thereby reducing the data amount of the high definition picture. It should be noted that cropping of the high definition picture should be premised on not changing the specific content of the high definition picture. Of course, the clipping of the high definition picture may also adopt the existing clipping of the picture to reduce the data amount of the picture, which is not limited here.
Further, the data volume of the compressed high-definition picture is obtained, and whether the data volume of the compressed high-definition picture is lower than a data volume threshold corresponding to the intensity of the current network or not is compared. And if the comparison result is negative, further compressing the processed high-definition picture, and repeating the steps until the data volume of the processed high-definition picture is lower than the data volume threshold corresponding to the intensity of the current network. And when the data volume of the processed high-definition picture is lower than the data volume threshold corresponding to the intensity of the current network, generating the compressed picture based on the processed high-definition picture.
In another embodiment, the user may attach certain text information for remark explanation according to the taken high-definition picture. For example, when the hunting condition is found by the patrol personnel, the hunting geographic region, the information of the hunting personnel, the hunting object and other character information can be remarked, so that the monitoring center can know the abnormal condition in time and give processing measures. In this embodiment, the monitoring center is disposed at a server side. Generally, the data size of the text information is small, and the text information and the compressed picture can be asynchronously transmitted to the server.
Step S3, detecting whether the acknowledgement signal fed back by the server is received within a preset time, and if the detection result is no, executing step S2.
In this embodiment, after the compressed picture is sent to the server, whether the compressed picture is sent successfully is monitored. Specifically, whether a confirmation signal fed back by the server is received or not is detected within a preset time, so that whether the server successfully receives the data information of the compressed picture or not is judged. It can be understood that when the confirmation signal fed back by the server is received within the preset time, the data information representing the compressed picture is successfully sent to the server; otherwise, the compressed picture data information needs to be sent again, that is, step S2 is executed until the compressed picture data information is successfully sent to the server.
And step S4, when the current network is stable, sending the high-definition picture to the server based on the picture sending operation of the user.
It should be noted that, the user does not need to perform any uploading operation at the intelligent terminal, the compressed picture is automatically transmitted to the server after being generated, and the whole transmission process of the compressed picture runs at the background of the intelligent terminal operating system, and the user does not know. Generally, when the current network is unstable, a user can only send a high-definition picture after moving to a position with a relatively stable network environment suitable for high-definition picture transmission. In the image transmission mode of the embodiment, under the condition that the current network is unstable, the compressed image with lower requirement on the bandwidth of the transmission network is transmitted to the server, so that the server can know the image information to a certain extent according to the received compressed image, the image transmission efficiency is greatly improved, and the timeliness of information transmission is ensured.
It can be understood that the server may not know the amount of information as high definition pictures according to the received compressed pictures. In this embodiment, whether to transmit the high definition picture depends on the user. Specifically, when the current network is stable, the user can supplement the transmission of high-definition pictures to the server. And sending the high-definition picture to the server based on picture sending operation of a user. It is easy to find that the embodiment can realize that the user can complete the transmission of the picture by multiple operations, reduce the user operations, and have better user experience.
Example 2
Fig. 2 is a schematic structural diagram of a picture transmission system according to an embodiment of the present invention.
As shown in fig. 2, the image transmission system 100 according to the embodiment of the present invention includes a network detection module 10, an image compression module 20, and a transmission detection module 30.
The network detection module 10 is configured to generate a high-definition picture based on a photographing operation of a user, and detect whether a current network is stable.
The picture compression module 20 is configured to compress the high definition picture to generate a compressed picture when the current network is unstable, and send the compressed picture to the server. In this embodiment, the picture compression module 20 includes a picture processing unit, a comparison unit, and a generation unit.
And the picture processing unit is used for carrying out resolution reduction processing on the high-definition picture and acquiring the data volume of the processed high-definition picture.
In another embodiment, the picture processing unit is further configured to perform processing of cutting the high definition picture to obtain a data size of the processed high definition picture.
A comparing unit for comparing whether the data amount is lower than a stored data amount threshold.
Specifically, the comparison unit detects the signal strength of the current network, acquires a data volume threshold corresponding to the strength of the current network based on the stored correspondence between the signal strength interval and the data volume threshold, and compares whether the data volume is lower than the data volume threshold corresponding to the strength of the current network.
And the generating unit is used for generating the compressed picture based on the processed high-definition picture when the comparison result is yes.
The transmission detection module 30 is configured to detect whether a confirmation signal fed back by the server is received within a preset time, and resend the compressed picture to the server if the detection result is negative.
In another embodiment, the picture transmission system 100 further includes a picture transmission module 40.
The picture transmission module 40 is configured to send the high-definition picture to the server based on a picture sending operation of a user when the current network is stable.
According to the picture transmission method and the picture transmission system, under the condition that the current network is unstable, the compressed picture with low requirement on the transmission network bandwidth is transmitted to the server, so that the server can know picture information to a certain extent according to the received compressed picture, the picture transmission efficiency is greatly improved, and the timeliness of information transmission is guaranteed.
The system provided by the embodiment of the present invention has the same implementation principle and technical effect as the foregoing method embodiment, and for the sake of brief description, no mention is made in the system embodiment, and reference may be made to the corresponding contents in the foregoing method embodiment.
In all examples shown and described herein, any particular value should be construed as merely exemplary, and not limiting, and thus other examples of example embodiments may have different values. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and 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 of devices or units through some communication interfaces, 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 above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.