CN115834895B - Efficient data compression and storage method for unmanned aerial vehicle - Google Patents

Efficient data compression and storage method for unmanned aerial vehicle Download PDF

Info

Publication number
CN115834895B
CN115834895B CN202310146560.7A CN202310146560A CN115834895B CN 115834895 B CN115834895 B CN 115834895B CN 202310146560 A CN202310146560 A CN 202310146560A CN 115834895 B CN115834895 B CN 115834895B
Authority
CN
China
Prior art keywords
gray
category
image
compressed
clustering
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
CN202310146560.7A
Other languages
Chinese (zh)
Other versions
CN115834895A (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.)
Shanghai Every Moment Cultural Communication Co ltd
Original Assignee
Shanghai Every Moment Cultural Communication 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 Shanghai Every Moment Cultural Communication Co ltd filed Critical Shanghai Every Moment Cultural Communication Co ltd
Priority to CN202310146560.7A priority Critical patent/CN115834895B/en
Publication of CN115834895A publication Critical patent/CN115834895A/en
Application granted granted Critical
Publication of CN115834895B publication Critical patent/CN115834895B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to the technical field of data processing, in particular to a data efficient compression and storage method for an unmanned aerial vehicle, which comprises the following steps: acquiring a category number set and a gray value sequence according to an image to be compressed; acquiring a clustering center according to the category number and the gray value sequence; calculating the combined distance from the pixel points to the clustering center to realize the classification of the pixel points; obtaining consistency of classification results; obtaining a clustering result according to the consistency of the classification result; calculating the compression probability of the clustering result to obtain an optimal clustering result; and performing block mode removing operation on the image according to the optimal clustering result, and further realizing image compression. The invention has high compression efficiency and is beneficial to storing and transmitting image data.

Description

