CN114419172A - Panoramic image compression method and device, terminal equipment and storage medium - Google Patents

Panoramic image compression method and device, terminal equipment and storage medium Download PDF

Info

Publication number
CN114419172A
CN114419172A CN202210095715.4A CN202210095715A CN114419172A CN 114419172 A CN114419172 A CN 114419172A CN 202210095715 A CN202210095715 A CN 202210095715A CN 114419172 A CN114419172 A CN 114419172A
Authority
CN
China
Prior art keywords
image
pixels
split
compression
panoramic image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210095715.4A
Other languages
Chinese (zh)
Inventor
凌高源
肖龙报
朱力
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Insta360 Innovation Technology Co Ltd
Original Assignee
Insta360 Innovation 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 Insta360 Innovation Technology Co Ltd filed Critical Insta360 Innovation Technology Co Ltd
Priority to CN202210095715.4A priority Critical patent/CN114419172A/en
Publication of CN114419172A publication Critical patent/CN114419172A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • G06T9/20Contour coding, e.g. using detection of edges
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/168Segmentation; Edge detection involving transform domain methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/66Analysis of geometric attributes of image moments or centre of gravity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20048Transform domain processing
    • G06T2207/20061Hough transform

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Geometry (AREA)
  • Multimedia (AREA)
  • Studio Devices (AREA)

Abstract

The application provides a panoramic image compression method, a panoramic image compression device, terminal equipment and a storage medium, wherein the method comprises the following steps: splitting an initial panoramic image to obtain a split image, and determining effective pixels for compression in the split image; and compressing the split image according to the effective pixels to obtain a compressed split image. According to the panoramic image compression method, the split images forming the panoramic image can be subjected to pixel screening, so that some invalid pixels are filtered, the data size of the split images used for splicing the panoramic image is reduced, and the data size of the panoramic image is reduced. Therefore, when the panoramic image is compressed, the amount of processed data is reduced, and the compression efficiency of the panoramic image is improved. Further, since the data size of the panoramic image can be reduced, the storage cost for storing the panoramic image can also be reduced.

Description

