CN115883840A - Image encoding method, image encoding device, electronic device, and storage medium - Google Patents

Image encoding method, image encoding device, electronic device, and storage medium Download PDF

Info

Publication number
CN115883840A
CN115883840A CN202211409833.4A CN202211409833A CN115883840A CN 115883840 A CN115883840 A CN 115883840A CN 202211409833 A CN202211409833 A CN 202211409833A CN 115883840 A CN115883840 A CN 115883840A
Authority
CN
China
Prior art keywords
pixel
point
pixel point
image
obtaining
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
CN202211409833.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.)
Voiceai Technologies Co ltd
Original Assignee
Voiceai Technologies 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 Voiceai Technologies Co ltd filed Critical Voiceai Technologies Co ltd
Priority to CN202211409833.4A priority Critical patent/CN115883840A/en
Publication of CN115883840A publication Critical patent/CN115883840A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The application discloses an image coding method, an image coding device, electronic equipment and a storage medium. The method comprises the following steps: carrying out color conversion on the pixel value of each pixel point in the image to be coded to obtain the color value corresponding to each pixel point; obtaining a frequency coordinate corresponding to each pixel point according to a preset sampling rate and the pixel coordinate of each pixel point in the image to be coded; obtaining an amplitude sequence corresponding to a preset sampling rate according to the preset sampling rate, the color value corresponding to each pixel point and the frequency coordinate; and obtaining the coded audio according to the amplitude sequence and the preset sampling rate. By the method, the obtained coded audio completely comprises the information in the image, so that the accuracy of the obtained coded audio is higher, the information with higher accuracy can be obtained from the coded audio, and the information can be accurately obtained from the image.

Description