Efficient data compression and storage method for unmanned aerial vehicle
Technical Field
The invention relates to the technical field of data compression, in particular to a data efficient compression and storage method for an unmanned aerial vehicle.
Background
The unmanned aerial vehicle is an unmanned aerial vehicle which is operated by using a radio remote control device and a self-contained program control device. The method is widely applied to the fields of aerial photography, agriculture, plant protection, miniature self-timer shooting, express delivery transportation, disaster relief, wild animal observation, infectious disease monitoring, mapping, news reporting, electric power inspection, disaster relief, film and television shooting and the like. Some data acquired in the unmanned aerial vehicle flight operation process need to be compressed and stored. The invention compresses and stores the image data shot in the unmanned aerial vehicle flight process.
The images shot in the flight process of the unmanned aerial vehicle, such as aerial images, may contain various features of rivers, vegetation, hillsides and the like, such as images shot by film and television may contain various features of characters, scenes and the like. When the image contains more features, the number of gray values appearing in the image is more, and the probability distribution of gray values may be more even.
The existing image compression method, such as Huffman coding, carries out coding compression according to the occurrence probability of gray values in an image, gives shorter codes to gray values with larger probability, and gives longer codes to gray values with smaller probability, thereby realizing the integral compression of the image. For the situation that the number of gray values in an image shot by an unmanned aerial vehicle is large and the probability distribution of the gray values is average, higher compression efficiency cannot be achieved by using Huffman coding.
Disclosure of Invention
The invention provides a data efficient compression storage method for an unmanned aerial vehicle, which aims to solve the existing problems.
The invention relates to a data efficient compression storage method for an unmanned aerial vehicle, which adopts the following technical scheme:
one embodiment of the invention provides a data efficient compression storage method for an unmanned aerial vehicle, which comprises the following steps:
s1: acquiring an image to be compressed, and acquiring a category number set and a gray value sequence according to a gray histogram of the image to be compressed;
s2: clustering the images to be compressed by using each category number in the category number set to obtain a plurality of clustering results, wherein the clustering method comprises the following steps:
s201: acquiring all seed points according to the category number and the gray value sequence;
s202: the seed points are used as cluster centers, and classifying operation is carried out on the images to be compressed according to all the cluster centers, wherein the classifying operation comprises the following steps:
acquiring the combined distance from each pixel point to each clustering center in the image to be compressed according to the gray value of each pixel point in the image to be compressed, the gray value of each clustering center, the distance from each pixel point to each clustering center, a second preset threshold value and the size of the image to be compressed; dividing each pixel point into categories of the cluster center with the minimum combined distance to obtain a plurality of categories;
obtaining the weight of each gray value according to each gray value in each category and the gray value of the clustering center of each category; acquiring the frequency of each gray value in each category; obtaining the gray consistency of each category according to the frequency of all gray values in each category and the weight of each gray value; taking the average value of the gray level consistency of all the categories as the consistency of the classification operation result;
acquiring all pixel points in each category, which have the same gray value as the gray value of the clustering center of the category, as clustering center candidate pixel points of the category; acquiring the mass center of the category; calculating the distance from each cluster center candidate pixel point of the category to the mass center of the category, and selecting the cluster center candidate pixel point with the minimum distance as a new cluster center;
s203: performing multiple iterations on the classification operation until the consistency of the obtained classification operation result is less than or equal to the consistency of the classification operation result of the previous iteration; taking a plurality of categories obtained in the last iteration as clustering results;
s3: obtaining the minimum circumscribed rectangle of each category in the clustering result; dividing the number of the pixel points in each category in the clustering result by the area of the minimum circumscribed rectangle of each category to obtain the regularity of each category in the clustering result; obtaining the compression probability of the clustering result according to the regularity of each category, the gray consistency of each category and the number of the categories in the clustering result;
s4: taking the clustering result with the maximum compression probability as an optimal clustering result; dividing the image to be compressed into a plurality of blocks according to the minimum circumscribed rectangle of each category in the optimal clustering result; acquiring the mode of gray values in each block of an image to be compressed; subtracting the mode of the gray value of each block from the gray value of all pixel points in each block of the image to be compressed to obtain a new block image; combining all new block images into a new image; the new image is code compressed.
Preferably, the obtaining the category number set and the gray value sequence according to the gray histogram of the image to be compressed includes:
average filtering is carried out on a gray level histogram of an image to be compressed; obtaining the number of local maximum points in the gray level histogram; obtaining all integers from the number of the local maximum points to a first preset threshold interval to obtain a category number set;
obtaining a plurality of gray values corresponding to all local maximum points in the gray histogram to obtain a peak gray set; and respectively calculating the farthest distance between corresponding pixel points of each gray value in the peak gray set in the image to be compressed, and sequencing the gray values in the peak gray set according to the sequence from the largest distance to the smallest distance to obtain a gray value sequence.
Preferably, the obtaining all seed points according to the category number and the gray value sequence includes:
obtaining the number of seed points corresponding to each gray value in the gray value sequence according to the quotient and remainder of the category number divided by the number of peak gray set elements;
and selecting seed points in the image to be compressed according to the number of the seed points corresponding to each gray value.
Preferably, the combined distance expression is:
wherein the method comprises the steps ofIs the first image to be compressedPixel point to the firstThe combined distance of the clustering centers;is the first image to be compressedGray values of the individual pixels;is the first image to be compressedGray values of the clustering centers;the difference between the maximum gray value and the minimum gray value in the image to be compressed;a second preset threshold value;is the first image to be compressedThe pixel point and the firstThe distance between the clustering centers in the image to be compressed;is the length of the image to be compressed;is the width of the image to be compressed.
Preferably, the weight expression is:
wherein the method comprises the steps ofIs the firstThe classification result of the second iteration is the firstThe first to appear in the categoryWeights of the individual gray values;is the firstThe classification result of the second iteration is the firstThe first to appear in the categoryThe gray value size;is the firstGray values of cluster centers of the individual categories;represent the firstThe classification result of the second iteration is the firstAll gray values and the first of the classesMaximum value of gray value difference of cluster centers of the individual categories.
Preferably, the gray consistency expression is:
wherein the method comprises the steps ofIs the firstThe classification result of the second iteration is the firstGray consistency of individual categories;is the firstThe classification result of the second iteration is the firstIn the individual categoriesThe first to appearWeights of the individual gray values;is the firstThe classification result of the second iteration is the firstThe first to appear in the categoryThe frequency of the individual gray values;is the firstThe classification result of the second iteration is the firstThe number of gray values occurring in the individual categories;is an exponential function with a base of natural constant.
Preferably, the compression probability expression is:
wherein the method comprises the steps ofIs the firstCompression probability of the individual clustering results;is the firstThe first clustering resultDegree of regularity for each category;is the firstThe first clustering resultGray consistency of individual categories;is the firstThe number of categories in the clustering results;is a negative exponential function with a base of natural constant.
Preferably, the selecting the seed points in the image to be compressed according to the number of the seed points corresponding to each gray value includes:
acquiring all pixel points of each gray value in an image to be compressed, and forming a candidate seed point set of each gray value; randomly selecting a pixel point from the candidate seed point set as a seed point, and deleting the pixel point from the candidate seed point set;
repeatedly selecting the candidate seed point set until the number of the seed points obtained according to each gray value is consistent with the number of the seed points corresponding to each gray value;
the selecting operation is as follows:
calculating the sum of the distances from each pixel point in the candidate seed point set to all seed points; and selecting the pixel point with the largest sum of the distances as a seed point, and deleting the pixel point from the candidate seed point set.
The beneficial effects of the invention are as follows: acquiring a category number set and a gray value sequence according to an image to be compressed; acquiring a clustering center according to the category number and the gray value sequence; calculating the combined distance from the pixel points to the clustering center to realize the classification of the pixel points; obtaining consistency of classification results; obtaining a clustering result according to the consistency of the classification result; calculating the compression probability of the clustering result to obtain an optimal clustering result; and performing block mode removing operation on the image according to the optimal clustering result, and further realizing image compression. Through selection of seed points, updating of a clustering center and gray consistency judgment in the classification operation, the gray value range of each category in the obtained clustering result is small, and the gray value distribution probability difference is large. And the gray level of each category in the optimal clustering result is unified and the shape is regular by calculating the compression probability. The gray values in each of the further resulting blocks are relatively uniform. The mode removing operation is carried out on each block, so that the gray values of all the blocks are compressed in a smaller range, the number of gray values appearing in a new image is smaller, and the distribution probability of different gray values is larger. And then the Huffman coding can achieve higher compression efficiency, and the compression efficiency is higher than that of directly compressing the image by utilizing the Huffman coding.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of steps of a method for efficient compressed storage of data for an unmanned aerial vehicle of the present invention;
Detailed Description
In order to further describe the technical means and effects adopted by the present invention to achieve the preset purpose, the following detailed description refers to the specific implementation, structure, characteristics and effects of the data efficient compression storage method for unmanned aerial vehicle according to the present invention with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following specifically describes a specific scheme of the data efficient compression storage method for the unmanned aerial vehicle provided by the invention with reference to the accompanying drawings.
Referring to fig. 1, a flowchart of steps of a method for efficient data compression and storage for an unmanned aerial vehicle according to an embodiment of the present invention is shown, where the method includes the following steps:
101. and acquiring an image to be compressed, and acquiring a category number set and a gray value sequence according to a gray histogram of the image to be compressed.
And shooting RGB images through a camera mounted on the unmanned aerial vehicle. In order to facilitate the compression of the image, the RGB image is split into three images of R, G, B channels, which are regarded as three gray images to be compressed respectively, and the gray images are called as images to be compressed. The image size is noted as
And counting gray values appearing in the image to be compressed and the number of each gray value, and drawing a gray histogram of the image to be compressed. And carrying out mean value filtering on the gray level histogram to smooth the gray level histogram.
Because the image shot by the unmanned aerial vehicle, such as an aerial image, may contain various features such as rivers, vegetation, hillsides and the like, the gray values of each feature are similar, and each feature is distributed in a local part of the image, so that the gray of the pixel points in the image to be compressed has local similarity, and therefore one peak in the gray histogram represents one or more identical local features in the image to be compressed. Obtaining the number of peaks in the gray value histogram, namely the number of local maximum pointsAnd all local maximaThe gray value corresponding to the point is used for obtaining a peak gray setWhereinRepresent the firstGray values corresponding to the local maximum points.
In order to make the gray values in each category of the subsequent clusters uniform, the number of categories is at least. Clustering is to group each local feature into a class, and since one peak in the gray level histogram may represent a plurality of identical local features in the image to be compressed, the number of local features of the image to be compressed may be larger thanThe number of categories of the clusters is larger than that of the clusters
According to the embodiment of the invention, the image is segmented according to the clustering result, each image block is recombined into a new image after being operated, so that the number of gray values appearing in the new image is small, the distribution probability difference of different gray values is large, and a better compression effect is achieved by utilizing Huffman coding. The information of each block is also saved while new image compression data is saved. When the number of categories is very large, although new image compression efficiency may be made large, it may result in a block having very much information, making the compression efficiency as a whole small. Therefore, a first preset threshold value needs to be setFor limiting the number of categories of clusters. In the embodiment of the inventionIn itThe implementation personnel in other embodiments can set according to the needsIs a value of (2).
In summary, the number of categories is greater than or equal toLess than or equal to. Acquisition intervalAll integers in the set constitute a category number set
102. And respectively carrying out clustering operation for a plurality of times by utilizing each category number in the category number set.
The method comprises the following specific steps:
1. and obtaining all seed points according to the category number and the gray value sequence.
The number of categories is recorded asThen it is necessary to selectSeed points. Since the gray scales of the pixel points in the image to be compressed have local similarity, one peak in the gray scale histogram represents one or more same local features in the image to be compressed, and thus the peak gray scale setThe gray value of each of the images to be compressed is the gray value with the largest occurrence number in a local feature of the image to be compressed. In order to group each local feature as much as possible, it is necessary to ensure that the gray values of all selected seed points contain each gray value in the peak gray set.
And acquiring all pixel points of one gray value in the peak gray set in the image to be compressed, calculating the farthest distance between the pixel points, and recording the farthest distance as the distance characteristic of the gray value. When the farthest distance between the pixel points is larger, the number of local features corresponding to the gray value may be larger; conversely, the smaller the furthest distance between the pixels, the fewer the number of local features corresponding to the gray value may be. And similarly, obtaining distance characteristics of all gray values in the peak gray level set, and sequencing the gray values according to the distance characteristics to obtain a gray level sequence.
Number of categoriesDivided by the number of peak gray set elementsObtaining a quotientSum remainder. The quotient is thenRepresenting at least selection of at least one gray value according to each gray value in a sequence of gray valuesThe pixel points are used as seed points; remainder of remainderRepresenting the front in a sequence of gray valuesThe gray value also needs to select one more pixel point as a seed point. Thus, the number of seed points corresponding to each gray value in the gray value sequence is obtained.
And selecting seed points according to the number of the seed points corresponding to each gray value in the gray value sequence. Such as the first in the sequence of gray valuesThe number of seed points corresponding to the gray values is recorded asFirst, the first gray value sequence is obtainedAnd obtaining a candidate pixel point set by using all the pixel points of the gray values in the image to be matched. Randomly selecting one candidate pixel point from the candidate pixel point set as a first seed point, and deleting the first seed point from the candidate pixel point set. Calculating the distance between each candidate pixel point in the candidate pixel point set and the first seed point, selecting the candidate pixel point with the largest distance to the first seed point as the second seed point, and deleting the second seed point from the candidate pixel point set. And calculating the distance from each candidate pixel point in the candidate pixel point set to the second seed point, and selecting the candidate pixel point with the largest sum of the distance from the first seed point and the distance from the first seed point as a third seed point. Similarly, the first gray value in the gray value sequence is obtainedCorresponding to gray valuesSeed points. Similarly, seed points corresponding to all gray values in the gray value sequence are obtained to obtainSeed points.
2. And taking the seed points as cluster centers, and performing classification operation on the images to be compressed according to all the cluster centers to obtain classification results.
Taking the seed points as a clustering center, and dividing the rest pixel points in the image to be compressed according to the clustering center: firstly, calculating the combined distance from each pixel point to each cluster center in an image to be compressed, and dividing each pixel point into categories of the cluster centers with the minimum combined distance. And the classification of the image to be compressed is completed by selecting a clustering center for each pixel point.
The purpose of clustering is to divide pixels of the same local area feature with similar gray scales into one class,the method is convenient for obtaining a new image with fewer gray values and larger gray value distribution probability difference after carrying out mode subtraction operation on the image blocks corresponding to each category, thereby realizing higher compression effect by utilizing Huffman coding. The combined distance therefore needs to include the gray scale difference of the pixel point from the cluster center and the spatial distance of the pixel point from the cluster center. The method comprises the following steps: the first image to be compressedPixel point to the firstCombined distance of individual cluster centersThe method comprises the following steps:
wherein the method comprises the steps ofIs the first image to be compressedPixel point to the firstThe combined distance of the clustering centers;is the first image to be compressedGray values of the individual pixels;is the first image to be compressedGray values of the clustering centers;is the first image to be compressedThe pixel point and the firstGray value differences of the clustering centers;is the difference between the maximum gray value and the minimum gray value in the image to be compressed and is used as the image to be compressedNormalizing;a second preset threshold value is used for representing the weight of the gray value difference;is the first image to be compressedThe pixel point and the firstThe distance of the clustering centers in the image to be compressed, namely the spatial distance;is the length of the image to be compressed;is the width of the image to be compressed;for diagonal length of image to be compressed, as willNormalizing;is the weight of the spatial distance; due to the large variety of features in the imageThe gray values in the features are similar, and in order to better divide the pixel points of the local features into one category, the embodiment of the invention focuses on gray similarity. Thus a larger weight is set for the gray value difference and a smaller weight for the spatial distance. In the embodiment of the inventionIn other embodiments the practitioner may set as desiredIs a value of (2).
3. And updating the clustering center according to the characteristics of each category.
Since the gray value of the old cluster center is the gray value corresponding to the peak of the gray histogram, theoretically, the number of pixels in the class that is the same as the gray value of the cluster center is the largest. In order to ensure that the gray values of each category are uniform, the gray values of the new clustering center are the same as those of the old clustering centers, and the new clustering centers are positioned in the center of the category to which the new clustering centers belong. In the first placeThe method for acquiring the new cluster center is described by taking the category as an example: acquisition of the firstCentroid of individual category, obtain the firstAnd calculating all the pixel points with the same gray value as the gray value of the clustering center in each category, and respectively calculating the distances between the pixel points and the mass center. Selecting the pixel with the smallest distance as the first pixelNew cluster centers of individual categories.
4. And carrying out iterative classification operation on the image to be compressed.
And (3) dividing the rest pixel points in the image to be compressed according to the new clustering center and the method in the step (2), and continuously iterating the step until the iteration stopping rule is met.
The iteration stop rule acquisition method comprises the following steps:
when compressing an image to be compressed, the image to be compressed needs to be partitioned first. When the gray values in each block are more consistent, a better compression effect can be achieved. And the image to be compressed is segmented according to the clustering result. When the gray values of the pixel points contained in each category in the clustering result obtained through clustering are more consistent, the clustering effect is better. Therefore, consistency indexes are introduced to measure the classification effect of each iteration, and when consistency is not increased in the continuous iteration process, the clustering achieves the best effect.
In the first placeFor example, the method for obtaining the consistency of each iteration is described: first, theMultiple iteration co-operationThe number of classes, the frequency of grey values occurring in each class being counted, e.g. thSecond iteration (a)The first to appear in the categoryThe frequency of each gray value is. According to the updating rule of the clustering center during iteration, no matter in which iteration process, the gray value of the clustering center of each category is unchanged, namely the firstGray value of cluster center of each category and first selectedThe gray values of the seed points are the same, is. First, theSince the gray value of each seed point is the gray value corresponding to one peak in the gray histogram, theoretically, the firstGray values in each category areThe number of pixels is the largest. To measure the firstSecond iteration (a)Judging the consistency of gray values in each categorySecond iteration (a)Each gray value and the first gray value appearing in each categoryGray scale value of clustering center of each categoryThe difference of (2) to obtain the firstSecond iteration (a)Weights for each gray value appearing in each category, again according to the firstSecond iteration (a)The weight and frequency of each gray value appearing in each category is obtainedGray level consistency of individual categories.
First, theThe classification result of the second iteration is the firstThe first to appear in the categoryWeighting of individual gray valuesThe method comprises the following steps:
wherein the method comprises the steps ofIs the firstThe classification result of the second iteration is the firstThe first to appear in the categoryWeights of the individual gray values;is the firstThe classification result of the second iteration is the firstThe first to appear in the categoryThe gray value size;is the firstGray values of cluster centers of the individual categories;represent the firstThe classification result of the second iteration is the firstAll gray values and the first of the classesMaximum value of gray value difference of clustering centers of each category for differentiating gray valuesNormalizing; when the gray scale is differentThe larger the weight, the larger the weight; when the gray scale is differentThe smaller the weight.
First, theSecond iteration (a)Gray level consistency of individual categoriesThe method comprises the following steps:
wherein the method comprises the steps ofIs the firstThe classification result of the second iteration is the firstGray consistency of individual categories;is the firstThe classification result of the second iteration is the firstThe first to appear in the categoryWeights of the individual gray values;is the firstThe classification result of the second iteration is the firstThe first to appear in the categoryThe frequency of the individual gray values;is the firstThe classification result of the second iteration is the firstThe number of gray values occurring in the individual categories;is an exponential function based on natural constant for normalization; when the first isThe classification result of the second iteration is the firstThe first to appear in the categoryGray value and the firstWhen the difference of gray values of the individual category clustering centers is large, namely the firstThe classification result of the second iteration is the firstThe first to appear in the categoryWhen the weight of each gray value is large, the whole of the first gray valueThe classification result of the second iteration is the firstThe more interesting the gray consistency calculation of the individual classes isThe classification result of the second iteration is the firstThe first to appear in the categoryThe distribution frequency of the individual gray values. Conversely, the smaller the weight, the more overall the firstThe classification result of the second iteration is the firstThe less attention is paid to the first in gray consistency calculation of the individual classesThe classification result of the second iteration is the firstThe first to appear in the categoryThe distribution frequency of the individual gray values. When the gradation uniformity is larger, the firstThe classification result of the second iteration is the firstThe more uniform the gray scale of each category; conversely, when the gradation consistency is smaller, the firstThe classification result of the second iteration is the firstThe more confusing the gray scale of each category.
Similarly, get the firstGray level consistency of all categories in the classification result of the iteration to the firstThe average value of gray consistency of all classes in the classification results of the multiple iterations is taken as the firstConsistency of classification results for the multiple iterations. Comparing the consistency of the classification results of each iteration and the previous iteration, and if the consistency of the classification results of the current iteration is greater than the consistency of the classification results of the previous iteration, indicating that the current iteration is focusedThe class effect is further improved; if the consistency of the classification result of the current iteration is less than or equal to the consistency of the classification result of the previous iteration, the clustering effect is not improved by the current iteration. At this time, the iteration is stopped, and the classification result of the previous iteration is used as the final clustering result. Using gray consistency of each category in the final clustering resultTo represent.
Thus, one clustering is completed, and a clustering result is obtained. Similarly, the collection is in the number of categoriesAnd clustering the images to be compressed respectively according to the number of each category to obtain a plurality of clustering results.
103. And calculating the compression probability of each clustering result to obtain the optimal clustering result.
The purpose of clustering is to block the image to be compressed to achieve the best compression effect. In order to obtain the optimal clustering result, a compression probability index is introduced, so that the degree of the clustering result is measured. First, theThe clustering result is taken as an example, and the method for acquiring the compression probability is explained.
When an image to be compressed is compressed, the image to be compressed needs to be partitioned according to a clustering result, so that each block is in a regular rectangle. The partitioning tends to change the shape of each category in the clustering result, and may partition some pixels in the current category into the remaining categories and partition some pixels in the remaining categories into the current category. When the shape of the category is irregular, the number of pixel points which need to be changed is increased due to the blocking; when the shape of the category is more regular, the more the shape approaches a rectangle, the smaller the number of pixels that need to be changed due to the blocking.
The purpose of the partitioning is to perform the mode subtracting operation on the pixels in the block, so that the number of the gray values of the pixels after the mode subtracting operation is smaller, the distribution probability difference of the gray values is larger, and therefore, higher compression efficiency can be achieved by using Huffman coding. The clustering can make the gray values of the current class uniform, namely the gray consistency is large, and the effects of less gray values of pixel points and larger difference of the distribution probability of the gray values can be achieved after the mode subtraction operation is carried out. However, the greater the number of pixels to be changed, the more the gray consistency of the current class is destroyed, so that the compression efficiency is reduced. The smaller the number of pixel points to be changed is caused by the blocking, the smaller the influence on the gray consistency in the current class is, and therefore the larger compression efficiency is ensured.
Therefore, the regularity of each category has a large influence on the compression probability, the firstThe first clustering resultDegree of regularity of individual categoriesThe acquisition method of (1) comprises the following steps: first obtain the firstThe first clustering resultThe number of pixels included in the categoryThe area of the smallest circumscribed rectangle of each category, in thThe first clustering resultThe number of pixels included in the category divided by the number of pixelsThe area of the smallest circumscribed rectangle of each category is obtainedDegree of regularity of individual categories. The greater the degree of regularity, the more the shape of the category approaches a rectangle. Conversely, the smaller the degree of regularity, the more irregular the shape of the category.
Meanwhile, when the gray consistency of each category in the clustering result is larger, the clustering effect is better, and the subsequent compression effect is also better.
According to the invention, the image is segmented according to the clustering result, each image block is recombined into a new image after being operated, so that the number of gray values appearing in the new image is smaller, the distribution probability difference of different gray values is larger, and a better compression effect is achieved by utilizing Huffman coding. The information of each block is also saved while new image compression data is saved. When the number of categories is very large, although new image compression efficiency may be made large, it may result in a block having very much information, making the compression efficiency as a whole small. The compression efficiency is also related to the number of categories, and the compression efficiency may be smaller as the number of categories is larger and the compression efficiency may be larger as the number of categories is smaller.
In conclusion, the compression probability is obtained by combining the regularity, gray consistency and the number of all the categories in each category in the clustering result. First, theCompression probability of individual clustering resultsThe method comprises the following steps:
wherein,is the firstIndividual clusteringResults No. 1Degree of regularity for each category;is the firstClustering result numberGray consistency of individual categories;is the firstThe number of categories of the clustering results;is a negative exponential function based on natural constant for applyingCarrying out negative correlation normalization; the larger the regularity of each category is, the larger the consistency of gray values is, and the smaller the number of the categories is, the larger the compression probability is. Conversely, when the regularity of the existence category is smaller, or the gradation consistency of the existence category is smaller, or the number of categories is larger, the compression probability is smaller.
And similarly, obtaining the compression probability of each clustering result, wherein the clustering result with the maximum compression probability is the optimal clustering result.
104. And compressing the image to be compressed according to the optimal clustering result.
And partitioning the image to be compressed according to the minimum circumscribed rectangle of each category in the optimal clustering result. There may be an overlap between each block. And obtaining the mode of the gray values of the pixel points in each block, and subtracting the mode from the gray values of all the pixel points in each block to obtain a new block image. In this way, the gray values in each block can be compressed to a smaller extent.
All the new block images are numbered according to the sequence from left to right and from top to bottom, overlapping parts possibly exist among the new block images, and the values of the pixels of the overlapping parts are represented by the values of the pixels of the corresponding positions in the new block images with small numbers. This allows all new block images to be stitched into one new image.
The number of gray values in the new image is small, and meanwhile, the distribution probability difference between different gray values is large. And compressing the new image by using Huffman coding to obtain a compression result of the new image as first compression data. And simultaneously saving the mode of each block, the coordinates of the pixel point at the upper left corner and the coordinates of the pixel point at the lower right corner of each block as second compressed data according to the sequence from left to right and from top to bottom.
Thus, the compression of the image to be compressed is realized. The compressed data includes first compressed data and second compressed data.
105. The compressed image is decompressed.
The compressed data includes first compressed data and second compressed data.
Decompressing the image:
decompressing the first compressed data by using a Huffman decoding method to obtain a new image in the compression process.
And according to the coordinates of the pixel points at the upper left corner and the coordinates of the pixel points at the lower right corner of each block in the second compressed data, the new image is segmented according to the sequence from left to right and from top to bottom.
And sequentially adding the mode of each block to the gray value of the unreduced pixel point in each block according to the sequence from left to right and from top to bottom, and reducing the pixel point in each block. The final result is the original image.
Thus, decompression of the image is completed, and an original image shot by the unmanned aerial vehicle is obtained.
Through the steps, the compression storage and decompression of the image data of the unmanned aerial vehicle are completed.
The embodiment of the invention acquires a category number set and a gray value sequence according to the image to be compressed; acquiring a clustering center according to the category number and the gray value sequence; calculating the combined distance from the pixel points to the clustering center to realize the classification of the pixel points; obtaining consistency of classification results; obtaining a clustering result according to the consistency of the classification result; calculating the compression probability of the clustering result to obtain an optimal clustering result; and performing block mode removing operation on the image according to the optimal clustering result, and further realizing image compression. Through selection of seed points, updating of a clustering center and gray consistency judgment in the classification operation, the gray value range of each category in the obtained clustering result is small, and the gray value distribution probability difference is large. And the gray level of each category in the optimal clustering result is unified and the shape is regular by calculating the compression probability. The gray values in each of the further resulting blocks are relatively uniform. The mode removing operation is carried out on each block, so that the gray values of all the blocks are compressed in a smaller range, the number of gray values appearing in a new image is smaller, and the distribution probability of different gray values is larger. And then the Huffman coding can achieve higher compression efficiency, and the compression efficiency is higher than that of directly compressing the image by utilizing the Huffman coding.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, alternatives, and improvements that fall within the spirit and scope of the invention.