Panoramic image compression method and device, terminal equipment and storage medium
Technical Field
The present application relates to the field of image processing, and in particular, to a panoramic image compression method, apparatus, terminal device, and storage medium.
Background
In different use scenes, according to different conditions, a user can select different shooting modes to shoot the scenes. For example: the user can select a general shooting mode to shoot a scene; or a panoramic mode is selected for shooting the scene. When the scene is shot by using the two different modes, the obtained images are different.
Specifically, an image is obtained through a general shooting mode, which is usually to shoot a scene once to obtain an image of the scene; or continuously shooting a scene to obtain a plurality of scene images, screening the image with the best shooting effect from the plurality of scene images by other technologies for modification, and obtaining a final scene image. When the panoramic shooting is performed, due to the limitation of a lens or hardware, a scene cannot be completely contained in one picture, the scene needs to be shot for multiple times, and multiple scene images are spliced together through modification by corresponding technologies, so that one panoramic image is obtained.
In general, a panoramic image has a larger amount of data than a general type of image. And when the image needs to be compressed or decompressed, the efficiency is lower than that of the general type of image. Therefore, the problem of low compression or decompression efficiency of the panoramic image needs to be solved.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present application and therefore may include information that does not constitute prior art known to a person of ordinary skill in the art.
Disclosure of Invention
The application provides a panoramic image compression method, which reduces compression time by compressing effective pixels in all pixels in a panoramic image instead of compressing the panoramic image completely.
In a first aspect, the present application provides a panoramic image compression method, including:
splitting an initial panoramic image to obtain a split image, and determining effective pixels for compression in the split image;
and compressing the split image according to the effective pixels to obtain a compressed split image.
In a second aspect, the present application also provides a panoramic image compression apparatus, the apparatus comprising:
the device comprises a pixel acquisition module, a compression module and a compression module, wherein the pixel acquisition module is used for splitting an initial panoramic image to obtain a split image and determining effective pixels for compression in the split image;
and the image compression module is used for compressing the split image according to the effective pixels to obtain a compressed split image.
In some embodiments of the present application, the pixel obtaining module is specifically configured to:
and obtaining effective pixels for compression in the split images by adopting multiple threads, wherein each thread at least obtains the effective pixels for compression in one split image, and each thread is not influenced by other threads when working.
In some embodiments of the present application, the pixel obtaining module is further specifically configured to:
and determining pixels in an image area in the split image as effective pixels for compression, and determining pixels in a non-image area as invalid pixels.
In some embodiments of the present application, the pixel obtaining module is further specifically configured to:
calculating the coordinates and the radius of the circle center of the image area;
and determining effective pixels for compression in the split image according to the coordinates of the circle center and the radius.
In some embodiments of the present application, the pixel obtaining module is further specifically configured to:
and calculating the distance between each pixel and the circle center according to the coordinates of each pixel in the split image and the coordinates of the circle center, and setting the pixels with the distances smaller than or equal to the radius as effective pixels.
In some embodiments of the present application, the pixel obtaining module is further specifically configured to:
determining to obtain a boundary pixel according to the coordinate of the circle center and the radius, wherein the distance between the boundary pixel and the coordinate of the circle center is equal to the radius;
and setting the pixel between the boundary pixel and the circle center as an effective pixel.
In a third aspect, the present application further provides a terminal device, where the terminal device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the steps in the panoramic image compression method.
In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the steps in the panoramic image compression method according to any one of the preceding claims.
According to the panoramic image compression method, the split images forming the panoramic image can be subjected to pixel screening, so that some invalid pixels are filtered, the data size of the split images used for splicing the panoramic image is reduced, and the data size of the panoramic image is reduced. Therefore, when the panoramic image is compressed, the amount of processed data is reduced, and the compression efficiency of the panoramic image is improved. Further, since the data size of the panoramic image can be reduced, the storage cost for storing the panoramic image can also be reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a scene schematic diagram of a panoramic image compression system provided in an embodiment of the present application;
FIG. 2 is a schematic flowchart of an embodiment of a panoramic image compression method in an embodiment of the present application;
FIG. 3 is a schematic diagram of an embodiment of splitting a panoramic image in an embodiment of the present application;
FIG. 4 is a flowchart illustrating an embodiment of a panoramic image compression method according to an embodiment of the present application;
fig. 5 is a schematic diagram of a functional block of a panoramic image compression apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a terminal device in the embodiment of the present application.
Detailed Description
The technical solutions 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, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the description of the present application, it is to be understood that the terms "first", "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
In this application, the word "exemplary" is used to mean "serving as an example, instance, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. The following description is presented to enable any person skilled in the art to make and use the application. In the following description, details are set forth for the purpose of explanation. It will be apparent to one of ordinary skill in the art that the present application may be practiced without these specific details. In other instances, well-known structures and processes are not set forth in detail in order to avoid obscuring the description of the present application with unnecessary detail. Thus, the present application is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
The present application provides a panoramic image compression method, apparatus, terminal device and computer readable storage medium, which are described in detail below.
Referring to fig. 1, fig. 1 is a schematic view of a scene of a panoramic image compression system according to an embodiment of the present application, where the panoramic image compression system may include a terminal device 100 and a storage device 200, and the storage device 200 may transmit data to the terminal device 100. Like the terminal device 100 in fig. 1, the panoramic image stored in the storage device 200 may be acquired to execute the panoramic image compression method in the present application.
In the embodiment of the present application, the terminal device 100 includes, but is not limited to, a desktop, a laptop, a web server, a Personal Digital Assistant (PDA), a tablet computer, a wireless terminal device, an embedded device, and the like.
In the embodiment of the present application, the terminal device 100 and the storage device 200 may implement communication through any communication manner, including but not limited to mobile communication based on the third Generation Partnership Project (3 GPP), Long Term Evolution (LTE), Worldwide Interoperability for Microwave Access (WiMAX), or computer network communication based on the TCP/IP Protocol Suite (TCP/IP), User Datagram Protocol (UDP), and the like.
It should be noted that the scene schematic diagram of the panoramic image compression system shown in fig. 1 is merely an example, and the panoramic image compression system and the scene described in the embodiment of the present application are for more clearly illustrating the technical solution of the embodiment of the present application, and do not form a limitation on the technical solution provided in the embodiment of the present application.
As shown in fig. 2, fig. 2 is a schematic flowchart of an embodiment of a panoramic image compression method in the embodiment of the present application, where the panoramic image compression method may include the following steps 201 to 202:
201. and splitting the initial panoramic image to obtain a split image, and determining effective pixels for compression in the split image.
Because the panoramic image is different from a common image in presentation mode, the panoramic image is an image formed by splicing a plurality of scene images. Therefore, the panoramic image needs to be split before the panoramic image compression is performed. Therefore, because the panoramic image is formed by splicing a plurality of images, splitting the panoramic image is not a pure physical splitting but is a reverse operation in the splicing process based on the panoramic image. However, in a normal case, the presentation shape of the panoramic image is a rectangle, and pixels of the scene are included in the rectangle. However, in an actual situation, when the camera device acquires each scene image for stitching the panoramic image, since the camera of the camera device is circular, the acquired scene image is circular (fish-eye shape), and when the panoramic image is finally presented, the circular scene images need to be stitched by a corresponding algorithm, so as to form the panoramic image seen by the user under normal conditions. As shown in fig. 3, the left side of fig. 3 shows the actual panoramic image, where the circular part in fig. 3 is the scene image actually captured by the image capturing device, and the part outside the circle is the black diagonal part, the non-scene image area, and the filled part. It is thus obtained that the data of the panoramic image actually includes unnecessary non-scene image areas, which are some invalid data. Therefore, when the panoramic image is compressed, the invalid data is also compressed. In order to avoid compressing these invalid data, it is necessary to remove these invalid data, i.e., some invalid pixels, so as to compress only the valid pixels in the valid scene image. Therefore, in order to remove these invalid pixels, the panoramic image needs to be split to obtain a separate split image, so that the valid pixels can be effectively obtained. The specific splitting mode can be split according to different camera devices. For example: when shooting is performed by the image pickup apparatus 1, since the image pickup apparatus 1 itself has product specifications, in other words, when shooting is performed by the image pickup apparatus 1, the size of each scene image is the same, the total length of the panoramic image may be measured and may be cut evenly, for example, the size of one panoramic image is 6080 (high) × 3040 (wide), and each spliced scene image is 3040 × 3040.
It should be noted that fig. 3 only shows the case where the split image is 2 sheets, but in actual cases, the split image may be a plurality of sheets. When the split image is multiple, the processing mode is the same. For example: if the data of the panoramic image is still the data listed in the above embodiment, the panoramic image may be divided into three images 3040 × 3040 assuming that the size of the panoramic image is 9120 (high) × 3040 (wide).
After splitting the split image, effective pixels of the split image need to be calculated, and since each split image is actually obtained by shooting according to the image capturing device, the shape of the area displaying the scene image in the split image is determined according to the shape of the image capturing device. For example: if the lens of the image pickup apparatus is elliptical, as illustrated in fig. 3, the circle in fig. 3 is elliptical. Therefore, to acquire the effective pixels in the split image, the effective pixels need to be acquired according to the shape specifically used for rendering the compressed image in the split image. If the shape is an ellipse, the center, the long radius and the short radius of the ellipse can be obtained according to the specification parameters of the lens of the imaging device, and the boundary position of the ellipse can be calculated according to the center, the long radius and the short radius of the ellipse, and at this time, the pixels in the boundary can be set as valid pixels, and the pixels outside the boundary can be set as invalid pixels. In this embodiment, only the case where the shape for representing the compressed image is an ellipse is cited, and since the lens shape of the image pickup apparatus may also be changed with the development of the technology or the like, the operation is the same when the shape is another shape.
For example: assuming that an image obtained by an image pickup apparatus has a square shape, the center of the square can be obtained, and after the center of the square image is obtained, the boundary position of a pixel where the square image is valid can be determined, specifically, the boundary position of a pixel where the square image is valid can be calculated by setting the maximum distance of the half diagonal line of the center of the square image as a long distance (corresponding to the long radius when the image is an ellipse), and setting the vertical distance from the center of the square image to any one side as a short distance (corresponding to the short radius when the image is an ellipse), so that the pixel boundary of the square image can be determined, and a pixel that falls outside the square image beyond the pixel boundary is an invalid pixel, and a pixel that falls inside the square image at the pixel boundary is a valid pixel.
Therefore, as can be seen from the foregoing description, the core idea of the manner for calculating effective pixels provided in the present application is to remove pixels that are not used for image rendering in the split image, only retain pixels that are used for image rendering, and then compress pixels that are used for image rendering, so that compression of pixels that are not used for image rendering can be avoided.
To better implement the embodiments of the present application, in one embodiment of the present application, the determining effective pixels for compression in the split image includes:
and obtaining effective pixels for compression in the split images by adopting multiple threads, wherein each thread at least obtains the effective pixels for compression in one split image, and each thread is not influenced by other threads when working.
According to the embodiments, after the split image is split, a plurality of split images can be obtained. If one process or one thread is used to correspond to all the split images, the calculation time of the effective pixels of each split image is increased when the effective pixels are calculated. For example: when a thread is used, the thread needs to calculate the effective pixels in the split image 1 first, and after the calculation is completed, the effective pixels in the split image 2 are calculated, and so on. Therefore, when a single thread calculates effective pixels of split images, the efficiency is lower when the processing efficiency is higher along with the number of the split images.
Therefore, in order to improve the efficiency of obtaining effective pixels, multithreading can be adopted to process the effective pixels in the multiple split images, so that the efficiency of obtaining the effective pixels can be improved. For example: when there are 6 split images, the effective pixel calculation can be performed by respectively corresponding one split image to each of 6 independent threads. Or, one thread may be made to correspond to two split images respectively through 3 independent threads to perform effective pixel calculation, etc., and of course, the setting may be performed according to an actual situation, and is not limited specifically here.
In addition, when processing images that need to be processed, for example, when calculating effective pixels of the corresponding images, between each thread, each thread does not affect other threads when performing its own operation, so that different calculation methods can be performed independently. For example: when a processing apparatus includes multiple threads, such as a multi-core processor, it is possible to process the corresponding image according to the special requirements of the user, such as: when the time difference between the compression method of the panoramic image in the application and the conventional compression method of the panoramic image is calculated, part of threads can compress the panoramic image by the conventional compression method of the panoramic image, and the part of threads can compress the image by the compression method of the panoramic image provided by the application, so that a user can obtain corresponding time data. This may allow for increased computational flexibility when computing valid pixels by separate threads. Of course, according to specific requirements, the following two ways of calculating effective pixels may be adopted, such that part of threads adopts a way of calculating effective pixels in a traversal manner, part of threads adopts a way of calculating effective pixels by a dichotomy, and so on.
In order to better implement the embodiments of the present application, in one embodiment of the present application, the split image includes an image area, the image area is used for characterizing image content, and effective pixels for compression in the split image are determined, as shown in fig. 4, the method may further include the following steps 301 to 302:
301. and calculating the coordinates and the radius of the center of the circle of the image area.
302. And determining effective pixels for compression in the split image according to the coordinates and the radius of the circle center.
According to the embodiments, since the shape of the image area for compression in the split image is determined according to the shape of the image capturing apparatus, while the lens is generally circular in the mainstream image capturing apparatus, the image area for compression in the split image is circular. Thus, the present embodiment provides a way to calculate the effective pixels when the image area is circular.
Similar to the case where the image area is an ellipse in the above embodiment, the circle center coordinate and the radius of the circle center of the image area can be obtained according to the specification parameters of the image pickup device, so that the area of the circular image area can be determined, and invalid pixels are filtered according to the circular area, thereby obtaining valid pixels for compression.
In addition, when specific parameters of the camera device are not clear, the circle center and the radius of the split image can be calculated in a Hough circle detection mode, wherein the Hough circle detection and circle solving idea comprises the following steps: considering that each non-zero pixel point on the image is possibly a point on a potential circle, as with hough line transformation, the cumulative coordinate plane is generated by voting, and a cumulative weight is set to locate the circle. Thus, it can be based on the Cartesian equation (x-a)2+(y-b)2=r2To determine the center and radius of the fish eye pattern in the split image, in a cartesian formula,a and b are circle centers and r is a radius, so that the cartesian formula can also be transformed into x ═ a + rcos θ and y ═ b + rsin θ, so that in a three-dimensional coordinate system formed by abr, one point can uniquely determine one circle. And all circles passing through a certain point in a Cartesian xy coordinate system are mapped into a three-dimensional curve in an abr coordinate system, and all circles passing through all non-zero pixel points in the xy coordinate system form a plurality of three-dimensional curves in the abr coordinate system. The equation of a circle for all points on the same circle in the xy coordinate system is the same, and they map to the same point in the abr coordinate system, so that the point in the abr coordinate system should have the N0 curves of the total pixels of the circle intersecting. By determining the number of intersections (accumulations) of each point in abr, points greater than a certain threshold are considered circles.
The above is a standard Hough circle transformation realization algorithm, and the problem is that the accumulation interviews a three-dimensional space, which means more calculation consumption than Hough line transformation. Therefore, the standard Hough circle transformation can be optimized in operation on the Hough circle transformation. In particular, the "Hough gradient method" can also be used. The detection idea of the Hough gradient method is to traverse and accumulate the circle centers corresponding to all the non-zero points and consider the circle centers. The centre of a circle must then be on the module vector of each point on the circle, i.e. on the vertical line perpendicular to the point and passing through the tangent of the point, the intersection of the module vectors on these circles being the centre of a circle. The Hough gradient method is to search the circle centers, and the final judgment is carried out according to the number of the intersected mould vectors on the circle center and the threshold value.
Of course, according to the development of the technology, the circle center and the radius of the split image can be obtained in other manners or emerging manners, and the details are not limited herein.
In order to better implement the embodiments of the present application, in one embodiment of the present application, determining effective pixels for compression in a split image according to coordinates and a radius of a circle center includes:
and calculating the distance between each pixel and the circle center according to the coordinates of each pixel in the split image and the coordinates of the circle center, and setting the pixels with the distance less than or equal to the radius as effective pixels.
According to the embodiment, the valid pixels can be acquired by filtering the invalid pixels in the small circular image area. However, when the area of the circular image region is generally calculated based on the coordinates of the center of the circle and the radius, an error is inevitably generated. Therefore, in order to reduce the error, the distance between each pixel point and the center of the circle in each split image may be calculated in the present embodiment. Specifically, the calculation can be performed by the following formula:
(X-Center.X)2+(Y-Center.Y)2>Radius2……①
wherein, X and Y in the formula (r) represent the abscissa and the ordinate of each pixel. Center.x and center.y represent the abscissa and ordinate of the center, Radius being the Radius of the circular image area. And substituting the coordinates of each pixel into the formula I for calculation, and if the formula is established, determining that the position of the pixel and the circle center is larger than the radius, and judging that the pixel is not in the circular image area. Through the embodiment of the application, the position of each pixel is traversed equivalently, so that the distance between each pixel and the circle center can be calculated, and the error can be reduced.
In order to better implement the embodiments of the present application, in one embodiment of the present application, determining effective pixels for compression in a split image according to coordinates and a radius of a circle center includes:
determining to obtain a boundary pixel according to the coordinate and the radius of the circle center, wherein the distance between the boundary pixel and the coordinate of the circle center is equal to the radius; and setting the pixel between the boundary pixel and the circle center as an effective pixel.
According to the embodiment, a mode of traversing the positions of all the pixel points in the split image to calculate the effective pixels can be adopted through a formula (i). Although the error can be reduced, the strategy of traversing is equal to calculating the position for each pixel. In order to improve the calculation efficiency when the error is still small, the embodiment of the present application may calculate the boundary of the circular image region by bisection. For example: randomly detecting whether the distance between one pixel point A and the circle in one split image is smaller than the radius, if so, selecting another random pixel point B larger than the distance to detect, and also detecting whether the distance between the other pixel point B and the circle center is smaller than the radius, if still smaller than the radius, continuing to randomly select a pixel point C at a place other than the other pixel point B, and calculating the relation with the radius. If the radius is larger than the radius, a radius is randomly selected between the pixel point B and the pixel point A until all the pixels of the same type and the pixel points with the circle center positions equal to the radius are obtained, so that the boundary pixels of the circular image area are obtained, the calculation can be directly finished at the moment, and the pixels between the boundary and the circle center are directly determined as the effective pixels. The method does not need to traverse all pixels, and can reduce the time for calculating the effective pixels under the condition of ensuring small calculation error.
202. And compressing the split image according to the effective pixels to obtain a compressed split image.
After the calculation of the effective pixels in the split image is completed according to the above steps, the effective pixels are compressed, wherein the compression mode can be as follows: from the start of the image to the end of the image, the processing is done byte by byte backwards. The string starting with the currently processed byte is matched against each string in the sliding window, finding the longest matching string. If the string starting with the currently processed byte has a matching string in the window, a flag bit is output first indicating that a (distance between, match length) pair is below, then the (distance between, match length) pair is output, and then processing continues from the next byte after the just processed string. If the string from the beginning of the currently processed byte does not match the string in the window, a flag bit is output first indicating that an unmodified byte is below, then the currently processed byte is output without modification, and then the next byte of the currently processed byte is processed. Specifically, the color information of each pixel is used as a processing byte, for example, the file format of the image is analyzed, and then the color information of each pixel in the image is analyzed, for example: RGB information, saturation information, luminance information, and the like, and after the analysis is completed, a corresponding compression operation may be performed, and a specific compression method is not limited herein.
In addition, after the panoramic image is compressed by the method mentioned in the embodiment of the present application, compared with the conventional compression method, since the invalid pixels are not compressed, the data size of the panoramic image compressed by the present application is smaller than that of the panoramic image compressed by the prior art, and therefore, the required storage space is smaller when the panoramic image compressed by the embodiment of the present application is stored.
According to the panoramic image compression method, the split images forming the panoramic image can be subjected to pixel screening, so that some invalid pixels are filtered, the data size of the split images used for splicing the panoramic image is reduced, and the data size of the panoramic image is reduced. Therefore, when the panoramic image is compressed, the amount of processed data is reduced, and the compression efficiency of the panoramic image is improved. Further, since the data size of the panoramic image can be reduced, the storage cost for storing the panoramic image can also be reduced.
In order to better implement the embodiment of the present application, in an embodiment of the present application, the split image includes an image region, the image region is used to represent image content, the split image is compressed according to effective pixels, and after the compressed split image is obtained, the method further includes:
and decompressing the compressed split image to obtain a decompressed split image.
According to the above-described embodiments, it is possible to actually complete the compression of the split images for composing the panoramic image after the compression of the panoramic image is completed. However, in general, after the corresponding file is compressed, if the user needs to use the compressed file, the user needs to decompress the compressed file to use the corresponding file. Similarly, the compressed panoramic image is also similarly decompressed, and the decompressed split image can be continuously spliced into a panoramic image again for the user to check the image. The decompression method may be: from the beginning of the image to the end of the image, a flag bit is read first, and whether a (distance between, matching length) pair or an unmodified byte is below is judged through the flag bit. If the current position is a pair (distance between the two pairs, matching length), the pair (distance between the two pairs, matching length) with a fixed number of positions is read, and then the matching string is output to the current position according to the information in the pair. If it is a byte that has not been changed, a byte is read out and then output. Specifically, each pixel in the compressed image information is analyzed to obtain color information of each pixel, for example: and the RGB information, the saturation information, the brightness information and the like can be obtained by decompressing each pixel according to the own color information and then restoring the pixel to the file format of the image before being compressed. The specific decompression method is not limited in this application.
To better implement the embodiments of the present application, in one embodiment of the present application, decompressing a compressed split image to obtain a decompressed split image includes:
calculating coordinates and radius of the circle center of the image area of the compressed split image; determining to obtain effective decompressed pixels in an image area of the compressed split image according to the coordinates and the radius of the circle center; and decompressing the compressed split image according to the effective decompressed pixels.
According to the above embodiments, when compressing a panoramic image, it is possible to reduce the compression time by calculating the effective pixels of the panoramic image, and compressing the panoramic image after excluding the ineffective pixels. Similarly, in the step of decompressing, the time for decompressing can be reduced by using this manner as well.
For example: when the compressed panoramic image in a storage medium needs to be decompressed, since the compressed split image in the compressed panoramic image may be an image compressed by the above embodiment or an image not compressed by the above compression method, in order to save the step of determining whether the image is compressed by the above image, the center coordinates and radius of the image area of the compressed split image can be directly calculated,
the center and radius of the compressed split image do not need to be judged, so that the center and radius of the split image which is compressed once need to be recalculated. After the center and radius of the compressed split image are calculated, the compressed image is still compressed through the formula (i).
At this time, X and Y in the formula (r) represent the abscissa and ordinate of the pixel in each compressed split image. Center.x and center.y represent the abscissa and ordinate of the center of the compressed split image, Radius being the Radius of the circular image area of the compressed split image. And substituting the coordinates of each pixel into the formula I for calculation, and if the formula is established, determining that the position of the pixel and the circle center is larger than the radius, and judging that the pixel is not in the circular image area. Through the embodiment of the application, the position of each pixel is traversed equivalently, so that the distance between each pixel and the circle center can be calculated, and the error can be reduced. When the calculation is carried out, which pixels in the compressed split image are effective decompression pixels can be determined, only the effective decompression pixels can be decompressed, the ineffective pixels do not need to be decompressed, and the decompression efficiency is improved. The decompression method may be the prior art, and is not described herein again.
In order to better implement the embodiments of the present application, in one embodiment of the present application, determining effective decompressed pixels in an image area of a compressed split image according to coordinates and a radius of a circle center includes:
calculating the distance between each pixel coordinate and the coordinate of the circle center; determining pixels with the distance between each pixel coordinate and the coordinate of the circle center smaller than or equal to the radius as effective decompression pixels; or determining to obtain a boundary pixel according to the coordinate and the radius of the circle center, wherein the distance between the boundary pixel and the coordinate of the circle center is equal to the radius; and determining the pixels between the boundary pixels and the circle center as effective decompression pixels.
According to the embodiment, a mode of traversing the positions of all pixel points in the compressed split image to calculate the effective decompressed pixels can be adopted through a formula (i). As in the above embodiments, although the error can be reduced, the strategy of traversing is equal to the calculation of the position for each pixel. In order to improve the calculation efficiency when the error is still small, the embodiment of the present application may still calculate the boundary of the circular image region by bisection. For example: randomly detecting whether the distance between one pixel point A and the circle in a compressed split image is smaller than the radius, if so, selecting another random pixel point B larger than the distance to detect, and similarly, detecting whether the distance between the other pixel point B and the circle center is smaller than the radius, if still smaller than the radius, continuing to randomly select a pixel point C at a place other than the other pixel point B, and calculating the relation with the radius. If the radius is larger than the radius, a radius is randomly selected between the pixel point B and the pixel point A until all the pixels of the same type and the pixel points with the circle center positions equal to the radius are obtained, so that the boundary pixels of the circular image area are obtained, the calculation can be directly finished at the moment, and the pixels between the boundary and the circle center are directly determined as the effective decompression pixels. The method does not need to traverse all pixels, and can reduce the time for calculating the effective decompression pixels under the condition of ensuring small calculation error.
According to the panoramic image decompression method, the split images forming the panoramic image can be subjected to pixel screening, so that some invalid pixels are filtered, the data size of the split images used for splicing the panoramic image is reduced, and the data size of the panoramic image is reduced. Therefore, when the panoramic image is decompressed, the processed data amount is reduced, and the decompression efficiency of the panoramic image is improved.
It should be noted that although the various steps of the methods in this application are depicted in the drawings in a particular order, this does not require or imply that these steps must be performed in this particular order, or that all of the shown steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
In order to better implement the panoramic image compression method in the embodiment of the present application, in addition to the panoramic image compression method, an embodiment of the present application further provides a panoramic image compression apparatus, as shown in fig. 5, the apparatus 400 includes:
a pixel obtaining module 401, configured to split the initial panoramic image to obtain a split image, and determine effective pixels for compression in the split image;
and an image compression module 402, configured to compress the split image according to the effective pixels, so as to obtain a compressed split image.
The panoramic image compression device provided by the application can carry out pixel screening on split images forming the panoramic image through the pixel acquisition module 401, so that invalid pixels are filtered, the data volume of the split images for splicing the panoramic image is reduced, and the data volume of the panoramic image is reduced. Therefore, when the panoramic image is compressed by the image compression module 402, the amount of processed data is reduced, thereby improving the compression efficiency of the panoramic image. Further, since the data size of the panoramic image can be reduced, the storage cost for storing the panoramic image can also be reduced.
In some embodiments of the present application, the pixel obtaining module 401 is specifically configured to:
and obtaining effective pixels for compression in the split images by adopting multiple threads, wherein each thread obtains at least one effective pixel for compression in the split image.
In some embodiments of the present application, the pixel obtaining module 401 is further specifically configured to:
and determining pixels in an image area in the split image as effective pixels for compression, and determining pixels in a non-image area as ineffective pixels.
In some embodiments of the present application, the pixel obtaining module 401 is further specifically configured to:
calculating the coordinates and the radius of the circle center of the image area;
and determining effective pixels for compression in the split image according to the coordinates and the radius of the circle center.
In some embodiments of the present application, the pixel obtaining module 401 is further specifically configured to:
and calculating the distance between each pixel and the circle center according to the coordinates of each pixel in the split image and the coordinates of the circle center, and setting the pixels with the distance less than or equal to the radius as effective pixels.
In some embodiments of the present application, the pixel obtaining module 401 is further specifically configured to:
determining to obtain a boundary pixel according to the coordinate and the radius of the circle center, wherein the distance between the boundary pixel and the coordinate of the circle center is equal to the radius;
and setting the pixel between the boundary pixel and the circle center as an effective pixel.
The embodiment of the present application further provides a terminal device, where the terminal device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the steps in the panoramic image compression method according to any one of the embodiments of the present application. The terminal device, which integrates any panoramic image compression method provided in the embodiments of the present application, as shown in fig. 6, shows a schematic structural diagram of the terminal device according to the embodiments of the present application, specifically:
the terminal device may include components such as a processor 501 of one or more processing cores, memory 502 of one or more computer-readable storage media, a power supply 503, and an input unit 504. Those skilled in the art will appreciate that the terminal device configuration shown in fig. 6 does not constitute a limitation of the terminal device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the processor 501 is a control center of the terminal device, connects various parts of the whole terminal device by various interfaces and lines, and executes various functions of the terminal device and processes data by running or executing software programs and/or modules stored in the memory 502 and calling data stored in the memory 502, thereby performing overall monitoring of the terminal device. Optionally, processor 501 may include one or more processing cores; the Processor 501 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like and preferably the processor 501 may integrate an application processor, which handles primarily the operating system, user interfaces, application programs, etc., and a modem processor, which handles primarily wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 501.
The memory 502 may be used to store software programs and modules, and the processor 501 executes various functional applications and data processing by operating the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to the use of the terminal device, and the like. Further, the memory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.
The terminal device further comprises a power source 503 for supplying power to each component, and preferably, the power source 503 may be logically connected to the processor 501 through a power management system, so that functions of managing charging, discharging, power consumption, and the like are realized through the power management system. The power supply 503 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The terminal device may further include an input unit 504, and the input unit 504 may be used to receive input numeric or character information and generate a keyboard, mouse, joystick, optical or trackball signal input in relation to user settings and function control.
Although not shown, the terminal device may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 501 in the terminal device loads the executable file corresponding to the process of one or more application programs into the memory 502 according to the following instructions, and the processor 501 runs the application program stored in the memory 502, so as to implement various functions, for example:
splitting an initial panoramic image to obtain a split image, and determining effective pixels for compression in the split image;
and compressing the split image according to the effective pixels to obtain a compressed split image.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present application provides a computer-readable storage medium, which may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like. The computer program is loaded by a processor to execute the steps in any one of the panoramic image compression methods provided by the embodiments of the present application. For example, the computer program may be loaded by a processor to perform the steps of:
splitting an initial panoramic image to obtain a split image, and determining effective pixels for compression in the split image;
and compressing the split image according to the effective pixels to obtain a compressed split image.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and parts that are not described in detail in a certain embodiment may refer to the above detailed descriptions of other embodiments, and are not described herein again.
In a specific implementation, each unit or structure may be implemented as an independent entity, or may be combined arbitrarily to be implemented as one or several entities, and the specific implementation of each unit or structure may refer to the foregoing method embodiment, which is not described herein again.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
The method and the apparatus for compressing a panoramic image provided by the embodiment of the present application are described in detail above, and a specific example is applied in the description to explain the principle and the embodiment of the present application, and the description of the above embodiment is only used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (13)