Image encoding method, image encoding device, electronic device, and storage medium
Technical Field
The present application relates to the field of audio processing technologies, and in particular, to an image encoding method and apparatus, an electronic device, and a storage medium.
Background
With the rapid popularization of internet technology, the image can carry more and more information, for example, the two-dimensional code can carry information such as payment, verification information, link skip, user registration, information inquiry and the like.
However, in a motion scene such as driving or a scene with poor light, it is difficult to clearly observe information in an image, and the accuracy of information obtained from the image is low.
Disclosure of Invention
In view of this, an embodiment of the present application provides an image encoding method, an apparatus, an electronic device, and a storage medium.
In a first aspect, an embodiment of the present application provides an image encoding method, where the method includes: carrying out color conversion on the pixel value of each pixel point in the image to be coded to obtain the color value corresponding to each pixel point; obtaining a frequency coordinate corresponding to each pixel point according to a preset sampling rate and the pixel coordinate of each pixel point in the image to be coded; obtaining an amplitude sequence corresponding to a preset sampling rate according to the preset sampling rate, the color value corresponding to each pixel point and the frequency coordinate; and obtaining the coded audio according to the amplitude sequence and the preset sampling rate.
In a second aspect, an embodiment of the present application provides an apparatus for training an image coding model, where the apparatus includes: the color conversion module is used for performing color conversion on the pixel value of each pixel point in the image to be coded to obtain the color value corresponding to each pixel point; the coordinate conversion module is used for obtaining a frequency coordinate corresponding to each pixel point according to a preset sampling rate and the pixel coordinate of each pixel point in the image to be coded; the sequence obtaining module is used for obtaining an amplitude sequence corresponding to a preset sampling rate according to the preset sampling rate, the color value corresponding to each pixel point and the frequency coordinate; and the audio obtaining module is used for obtaining the coded audio according to the amplitude sequence and the preset sampling rate.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory; one or more programs are stored in the memory and configured to be executed by the processor to implement the methods described above.
In a fourth aspect, the present application provides a computer-readable storage medium having program code stored therein, where the program code executes the method described above when executed by a processor.
In a fifth aspect, embodiments of the present application provide a computer program product or a computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the method.
According to the image coding method and device, the electronic device and the storage medium, the image to be coded is coded into the coded audio, even if the coded audio is in a motion scene such as driving or a scene with poor light, the obtained coded audio can be ensured to be complete and include information in the image, so that the accuracy of the obtained coded audio is high, the information with high accuracy can be obtained from the coded audio, and the accurate information obtaining from the image is realized.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that the present application can also be implemented without inventive efforts
Fig. 1 is a flowchart illustrating an image encoding method according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating an image to be encoded according to an embodiment of the present application;
FIG. 3 illustrates a time domain diagram of encoded audio corresponding to the image to be encoded in FIG. 2;
FIG. 4 shows a spectrogram corresponding to the image to be encoded in FIG. 2;
FIG. 5 shows a schematic diagram of region A in the spectrogram of FIG. 4;
FIG. 6 is a flow chart illustrating an image encoding method according to yet another embodiment of the present application;
fig. 7 is a block diagram showing an image encoding apparatus according to an embodiment of the present application;
fig. 8 is a block diagram illustrating an electronic device according to an embodiment of the present application;
fig. 9 shows a block diagram of a computer-readable storage medium according to an 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 obtained by a person of ordinary skill in the art without any inventive work according to the embodiments of the present application are within the scope of the present application.
In the following description, references to the terms "first", "second", and the like are only used for distinguishing similar objects and do not denote a particular order or importance, but rather the terms "first", "second", and the like may be used interchangeably with the order of priority or the order in which they are expressed, where permissible, to enable embodiments of the present application described herein to be practiced otherwise than as specifically illustrated and described herein.
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 application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the application.
Referring to fig. 1, fig. 1 is a flowchart illustrating an image encoding method according to an embodiment of the present application, where the method may be used in an electronic device, and the method includes:
s110, carrying out color conversion on the pixel value of each pixel point in the image to be coded to obtain the color value corresponding to each pixel point.
In the application, the image to be encoded may refer to an image carrying information to be identified, and the information to be identified may be payment information, verification information, link skip information, user registration or information query, for example, the image to be encoded is a two-dimensional code carrying payment information.
The image to be encoded can be an image in an RGB format, and the R pixel value (red pixel value), the G pixel value (green pixel value) and the B pixel value (blue pixel value) of each pixel point in the image to be encoded are subjected to color conversion so as to realize the normalization and unification of R, G and B three-color values, and obtain the color value of each pixel point.
As an embodiment, the image to be encoded is preprocessed to obtain a processed image, where the preprocessing includes at least one of an enlargement process, a reduction process, and a cropping process (e.g., cropping out an area including the information to be identified); and then, carrying out color conversion on the pixel value of each pixel point in the processed image to obtain the color value corresponding to each pixel point.
Optionally, S110 may include: acquiring a red pixel value, a green pixel value and a blue pixel value of each pixel point; obtaining a color value of each pixel point according to a formula II, the color brightness coefficient, and the red pixel value, the green pixel value and the blue pixel value of each pixel point;
the second formula is:
Figure BDA0003937084570000041
wherein, colcor i,j Is the color value of a pixel point q (i, j), i and j are respectively the abscissa and the ordinate of the pixel point q in the image to be coded, alpha is the color brightness coefficient, r i,j 、g i,j And b i,j The red pixel value, the green pixel value and the blue pixel value of the pixel point q are respectively. In this case, the smaller α is, the brighter α is, and α may be 30 in the present application, for example.
And S120, obtaining a frequency coordinate corresponding to each pixel point according to a preset sampling rate and the pixel coordinate of each pixel point in the image to be coded.
In this embodiment, the preset sampling rate may be a sampling rate determined by the user based on the demand and the actual scene, for example, the preset sampling rates of the image to be encoded in the traffic scene and the image to be encoded in the shopping scene may be different.
The pixel coordinate of each pixel point in the image to be coded can be determined, and then the frequency coordinate of each pixel point is obtained according to the preset sampling rate and the pixel coordinate of each pixel point.
As an embodiment, S120 may include: obtaining a frequency coordinate corresponding to each pixel point according to a formula III, a preset sampling rate, the total line number of the pixel points in the image to be coded and the line number of the line of each pixel point in the image to be coded;
the third formula is:
Figure BDA0003937084570000042
wherein, axis i,j Is the frequency coordinate, F, of pixel point q (i, j) s For the preset sampling rate, H is the total row number of the pixel points in the image to be encoded (for example, if the image to be encoded is a 256 × 256 image, H is 256), and j is the row number (or vertical coordinate value) of the row of the pixel point q (i, j) in the image to be encoded.
For example, if the size of the image to be encoded is W × H, the abscissa of each pixel point is i =1, \ 8230;, W, and the ordinate j =1, \ 8230;, H. According to the third formula, the frequency coordinate values of the multiple pixel points in each row are the same, and the frequency coordinate values of the pixel points in each column are different.
And S130, obtaining an amplitude sequence corresponding to the preset sampling rate according to the preset sampling rate, the color value corresponding to each pixel point and the frequency coordinate.
The sampling rate, the color value corresponding to each pixel point and the frequency coordinate can be preset, the amplitude (also called amplitude) of the sampling point corresponding to each pixel point is obtained, the amplitudes of the sampling points are sequenced according to the sequence of each pixel point and the sequence of the sampling points under each pixel point, and the corresponding amplitude sequence of all samples is obtained.
For example, the image to be encoded is a 12 × 12 image, each pixel corresponds to 3 sampling points, 144 pixels each correspond to 3 sampling points, 144 pixels are arranged according to a certain fixed sequence (for example, each row of pixels is arranged from left to right, from top to bottom, and a pixel corresponding to the 4 th row counted from top to bottom is a 16 th pixel), each pixel corresponds to 3 sampling points and is arranged according to another fixed sequence, after the amplitude of each sampling point of each pixel is determined, the amplitude of each 144 × 3 sampling point is arranged according to the arrangement sequence of the pixel and the arrangement sequence of the sampling points under each pixel, so as to obtain an amplitude sequence.
And S140, obtaining the coded audio according to the amplitude sequence and the preset sampling rate.
After obtaining the amplitude sequence, the audio is generated as encoded audio by using the amplitude sequence and a preset sampling rate. After the encoded audio is obtained, operations such as playing, recording, broadcasting and the like can be performed on the encoded audio.
The encoded audio is obtained, and the encoded audio can be identified to identify the content in the encoded audio, where the identified content is the information to be identified in the image to be encoded, that is, the identification result includes the information to be identified.
For example, the image to be encoded is a payment two-dimensional code, the encoded audio corresponding to the payment two-dimensional code is obtained by the method of the embodiment, and content identification is performed on the encoded audio to obtain an identification result, where the identification result includes payment information in the payment two-dimensional code.
For another example, the image to be encoded is a face image, the encoded audio corresponding to the face image is obtained by the method of this embodiment, and content identification is performed on the encoded audio to obtain an identification result, where the identification result includes face information in the face image.
As an embodiment, the recognition result may further include a spectrogram, and the method may further include: and processing the coded audio through Fourier transform to obtain a spectrogram, and outputting the spectrogram.
In this embodiment, the encoded audio is processed through fourier transform to obtain a spectrogram, and the spectrogram is output, so that a user can compare the spectrogram with an original image to be encoded, and determine whether the spectrogram and the original image to be encoded include the same information.
As shown in fig. 2-5, fig. 2 is an image to be encoded, fig. 3 is a time domain diagram of an encoded audio corresponding to the image to be encoded shown in fig. 2, fig. 4 is a spectrogram corresponding to the image to be encoded shown in fig. 2, and fig. 5 is a schematic diagram of an area a in the spectrogram shown in fig. 4.
In this embodiment, an image to be encoded is encoded into an encoded audio, and then the encoded audio is subjected to content identification to obtain an identification result, so that even if the audio is in a motion scene such as driving or in a scene with poor light, the obtained encoded audio can be ensured to be complete and include information in the image, and the accuracy of the obtained encoded audio is high, so that the information with high accuracy can be obtained from the encoded audio, and the information can be accurately obtained from the image.
Referring to fig. 6, fig. 6 is a flowchart illustrating an image encoding method according to another embodiment of the present application, where the method may be applied to an electronic device, and the method includes:
s210, carrying out color conversion on the pixel value of each pixel point in the image to be coded to obtain the color value corresponding to each pixel point.
And S220, obtaining a frequency coordinate corresponding to each pixel point according to a preset sampling rate and the pixel coordinate of each pixel point in the image to be coded.
The descriptions of S210-S220 refer to the descriptions of S110-S120 above, and are not repeated here.
And S230, obtaining a plurality of initial sampling points corresponding to each pixel point according to the preset sampling rate and the target duration aiming at each pixel point.
In this embodiment, the target durations of the multiple pixels in each column may be the same, and the target durations of the pixels in different columns may also be the same, that is, the target durations of the pixels may be the same. For example, the target duration of each pixel point may be 0.2s.
And aiming at each pixel point, taking the product of the target duration and the preset sampling rate as the number of initial sampling points of each pixel point, and arranging the initial sampling points of each pixel point according to the sampling sequence.
It can be understood that the calculation process of the number of initial sampling points of each pixel point can be expressed as the following formula:
N=τF s
and N is the number of initial sampling points of each pixel point, and tau is the target duration.
S240, obtaining the time point of each initial sampling point according to the preset sampling rate and the frequency coordinates of the pixel points corresponding to each initial sampling point.
After the frequency coordinates of the pixel points of each initial sampling point are obtained, the time point of each initial sampling point can be calculated according to the frequency coordinates of the pixel points of each initial sampling point and the preset sampling rate.
The sequence number of each initial sampling point corresponding to each pixel point can be obtained; calculating the product of the sequence number of each initial sampling point under each pixel point and the frequency coordinate of the pixel point, and taking the product as the product result of each initial sampling point under each pixel point; and calculating the quotient of the product result of each initial sampling point under each pixel point and the preset sampling rate as the time point of each initial sampling point under each pixel point. The time point of each initial sampling point also refers to the time point corresponding to the time domain by the color value of the pixel point corresponding to each initial sampling point.
It is understood that the above process of determining the time point can be expressed as formula four, which is as follows:
Figure BDA0003937084570000071
wherein, time is the time point of the kth initial sampling point under each pixel point, k =1, \ 8230;, N.
And S250, obtaining the amplitude of each initial sampling point according to the preset quantization digit, the time point of each initial sampling point and the color value of the pixel point corresponding to the initial sampling point.
In the present application, the preset quantization bit number may be set based on a requirement, for example, the preset quantization bit number may be 17 powers of 2. After the time point of each initial sampling point and the color value of each pixel point are obtained, the amplitude of each initial sampling point is calculated according to the preset quantization digit, the time point of each initial sampling point and the color value of the pixel point corresponding to the initial sampling point.
Optionally, S250 may include: obtaining the amplitude of each initial sampling point according to the formula I, the preset quantization digit, the color saturation coefficient, the time point of each initial sampling point and the color value of the pixel point corresponding to the initial sampling point;
the first formula is as follows:
Figure BDA0003937084570000072
wherein, value is the amplitude of any one initial sampling point p, time is the time point of the initial sampling point p, colcor i,j Is the color value of a pixel point q (i, j) corresponding to the initial sampling point p, i and j are respectively the abscissa and ordinate of the pixel point q in the image to be coded, sample range Beta is half of the preset quantization digit, and is the color saturation coefficient. In this embodiment, the smaller β is, the more saturated the color is, and β may be 1.0.
S260, summarizing the amplitude of the initial sampling point corresponding to each pixel point in the image to be coded to obtain an amplitude sequence.
After the amplitude of the initial sampling point of each pixel point in the image to be coded is determined, the amplitudes of the initial sampling points corresponding to all the pixel points are sequenced according to the sequence of each pixel point and the sequence of the initial sampling points under each pixel point, and an amplitude sequence is obtained.
And S270, obtaining the coded audio according to the amplitude sequence and the preset sampling rate.
The description of S270 refers to the description of S140 above, and is not repeated here.
In this embodiment, the amplitude sequence of each initial sampling point under each pixel point can be accurately determined by the above method, so that the accuracy of the encoded audio obtained according to the amplitude sequence is higher, and the accuracy of the obtained identification result is higher.
Referring to fig. 7, fig. 7 is a block diagram of an image encoding apparatus according to an embodiment of the present application, where the apparatus 500 includes:
the color conversion module 510 is configured to perform color conversion on a pixel value of each pixel in the image to be encoded to obtain a color value corresponding to each pixel;
the coordinate conversion module 520 is configured to obtain a frequency coordinate corresponding to each pixel point according to a preset sampling rate and a pixel coordinate of each pixel point in the image to be encoded;
a sequence obtaining module 530, configured to obtain an amplitude sequence corresponding to a preset sampling rate according to the preset sampling rate, a color value corresponding to each pixel point, and a frequency coordinate;
and an audio obtaining module 540, configured to obtain an encoded audio according to the amplitude sequence and a preset sampling rate.
Optionally, the sequence obtaining module 530 is further configured to obtain a plurality of initial sampling points corresponding to each pixel according to a preset sampling rate and a target duration for each pixel; obtaining a time point of each initial sampling point according to a preset sampling rate and the frequency coordinate of a pixel point corresponding to each initial sampling point; obtaining the amplitude of each initial sampling point according to a preset quantization digit, the time point of each initial sampling point and the color value of a pixel point corresponding to the initial sampling point; and summarizing the amplitude of the initial sampling point corresponding to each pixel point in the image to be coded to obtain an amplitude sequence.
Optionally, the sequence obtaining module 530 is further configured to obtain an amplitude of each initial sampling point according to the formula one, a preset quantization bit, a color saturation coefficient, a time point of each initial sampling point, and a color value of a pixel point corresponding to the initial sampling point;
the first formula is as follows:
Figure BDA0003937084570000081
wherein, value is the amplitude of any one initial sampling point p, time is the time point of the initial sampling point p, colcor i,j Is the color value of a pixel point q (i, j) corresponding to the initial sampling point p, i and j are respectively the abscissa and ordinate of the pixel point q in the image to be coded, samp range Beta is half of the preset quantization digit, and is the color saturation coefficient.
Optionally, a plurality of initial sampling points corresponding to each pixel point are arranged according to a preset sequence; the sequence obtaining module 530 is further configured to obtain a sequence number of each initial sampling point corresponding to each pixel point; calculating the product of the sequence number of each initial sampling point under each pixel point and the frequency coordinate of the pixel point, and taking the product as the product result of each initial sampling point under each pixel point; and calculating the quotient of the product result of each initial sampling point under each pixel point and the preset sampling rate as the time point of each initial sampling point under each pixel point.
Optionally, the color conversion module 510 is further configured to obtain a red pixel value, a green pixel value, and a blue pixel value of each pixel point; obtaining a color value of each pixel point according to a formula II, the color brightness coefficient, and the red pixel value, the green pixel value and the blue pixel value of each pixel point;
the second formula is:
Figure BDA0003937084570000091
wherein, colcor i,j Is the color value of a pixel point q (i, j), i and j are respectively the abscissa and the ordinate of the pixel point q in the image to be coded, alpha is the color brightness coefficient, r i,j 、g i,j And b i,j The red pixel value, the green pixel value and the blue pixel value of the pixel point q are respectively.
Optionally, the coordinate conversion module 520 is further configured to obtain a frequency coordinate corresponding to each pixel point according to the formula three, a preset sampling rate, the total number of rows of the pixel points in the image to be encoded, and the number of rows of the row of each pixel point in the image to be encoded;
the third formula is:
Figure BDA0003937084570000092
wherein, axis i,j Is the frequency coordinate, F, of pixel point q (i, j) s H is the total row number of pixel points in the image to be coded, and j is the row number of the row of the pixel point q (i, j) in the image to be coded.
Optionally, the color conversion module 510 is further configured to perform a preprocessing on the image to be encoded to obtain a processed image, where the preprocessing includes at least one of an enlargement processing, a reduction processing, and a cropping processing; and carrying out color conversion on the pixel value of each pixel point in the processed image to obtain the color value corresponding to each pixel point.
It should be noted that the device embodiment and the method embodiment in the present application correspond to each other, and specific principles in the device embodiment may refer to the contents in the method embodiment, which is not described herein again.
Fig. 8 shows a block diagram of an electronic device according to an embodiment of the present application, where the electronic device is configured to execute an image encoding method according to an embodiment of the present application. As shown in fig. 8, the electronic apparatus 1200 includes a Central Processing Unit (CPU) 1201, which can perform various appropriate actions and processes, such as performing the methods in the above-described embodiments, according to a program stored in a Read-Only Memory (ROM) 1202 or a program loaded from a storage section 1208 into a Random Access Memory (RAM) 1203. In the RAM 1203, various programs and data necessary for system operation are also stored. The CPU1201, ROM1202, and RAM 1203 are connected to each other by a bus 1204. An Input/Output (I/O) interface 1205 is also connected to bus 1204.
The following components are connected to the I/O interface 1205: an input portion 1206 including a keyboard, a mouse, and the like; an output section 1207 including a Display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 1208 including a hard disk and the like; and a communication section 1209 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 1209 performs communication processing via a network such as the internet. A driver 1210 is also connected to the I/O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on the drive 1210 as necessary, so that a computer program read out therefrom is mounted into the storage section 1208 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 1209, and/or installed from the removable medium 1211. The computer program executes various functions defined in the system of the present application when executed by a Central Processing Unit (CPU) 1201.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
Referring to fig. 9, fig. 9 is a block diagram illustrating a structure of a computer-readable storage medium according to an embodiment of the present disclosure. The computer-readable storage medium 600 has stored therein program code that can be called by a processor to execute the method described in the above-described method embodiments.
The computer-readable storage medium 600 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 600 includes a non-volatile computer-readable storage medium. The computer readable storage medium 600 has storage space for program code 610 for performing any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 610 may be compressed, for example, in a suitable form.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable storage medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable storage medium carries computer readable instructions which, when executed by a processor, implement the method of any of the embodiments described above.
According to an aspect of an embodiment of the present application, there is provided a computer program product or a computer program comprising computer instructions stored in a computer readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the electronic device to perform the method in any of the above embodiments.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not necessarily depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. An image encoding method, characterized in that the method comprises:
carrying out color conversion on a pixel value of each pixel point in an image to be coded to obtain a color value corresponding to each pixel point;
obtaining a frequency coordinate corresponding to each pixel point according to a preset sampling rate and the pixel coordinate of each pixel point in the image to be coded;
obtaining an amplitude sequence corresponding to the preset sampling rate according to the preset sampling rate, the color value corresponding to each pixel point and the frequency coordinate;
and obtaining the coded audio according to the amplitude sequence and the preset sampling rate.
2. The method of claim 1, wherein obtaining a magnitude sequence corresponding to the preset sampling rate according to the preset sampling rate, the color value corresponding to each pixel point, and the frequency coordinate comprises:
obtaining a plurality of initial sampling points corresponding to each pixel point according to the preset sampling rate and the target duration aiming at each pixel point;
obtaining the time point of each initial sampling point according to the preset sampling rate and the frequency coordinates of the pixel points corresponding to each initial sampling point;
obtaining the amplitude of each initial sampling point according to a preset quantization digit, the time point of each initial sampling point and the color value of a pixel point corresponding to the initial sampling point;
and summarizing the amplitude of the initial sampling point corresponding to each pixel point in the image to be coded to obtain the amplitude sequence.
3. The method of claim 2, wherein obtaining the amplitude of each initial sampling point according to a preset quantization bit number, a time point of each initial sampling point, and a color value of a pixel point corresponding to the initial sampling point comprises:
obtaining the amplitude of each initial sampling point according to a formula I, the preset quantization digit, the color saturation coefficient, the time point of each initial sampling point and the color value of the pixel point corresponding to the initial sampling point;
the first formula is as follows:
Figure FDA0003937084560000021
wherein, value is the amplitude of any one initial sampling point p, time is the time point of the initial sampling point p, colcor i,j Is the color value of a pixel point q (i, j) corresponding to the initial sampling point p, i and j are respectively the abscissa and ordinate of the pixel point q in the image to be coded, sample range Beta is half of the preset quantization digit, and beta is a color saturation coefficient.
4. The method according to claim 2, wherein the plurality of initial sampling points corresponding to each pixel point are arranged in a preset order; the obtaining of the time point of each initial sampling point according to the preset sampling rate and the frequency coordinates of the pixel points corresponding to each initial sampling point comprises:
acquiring the sequence number of each initial sampling point corresponding to each pixel point;
calculating the product of the sequence number of each initial sampling point under each pixel point and the frequency coordinate of the pixel point, and taking the product result of each initial sampling point under each pixel point as a product result;
and calculating the quotient of the product result of each initial sampling point under each pixel point and the preset sampling rate as the time point of each initial sampling point under each pixel point.
5. The method of claim 1, wherein performing color conversion on the pixel value of each pixel point in the image to be encoded to obtain a color value corresponding to each pixel point comprises:
acquiring a red pixel value, a green pixel value and a blue pixel value of each pixel point;
obtaining a color value of each pixel point according to a formula II, a color brightness coefficient, and a red pixel value, a green pixel value and a blue pixel value of each pixel point;
the second formula is:
Figure FDA0003937084560000022
wherein, colcor i,j The color value of a pixel point q (i, j), i and j are respectively the abscissa and the ordinate of the pixel point q in the image to be coded, alpha is a color brightness coefficient, r i,j 、g i,j And b i,j The red pixel value, the green pixel value and the blue pixel value of the pixel point q are respectively.
6. The method according to claim 1, wherein obtaining a frequency coordinate corresponding to each of the pixel points according to a preset sampling rate and a pixel coordinate of each of the pixel points in the image to be encoded comprises:
obtaining a frequency coordinate corresponding to each pixel point according to a formula III, the preset sampling rate, the total line number of the pixel points in the image to be coded and the line number of the line of each pixel point in the image to be coded;
the third formula is:
Figure FDA0003937084560000031
wherein,axis i,j Is the frequency coordinate, F, of pixel point q (i, j) s H is the total row number of pixel points in the image to be coded, and j is the row number of the row of the pixel point q (i, j) in the image to be coded.
7. The method of claim 1, wherein performing color conversion on the pixel value of each pixel point in the image to be encoded to obtain a color value corresponding to each pixel point comprises:
preprocessing the image to be coded to obtain a processed image, wherein the preprocessing comprises at least one of amplification processing, reduction processing and cutting processing;
and carrying out color conversion on the pixel value of each pixel point in the processed image to obtain the color value corresponding to each pixel point.
8. An image encoding apparatus, characterized in that the apparatus comprises:
the color conversion module is used for performing color conversion on the pixel value of each pixel point in the image to be coded to obtain the color value corresponding to each pixel point;
the coordinate conversion module is used for obtaining a frequency coordinate corresponding to each pixel point according to a preset sampling rate and the pixel coordinate of each pixel point in the image to be coded;
the sequence obtaining module is used for obtaining an amplitude sequence corresponding to the preset sampling rate according to the preset sampling rate, the color value corresponding to each pixel point and the frequency coordinate;
and the audio obtaining module is used for obtaining the coded audio according to the amplitude sequence and the preset sampling rate.
9. An electronic device, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-7.
10. A computer-readable storage medium, having stored thereon program code that can be invoked by a processor to perform the method according to any one of claims 1-7.
CN202211409833.4A 2022-11-10 2022-11-10 Image encoding method, image encoding device, electronic device, and storage medium Pending CN115883840A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211409833.4A CN115883840A (en) 2022-11-10 2022-11-10 Image encoding method, image encoding device, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211409833.4A CN115883840A (en) 2022-11-10 2022-11-10 Image encoding method, image encoding device, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
CN115883840A true CN115883840A (en) 2023-03-31