Claims (4)

1. The efficient data compression and storage method for the unmanned aerial vehicle is characterized by comprising the following steps of:
s1: acquiring an image to be compressed, and acquiring a category number set and a gray value sequence according to a gray histogram of the image to be compressed;
s2: clustering the images to be compressed by using each category number in the category number set to obtain a plurality of clustering results, wherein the clustering method comprises the following steps:
s201: acquiring all seed points according to the category number and the gray value sequence;
s202: the seed points are used as cluster centers, and classifying operation is carried out on the images to be compressed according to all the cluster centers, wherein the classifying operation comprises the following steps:
acquiring the combined distance from each pixel point to each clustering center in the image to be compressed according to the gray value of each pixel point in the image to be compressed, the gray value of each clustering center, the distance from each pixel point to each clustering center, a second preset threshold value and the size of the image to be compressed; dividing each pixel point into categories of the cluster center with the minimum combined distance to obtain a plurality of categories;
obtaining the weight of each gray value according to each gray value in each category and the gray value of the clustering center of each category; acquiring the frequency of each gray value in each category; obtaining the gray consistency of each category according to the frequency of all gray values in each category and the weight of each gray value; taking the average value of the gray level consistency of all the categories as the consistency of the classification operation result;
acquiring all pixel points in each category, which have the same gray value as the gray value of the clustering center of the category, as clustering center candidate pixel points of the category; acquiring the mass center of the category; calculating the distance from each cluster center candidate pixel point of the category to the mass center of the category, and selecting the cluster center candidate pixel point with the minimum distance as a new cluster center;
s203: performing multiple iterations on the classification operation until the consistency of the obtained classification operation result is less than or equal to the consistency of the classification operation result of the previous iteration; taking a plurality of categories obtained in the last iteration as clustering results;
s3: obtaining the minimum circumscribed rectangle of each category in the clustering result; dividing the number of the pixel points in each category in the clustering result by the area of the minimum circumscribed rectangle of each category to obtain the regularity of each category in the clustering result; obtaining the compression probability of the clustering result according to the regularity of each category, the gray consistency of each category and the number of the categories in the clustering result;
s4: taking the clustering result with the maximum compression probability as an optimal clustering result; dividing the image to be compressed into a plurality of blocks according to the minimum circumscribed rectangle of each category in the optimal clustering result; acquiring the mode of gray values in each block of an image to be compressed; subtracting the mode of the gray value of each block from the gray value of all pixel points in each block of the image to be compressed to obtain a new block image; combining all new block images into a new image; encoding and compressing the new image;
the combined distance expression is:
wherein the method comprises the steps ofIs the +.>Pixel dot to +.>The combined distance of the clustering centers; />Is the +.>Gray values of the individual pixels; />Is the +.>Gray values of the clustering centers; />The difference between the maximum gray value and the minimum gray value in the image to be compressed; />A second preset threshold value; />Is the +.>Pixel dot and->The distance between the clustering centers in the image to be compressed; />Is the length of the image to be compressed; />Is the width of the image to be compressed;
the weight expression is:
wherein the method comprises the steps ofIs->The classification result of the second iteration +.>The +.>Weights of the individual gray values; />Is->The classification result of the second iteration +.>The +.>The gray value size; />Is->Gray values of cluster centers of the individual categories; />Indicate->The classification result of the second iteration +.>All gray values and +.>Maximum value of gray value difference of clustering centers of the individual categories;
the gray consistency expression is:
wherein the method comprises the steps ofIs->The classification result of the second iteration +.>Gray consistency of individual categories; />Is->The classification result of the second iteration +.>The +.>Weights of the individual gray values; />Is->The classification result of the second iteration +.>The +.>The frequency of the individual gray values; />Is->The classification result of the second iteration +.>The number of gray values occurring in the individual categories; />Is an exponential function with a natural constant as a base;
the compression probability expression is:
wherein the method comprises the steps ofIs->Compression probability of the individual clustering results; />Is->The (th) in the clustering result>Degree of regularity for each category; />Is->The (th) in the clustering result>Gray consistency of individual categories; />Is->The number of categories in the clustering results; />Is a negative exponential function with a base of natural constant.
2. The method for efficient compression and storage of data for a drone of claim 1, wherein the obtaining the set of class numbers and the sequence of gray values from the gray histogram of the image to be compressed comprises:
average filtering is carried out on a gray level histogram of an image to be compressed; obtaining the number of local maximum points in the gray level histogram; obtaining all integers from the number of the local maximum points to a first preset threshold interval to obtain a category number set;
obtaining a plurality of gray values corresponding to all local maximum points in the gray histogram to obtain a peak gray set; and respectively calculating the farthest distance between corresponding pixel points of each gray value in the peak gray set in the image to be compressed, and sequencing the gray values in the peak gray set according to the sequence from the largest distance to the smallest distance to obtain a gray value sequence.
3. The method for efficient compressed storage of data for an unmanned aerial vehicle according to claim 1, wherein the obtaining all seed points according to the number of categories and the sequence of gray values comprises:
obtaining the number of seed points corresponding to each gray value in the gray value sequence according to the quotient and remainder of the category number divided by the number of peak gray set elements;
and selecting seed points in the image to be compressed according to the number of the seed points corresponding to each gray value.
4. The method for efficient data compression and storage for an unmanned aerial vehicle according to claim 3, wherein selecting seed points in the image to be compressed according to the number of seed points corresponding to each gray value comprises:
acquiring all pixel points of each gray value in an image to be compressed, and forming a candidate seed point set of each gray value; randomly selecting a pixel point from the candidate seed point set as a seed point, and deleting the pixel point from the candidate seed point set;
repeatedly selecting the candidate seed point set until the number of the seed points obtained according to each gray value is consistent with the number of the seed points corresponding to each gray value;
the selecting operation is as follows:
calculating the sum of the distances from each pixel point in the candidate seed point set to all seed points; and selecting the pixel point with the largest sum of the distances as a seed point, and deleting the pixel point from the candidate seed point set.
CN202310146560.7A 2023-02-22 2023-02-22 Efficient data compression and storage method for unmanned aerial vehicle Active CN115834895B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310146560.7A CN115834895B (en) 2023-02-22 2023-02-22 Efficient data compression and storage method for unmanned aerial vehicle

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310146560.7A CN115834895B (en) 2023-02-22 2023-02-22 Efficient data compression and storage method for unmanned aerial vehicle