1. A panoramic image compression method, characterized in that the method comprises:
splitting an initial panoramic image to obtain a split image, and determining effective pixels for compression in the split image;
and compressing the split image according to the effective pixels to obtain a compressed split image.
2. The panoramic image compression method of claim 1, wherein the determining the effective pixels for compression in the split image comprises:
and obtaining effective pixels for compression in the split images by adopting multiple threads, wherein each thread at least obtains the effective pixels for compression in one split image, and each thread is not influenced by other threads when working.
3. The panoramic image compression method of claim 1 or 2, wherein the split image includes an image area, the image area is used for representing image content, and the determining effective pixels for compression in the split image includes:
and determining pixels in an image area in the split image as effective pixels for compression, and determining pixels in a non-image area as invalid pixels.
4. The panoramic image compression method of claim 3, wherein the determining that the pixels in the image area in the split image are valid pixels for compression comprises:
calculating the coordinates and the radius of the circle center of the image area;
and determining effective pixels for compression in the split image according to the coordinates of the circle center and the radius.
5. The panoramic image compression method of claim 4, wherein the determining the effective pixels for compression in the split image according to the coordinates of the circle center and the radius comprises:
determining to obtain a boundary pixel according to the coordinate of the circle center and the radius, wherein the distance between the boundary pixel and the coordinate of the circle center is equal to the radius;
and setting the pixel between the boundary pixel and the circle center as an effective pixel.
6. The panoramic image compression method of claim 4, wherein the determining the effective pixels for compression in the split image according to the coordinates of the circle center and the radius comprises:
and calculating the distance between each pixel and the circle center according to the coordinates of each pixel in the split image and the coordinates of the circle center, and setting the pixels with the distances smaller than or equal to the radius as effective pixels.
7. The panoramic image compression method according to claim 1, wherein the split image includes an image area, the image area is used to represent image content, and after the split image is compressed according to the effective pixels to obtain a compressed split image, the method further includes:
and decompressing the compressed split image to obtain a decompressed split image.
8. The panoramic image compression method of claim 7, wherein the decompressing the compressed split image to obtain a decompressed split image comprises:
calculating coordinates and radius of the center of a circle of the image area of the compressed split image;
determining to obtain effective decompressed pixels in an image area of the compressed split image according to the coordinates of the circle center and the radius;
and decompressing the compressed split image according to the effective decompressed pixels.
9. The panoramic image compression method of claim 8, wherein the determining, according to the coordinates of the center of the circle and the radius, effective decompressed pixels in an image area of the compressed split image comprises:
determining to obtain a boundary pixel according to the coordinate of the circle center and the radius, wherein the distance between the boundary pixel and the coordinate of the circle center is equal to the radius;
and determining the pixels between the boundary pixels and the circle center as effective decompression pixels.
10. The panoramic image compression method of claim 8, wherein the determining, according to the coordinates of the center of the circle and the radius, effective decompressed pixels in an image area of the compressed split image comprises:
calculating the distance between each pixel coordinate and the coordinate of the circle center;
and determining the pixels of which the distance between the coordinates of each pixel and the coordinates of the circle center is smaller than or equal to the radius as effective decompression pixels.
11. A panoramic image compression apparatus, characterized in that the apparatus comprises:
the device comprises a pixel acquisition module, a compression module and a compression module, wherein the pixel acquisition module is used for splitting an initial panoramic image to obtain a split image and determining effective pixels for compression in the split image;
and the image compression module is used for compressing the split image according to the effective pixels to obtain a compressed split image.
12. A terminal device, characterized in that the terminal device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, the processor executing the computer program to implement the steps in the panoramic image compression method of any one of claims 1 to 10.
13. A computer-readable storage medium, having stored thereon a computer program for execution by a processor to perform the steps of the panoramic image compression method of any one of claims 1 to 10.
CN202210095715.4A 2022-01-26 2022-01-26 Panoramic image compression method and device, terminal equipment and storage medium Pending CN114419172A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210095715.4A CN114419172A (en) 2022-01-26 2022-01-26 Panoramic image compression method and device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210095715.4A CN114419172A (en) 2022-01-26 2022-01-26 Panoramic image compression method and device, terminal equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114419172A true CN114419172A (en) 2022-04-29