Family

ID=85759733

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211409833.4A Pending CN115883840A (en) 2022-11-10 2022-11-10 Image encoding method, image encoding device, electronic device, and storage medium

Country Status (1)

Country Link
CN (1) CN115883840A (en)

Similar Documents

Publication Publication Date Title
US11416781B2 (en) Image processing method and apparatus, and computer-readable medium, and electronic device
CN111950723B (en) Neural network model training method, image processing method, device and terminal equipment
CN110189336B (en) Image generation method, system, server and storage medium
CN110276345B (en) Convolutional neural network model training method and device and computer readable storage medium
CN109784304B (en) Method and apparatus for labeling dental images
CN109902763B (en) Method and device for generating feature map
CN109948700B (en) Method and device for generating feature map
CN110826567B (en) Optical character recognition method, device, equipment and storage medium
CN109948699B (en) Method and device for generating feature map
CN113115037B (en) Online education method, system, equipment and storage medium
CN110675940A (en) Pathological image labeling method and device, computer equipment and storage medium
CN110533117B (en) Image comparison method, device, equipment and storage medium
CN105979283A (en) Video transcoding method and device
CN113015022A (en) Behavior recognition method and device, terminal equipment and computer readable storage medium
CN110111347B (en) Image sign extraction method, device and storage medium
CN110633383A (en) Method and device for identifying repeated house sources, electronic equipment and readable medium
CN115883840A (en) Image encoding method, image encoding device, electronic device, and storage medium
CN109919249B (en) Method and device for generating feature map
CN111783632A (en) Face detection method and device for video stream, electronic equipment and storage medium
CN107861990B (en) Video searching method and system and terminal equipment
CN115205163A (en) Method, device and equipment for processing identification image and storage medium
CN113516738B (en) Animation processing method and device, storage medium and electronic equipment
CN109375952B (en) Method and apparatus for storing data
CN110941728B (en) Electronic file processing method and device
CN109308194B (en) Method and apparatus for storing data

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