Publications (2)

Publication Number Publication Date
CN115834895A CN115834895A (en) 2023-03-21
CN115834895B true CN115834895B (en) 2023-12-15

Family

ID=85522048

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310146560.7A Active CN115834895B (en) 2023-02-22 2023-02-22 Efficient data compression and storage method for unmanned aerial vehicle

Country Status (1)

Country Link
CN (1) CN115834895B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116489369B (en) * 2023-06-26 2023-09-08 深圳市美力高集团有限公司 Driving digital video compression processing method
CN116580220B (en) * 2023-07-07 2023-09-22 江苏网进科技股份有限公司 Digital government platform data optimization transmission method and system
CN116582133B (en) * 2023-07-12 2024-02-23 东莞市联睿光电科技有限公司 Intelligent management system for data in transformer production process
CN116760952B (en) * 2023-08-17 2023-10-20 山东欣晖电力科技有限公司 Unmanned aerial vehicle-based electric power iron tower maintenance inspection method
CN117219248B (en) * 2023-11-09 2024-02-23 南通林德安全设备科技有限公司 Medical instrument management method for disinfection supply room
CN117851844A (en) * 2024-03-07 2024-04-09 西安乐驰科技有限公司 Efficient data storage method for weather measurement system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102129697A (en) * 2010-01-19 2011-07-20 北京大学 Method for compressing text image
WO2014021996A1 (en) * 2012-08-03 2014-02-06 Raytheon Company System and method for reduced incremental spectral clustering
CN106228557A (en) * 2016-07-26 2016-12-14 浙江捷尚视觉科技股份有限公司 Distorted image method for detecting area based on secondary JPEG compression
CN106658003A (en) * 2016-09-27 2017-05-10 清华大学 quantization method of dictionary learning-based image compression system
CN115311375A (en) * 2022-10-10 2022-11-08 南通安昇纺织品有限公司 Compression storage and transmission method and system for data of check fabric
CN115314714A (en) * 2022-10-12 2022-11-08 南通虎神金属制品有限公司 Data compression method for weld image storage

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102129697A (en) * 2010-01-19 2011-07-20 北京大学 Method for compressing text image
WO2014021996A1 (en) * 2012-08-03 2014-02-06 Raytheon Company System and method for reduced incremental spectral clustering
CN106228557A (en) * 2016-07-26 2016-12-14 浙江捷尚视觉科技股份有限公司 Distorted image method for detecting area based on secondary JPEG compression
CN106658003A (en) * 2016-09-27 2017-05-10 清华大学 quantization method of dictionary learning-based image compression system
CN115311375A (en) * 2022-10-10 2022-11-08 南通安昇纺织品有限公司 Compression storage and transmission method and system for data of check fabric
CN115314714A (en) * 2022-10-12 2022-11-08 南通虎神金属制品有限公司 Data compression method for weld image storage

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Dr. Varghese Paul."Compression of behavioral data using clustering technique".《International Conference on Microelectronics, Communication and Renewable Energy (ICMiCR-2013) 》.2013,全文. *
龚云."基于滑动窗口的密度聚类算法研究".《优秀硕士论文》.2012,全文. *