Family

ID=81277933

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210095715.4A Pending CN114419172A (en) 2022-01-26 2022-01-26 Panoramic image compression method and device, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114419172A (en)

Similar Documents

Publication Publication Date Title
CN112308095A (en) Picture preprocessing and model training method and device, server and storage medium
CN108337551B (en) Screen recording method, storage medium and terminal equipment
EP4086840A1 (en) Video denoising method and electronic device
US20230105393A1 (en) Image processing method, image processing device, and computer device
CN113139905B (en) Image stitching method, device, equipment and medium
CN111127358A (en) Image processing method, device and storage medium
CN113888509A (en) Method, device and equipment for evaluating image definition and storage medium
CN114419172A (en) Panoramic image compression method and device, terminal equipment and storage medium
CN113326836B (en) License plate recognition method, license plate recognition device, server and storage medium
CN113935993B (en) Enteroscope image recognition system, terminal device, and storage medium
CN116847103A (en) Image compression method, device, electronic equipment and storage medium
CN117314758A (en) Image processing method, device, terminal equipment and computer readable storage medium
CN106228519B (en) A kind of image repair method and terminal
CN111866336A (en) Pan-tilt camera, camera control method and storage medium
CN116939171B (en) Power transmission line monitoring method, device and computer equipment
CN113344068B (en) Material processing method, device, electronic equipment and computer readable storage medium
CN116886845B (en) Adaptive parameter updating method, device, computer equipment and storage medium
CN114374798B (en) Scene recognition method, device, electronic equipment and computer readable storage medium
CN117593211A (en) Video processing method, device, electronic equipment and storage medium
CN115118989B (en) Image compression method and device
CN113610134B (en) Image feature point matching method, device, chip, terminal and storage medium
CN110008951B (en) Target detection method and device
CN115689905A (en) Image processing method, device, terminal equipment and computer readable storage medium
Menant et al. A comparison of cost construction methods onto a c6678 platform for stereo matching
CN117765050A (en) Building texture image acquisition method and device, electronic 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