Also Published As

Publication number Publication date
CN115834895A (en) 2023-03-21

Similar Documents

Publication Publication Date Title
CN115834895B (en) Efficient data compression and storage method for unmanned aerial vehicle
US10728553B2 (en) Visual quality preserving quantization parameter prediction with deep neural network
Kekre et al. Improved texture feature based image retrieval using Kekre’s fast codebook generation algorithm
Tsai et al. Location coding for mobile image retrieval
US8660360B1 (en) System and method for reduced incremental spectral clustering
EP2511680A2 (en) Optimized orthonormal system and method for reducing dimensionality of hyperspectral Images
CN108510504A (en) Image partition method and device
CN104160409A (en) Method and system for image analysis
JP2006505075A (en) Nonlinear quantization and similarity matching method for video sequence retrieval with multiple image frames
CN109919202A (en) Disaggregated model training method and device
CN116471412B (en) Self-adaptive image compression method and system based on density clustering
CN116051896A (en) Hyperspectral image classification method of lightweight mixed tensor neural network
CN112115292A (en) Picture searching method and device, storage medium and electronic device
CN108537235A (en) A kind of method of low complex degree scale pyramid extraction characteristics of image
CN113536020B (en) Method, storage medium and computer program product for data query
CN113837202A (en) Feature point extraction method, image reconstruction method and device
CN111209862B (en) Clustering method, device and medium for face images
CA2773925A1 (en) Method and systems for computer-based selection of identifying input for class differentiation
CN109657083B (en) Method and device for establishing textile picture feature library
CN116089660A (en) Data storage method of monitoring system
CN106485686A (en) One kind is based on gravitational spectral clustering image segmentation algorithm
KR100984473B1 (en) Topological image model
CN112766335B (en) Image processing method and device, electronic equipment and storage medium
Yang Firefly algorithm and its variants in digital image processing
CN109670072B (en) Trademark similarity comparison method based on interval extraction

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20231122

Address after: Room 305-30, 3rd Floor, No. 21, Lane 88, Wuwei Road, Putuo District, Shanghai, 200333

Applicant after: Shanghai every moment Cultural Communication Co.,Ltd.

Address before: Room 102, Building 57, No. 218, Yongxing Road, Yongxing Street, Chongchuan District, Nantong City, Jiangsu Province, 226000

Applicant before: Chuangyin Technology (Nantong) Co.,Ltd.

GR01 Patent grant
GR01 Patent grant