Image processing method, device, electronic device and storage medium
By projecting the cylindrical image area into a virtual cylindrical object and performing texture projection processing, the problem of low accuracy in content recognition of the cylindrical image area is solved, and efficient content recognition is achieved without the need for additional hardware and a large number of data sets.
Patent Information
- Application Number
- CN202010709411.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-22
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2040-07-22
AI Technical Summary
The prior art is difficult to effectively solve the problem of low content recognition accuracy caused by distortion and deformation of texture content in cylindrical image areas, and often requires additional hardware or convolutional neural networks that rely on a large number of data sets.
Texture projection data is obtained to identify the contents of the cylinder image area by establishing a projection model that projects the cylinder image area as a virtual cylinder object and projecting the cylinder texture data onto the virtual cylinder object.
No additional hardware and large data sets are required, which improves the accuracy of recognition of the contents of the cylindrical image area and ensures the identification based on applicability.
Smart Images

Figure CN113971703B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more particularly to an image processing method. The present application also relates to an image processing device, an electronic device, and a storage medium. Background Art
[0002] Image content recognition refers to the process of using computers to process, analyze and understand images in order to identify different targets and objects in the image. It is an important research direction in the field of computer vision and pattern recognition. The image content recognition process generally involves extracting the texture features of the image area to be recognized in the image to be recognized, and obtaining the content of the image area to be recognized based on the texture features of the image area to be recognized. The texture features of the image area to be recognized often involve the recognition of the content of the cylindrical image area to be recognized in the image to be recognized, such as: the recognition of text content on the cylindrical image area to be recognized in the image to be recognized. However, since the content on the cylindrical image area may be distorted and deformed, the texture content of the cylindrical image area may be distorted and deformed, which may lead to the problem of low accuracy in the recognition of the content in the cylindrical image area.
[0003] Existing solutions to the problem of low accuracy in identifying the content in the cylindrical image area due to the distortion and deformation of the texture content in the cylindrical image area often have the following problems: using auxiliary three-dimensional scanning hardware to scan the cylindrical image area to reduce the distortion and deformation of the texture content in the cylindrical image area, this solution often limits their application due to the additional hardware requirements; using a multi-view method to reconstruct the three-dimensional shape of the cylindrical image area, it is difficult to obtain multiple images of the same object using this solution; using a convolutional neural network to correct the distorted cylindrical image area, this solution often relies on training a large number of data sets, and the algorithm has poor generalization. In summary, the existing solutions to the problem of low accuracy in identifying the content in the cylindrical image area due to the distortion and deformation of the texture content in the cylindrical image area often fail to improve the accuracy of identifying the content in the cylindrical image area while ensuring applicability. Summary of the invention
[0004] The present application provides an image processing method, device, electronic device and storage medium to improve the recognition accuracy of content in a cylindrical image area.
[0005] The present application provides an image processing method, comprising:
[0006] Obtaining a cylindrical image region in an image to be recognized;
[0007] Establishing a projection model that projects the cylindrical image area into a virtual cylindrical object;
[0008] According to the projection model, the cylindrical image area is projected into the virtual cylindrical object, and the cylindrical texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object;
[0009] According to the texture projection data, target plane texture data corresponding to the cylindrical image area is obtained.
[0010] Optionally, obtaining target plane texture data corresponding to the cylindrical image area according to the texture projection data includes:
[0011] Expanding the virtual cylinder object;
[0012] The plane texture data corresponding to the texture projection data on the cylinder expansion plane of the virtual cylinder object is obtained as the target plane texture data.
[0013] Optionally, performing cylindrical expansion on the virtual cylindrical object includes: performing cylindrical expansion on the virtual cylindrical object according to a parallel line method to obtain the cylindrical expansion plane.
[0014] Optionally, obtaining a cylindrical image area in the image to be identified includes:
[0015] Obtaining a bottom ellipse pair for locating the cylindrical image area in the image to be identified;
[0016] The cylindrical image region is located in the image to be recognized according to the base ellipse to obtain the cylindrical image region.
[0017] Optionally, obtaining a base ellipse pair for locating the cylindrical image area in the image to be identified includes:
[0018] Obtaining a target ellipse pair corresponding to the cylindrical image area;
[0019] Determining whether the target ellipse pair satisfies a preset restriction condition, wherein the restriction condition is a condition for indicating whether the target ellipse pair can locate a complete cylindrical image area in the image to be processed;
[0020] If so, the target ellipse pair is used as the base ellipse pair.
[0021] Optionally, obtaining the ellipse pair in the image to be processed includes:
[0022] Obtaining a target elliptical arc pair corresponding to the cylindrical image area, and extracting pixel points on the target elliptical arc pair;
[0023] Fitting the pixel points on the target elliptical arc pair to obtain the elliptical equation corresponding to the target elliptical arc pair in the two-dimensional coordinate system of the cylindrical image;
[0024] The target ellipse pair is obtained according to the ellipse equation corresponding to the target ellipse arc pair.
[0025] Optionally, the establishing of a projection model for projecting the cylindrical image area into a virtual cylindrical object comprises:
[0026] Determine the two-dimensional coordinates of the ellipse corresponding to the base ellipse pair in the two-dimensional coordinate system of the cylindrical image;
[0027] According to the two-dimensional coordinates of the ellipse, a virtual cylinder bottom surface corresponding to the virtual cylinder object in a three-dimensional coordinate system is determined based on the perspective projection principle, a first coordinate origin of the three-dimensional cylindrical coordinate system and a second coordinate origin of the two-dimensional cylindrical image coordinate system are on the same straight line, and a plane where the coordinate axes of the specified two dimensions in the three-dimensional coordinate system are located is parallel to a plane where the two-dimensional cylindrical image coordinate system is located;
[0028] The projection model is determined according to the target elliptical arc pair and the virtual cylinder bottom surface.
[0029] Optionally, determining the virtual cylinder bottom surface corresponding to the virtual cylinder object in the three-dimensional coordinate system based on the perspective projection principle according to the two-dimensional coordinates of the ellipse includes:
[0030] According to the two-dimensional coordinates of the ellipse, based on the perspective projection principle, determine the radius of the virtual cylinder bottom surface corresponding to the virtual cylinder bottom surface in the three-dimensional coordinate system, and determine the center of the virtual cylinder bottom surface corresponding to the virtual cylinder bottom surface in the three-dimensional coordinate system;
[0031] The virtual cylindrical bottom surface is determined according to the virtual cylindrical bottom surface radius and the center of the virtual cylindrical bottom surface.
[0032] Optionally, determining the projection model based on the target elliptical arc pair and the virtual cylinder bottom surface includes: determining the projection model based on the arc three-dimensional coordinates of the target elliptical arc pair in the three-dimensional coordinate system and the bottom three-dimensional coordinates of the virtual cylinder bottom surface in the three-dimensional coordinate system.
[0033] Optionally, the projection model is determined based on the arc three-dimensional coordinates of the target elliptical arc in the three-dimensional coordinate system and the bottom three-dimensional coordinates of the virtual cylinder bottom in the three-dimensional coordinate system, including: determining the perspective projection viewing angle of perspective projection of the bottom ellipse into the bottom surface of the virtual cylinder in the three-dimensional coordinate system as the projection model based on the arc three-dimensional coordinates and the bottom three-dimensional coordinates.
[0034] Optionally, projecting the cylindrical image area into the virtual cylindrical object according to the projection model comprises: projecting the cylindrical image area into the virtual cylindrical object according to the perspective projection viewing angle, the radius of the virtual cylindrical bottom surface corresponding to the virtual cylindrical bottom surface in the three-dimensional coordinate system, and the center of the virtual cylindrical bottom surface corresponding to the virtual cylindrical bottom surface in the three-dimensional coordinate system, and obtaining the texture projection data of the cylindrical texture data on the virtual cylindrical object, comprising:
[0035] Obtain texture two-dimensional coordinates of the cylindrical texture data in the cylindrical image two-dimensional coordinate system;
[0036] Determining the texture three-dimensional coordinates of the cylindrical texture data in the three-dimensional coordinate system according to the texture two-dimensional coordinates;
[0037] The cylindrical texture data is projected onto the virtual cylindrical object according to the texture three-dimensional coordinates and the perspective projection viewing angle.
[0038] Optionally, the cylindrical image two-dimensional coordinate system is a two-dimensional coordinate system for the plane where the cylindrical image area is located.
[0039] In another aspect, the present application further provides an image processing device, comprising:
[0040] A cylindrical image region obtaining unit, used for obtaining a cylindrical image region in an image to be identified;
[0041] A projection model building unit, used to build a projection model that projects the cylindrical image area into a virtual cylindrical object;
[0042] a texture projection data obtaining unit, configured to project the cylindrical image region into the virtual cylindrical object according to the projection model, and project the cylindrical texture data on the cylindrical image region onto the virtual cylindrical object, so as to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object;
[0043] The target plane texture data obtaining unit is used to obtain the target plane texture data corresponding to the cylindrical image area according to the texture projection data.
[0044] In another aspect, the present application further provides an electronic device, comprising:
[0045] Processor; and
[0046] The memory is used to store a program of the image processing method. After the device is powered on and the program of the image processing method is run by the processor, the following steps are performed:
[0047] Obtaining a cylindrical image region in an image to be recognized;
[0048] Establishing a projection model that projects the cylindrical image area into a virtual cylindrical object;
[0049] According to the projection model, the cylindrical image area is projected into the virtual cylindrical object, and the cylindrical texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object;
[0050] According to the texture projection data, target plane texture data corresponding to the cylindrical image area is obtained.
[0051] In another aspect, the present application further provides a storage medium storing a program of the image processing method, wherein the program is executed by a processor to perform the following steps:
[0052] Obtaining a cylindrical image region in an image to be recognized;
[0053] Establishing a projection model that projects the cylindrical image area into a virtual cylindrical object;
[0054] According to the projection model, the cylindrical image area is projected into the virtual cylindrical object, and the cylindrical texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object;
[0055] According to the texture projection data, target plane texture data corresponding to the cylindrical image area is obtained.
[0056] Compared with the prior art, this application has the following advantages:
[0057] The image processing method provided by the present application, after obtaining the cylindrical image area in the image to be identified, first establishes a projection model that projects the cylindrical image area as a virtual cylindrical object; then, based on the projection model, projects the cylindrical image area as the virtual cylindrical object, and projects the cylindrical texture data on the cylindrical image area onto the virtual cylindrical object, to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object; then, based on the texture projection data, obtains the target plane texture data corresponding to the cylindrical image area. The image processing method provided by the present application can obtain the target plane texture data corresponding to the cylindrical image area, and perform content recognition on the content on the cylindrical image area based on the target plane texture data corresponding to the cylindrical image area, without the need for additional hardware, and without the need to use multi-view images to complete the recognition of the content on the cylindrical image area, so that the recognition accuracy of the content on the cylindrical image area can be improved on the basis of ensuring applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 This is the first schematic diagram of an application scenario embodiment provided in the embodiments of the present application.
[0059] Figure 1A This is a second schematic diagram of an application scenario embodiment provided in an embodiment of the present application.
[0060] Figure 1B This is the third schematic diagram of an application scenario embodiment provided in the embodiments of the present application.
[0061] Figure 1C This is the fourth schematic diagram of an application scenario embodiment provided in the embodiments of the present application.
[0062] Figure 1D This is the fifth schematic diagram of an application scenario embodiment provided in the embodiments of the present application.
[0063] Figure 1E This is the sixth schematic diagram of an application scenario embodiment provided in an embodiment of the present application.
[0064] Figure 2 This is a flowchart of an image processing method provided in the first embodiment of the present application.
[0065] Figure 3 This is a schematic diagram of an image processing device provided in the second embodiment of the present application.
[0066] Figure 4 A schematic diagram of an electronic device provided in an embodiment of the present application.
[0067] Figure 5 This is a flowchart of an image recognition method provided in the fifth embodiment of the present application.
[0068] Figure 6 This is a flowchart of a text recognition method provided in the sixth embodiment of the present application. DETAILED DESCRIPTION
[0069] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0070] In order to more clearly demonstrate the image processing method provided by the present application, the application scenario of the image processing method provided by the present application is first introduced. In actual applications, the image processing method provided in the embodiment of the present application is used to identify the content on the cylindrical image area in the image to be identified, such as: used to identify the text content on the cylindrical image area in the image to be identified. The so-called image to be identified is an image containing at least one cylindrical image area, and the cylindrical image area contained in the image to be processed is not specifically limited in the embodiment of the application scenario of the present application. Since the image processing method provided in the embodiment of the application scenario of the present application, when the image to be processed contains multiple cylindrical image areas, the processing process of different cylindrical image areas is the same, so, in the embodiment of the application scenario of the present application, the image processing method provided in the embodiment of the application scenario of the present application is specifically described by taking the image to be processed containing only one cylindrical image area as an example.
[0071] The so-called cylindrical image area is the image area to which the sub-image with a cylindrical shape belongs in the image to be processed. The sub-image with a cylindrical shape generally corresponds to cylindrical objects in the real world, such as: a water bottle with a cylindrical body, a cylindrical pen holder, a cylindrical support column, a street lamp pole, and a telephone pole. The so-called cylindrical texture data on the cylindrical image area is the texture data corresponding to the content on the cylindrical image area. The so-called content on the cylindrical image area includes: symbols, text, shapes, and graphics on the cylindrical image area, such as: symbols and advertising content on the cylindrical image area. The content on the cylindrical image area generally corresponds to symbols, text, shapes, and graphics on cylindrical objects in the real world, such as: the name, logo, production date, manufacturer, and ingredient description text on the water bottle, and also: road signs and subway signs posted on cylindrical support columns in subway stations.
[0072] In the application scenario embodiment of the present application, please refer to the specific steps of identifying the content on the cylindrical image area in the image to be identified. Figure 1 The steps of the image processing method in the application scenario embodiment of the present application are as follows:
[0073] First, obtain the image to be processed.
[0074] In the application scenario embodiment of the present application, specifically, the image to be processed contains only one cylindrical image area, and the cylindrical area image is the mapping of the cylindrical support column in the image to be processed. At this time, the cylindrical texture data on the cylindrical image area is the texture data corresponding to the instruction map posted on the cylindrical support column, or the text and other contents printed on the cylindrical support column in the image to be processed. The so-called mapping of the cylindrical support column in the image to be processed is specifically such as: the mapping of the cylindrical support column in the subway station in the image to be processed. At this time, the so-called cylindrical texture data on the cylindrical image area is the texture data corresponding to the sign posted on the cylindrical support column in the subway station in the image to be processed.
[0075] After obtaining the image to be processed, image preprocessing may be performed on the image to be processed. The specific implementation method is: image quality enhancement of the image to be processed, such as: noise reduction processing of the image to be processed.
[0076] Secondly, ellipse detection, that is, firstly detecting the ellipse arc pairs in the image to be processed, and then further determining the bottom ellipse pairs in the image to be processed according to the ellipse arc pairs.
[0077] The so-called bottom ellipse pair is a target ellipse pair in the image to be processed that meets preset conditions and is used to locate the cylindrical image area. The so-called restriction condition is a condition used to indicate whether the target ellipse pair can locate a complete cylindrical image area in the image to be processed.
[0078] In the application scenario embodiment of the present application, the specific implementation method of obtaining the target ellipse pair corresponding to the cylindrical image area is to obtain the target ellipse pair through an interactive ellipse extraction method. The specific operation process is: first, obtain the target ellipse arc pair corresponding to the cylindrical image area, and extract the pixel points on the target ellipse arc pair. Second, fit the pixel points on the target ellipse arc pair to obtain the ellipse equation corresponding to the target ellipse arc pair in the two-dimensional coordinate system of the cylindrical image. Third, according to the ellipse equation corresponding to the target ellipse arc pair, obtain the target ellipse pair. Compared with the direct use of the ellipse detection algorithm, the interactive ellipse extraction can eliminate the noise interference around the target ellipse, making the extraction of the target ellipse more accurate.
[0079] In the application scenario embodiment of the present application, the so-called cylindrical image two-dimensional coordinate system is a two-dimensional coordinate system for the plane where the cylindrical image area is located.
[0080] In the application scenario embodiment of the present application, according to the ellipse equation corresponding to the target ellipse arc pair, the process of obtaining the target ellipse pair is as follows: first, after obtaining the target ellipse pair, first determine whether the target ellipse pair meets the preset restriction condition, and the restriction condition is a condition for indicating whether the target ellipse pair can locate the complete cylindrical image area in the image to be processed. Then, if the target ellipse pair meets the preset restriction condition, the target ellipse pair is used as the bottom ellipse pair.
[0081] For details, please refer to Figure 1A In this figure, the coordinate system XOY is a two-dimensional coordinate system of the cylindrical image. The upper arc ABC and the lower arc DEF are the upper arc and the lower arc corresponding to the target ellipse pair, that is, the upper arc ABC and the lower arc DEF. The connecting line AC of point A and point C is the major axis of the upper ellipse in the target ellipse pair, and the connecting line DF of point D and point F is the major axis of the lower ellipse in the target ellipse pair. If the coordinates of A, C, D, and F in the coordinate system XOY are A(x A ,y A )、C(x C ,y C )、D(x D ,y D )、F(x F ,y F ), the preset restriction condition in the application scenario embodiment of the present application is that the X-direction coordinate differences of the major axis endpoints A, C, D, and F respectively satisfy formulas (1) and (2), that is, |x A -x C |<30......(1),|x D -x F |<30......(2). 30 is an empirical value used to limit the misalignment of the target ellipse pair. If the misalignment of the target ellipse pair is too large, then the target ellipse pair is most likely not a bottom ellipse pair.
[0082] If the X-direction coordinate differences of the major axis endpoints A, C, D, and F satisfy formulas (1) and (2) respectively, then the target ellipse pair can be used as the base ellipse pair. In this case, the surface ABCDEF composed of the upper arc ABC and the lower arc DEF is a cylindrical surface.
[0083] In the application scenario embodiment of the present application, after obtaining the bottom ellipse pair, the coordinates of the ellipse center of the bottom ellipse pair in the coordinate system XOY can be further obtained. The present application specifically takes the coordinates of the ellipse center of the upper half ellipse in the bottom ellipse pair in the coordinate system XOY as an example to illustrate how to obtain the coordinates of the ellipse center of the bottom ellipse pair in the coordinate system XOY. Specifically, assuming that the general equation corresponding to the bottom ellipse is formula (3), that is, Px 2 +2Qxy+Ry 2 +2f0(Sx+Ty)+f0 2U=0......(3), where f0 is a constant of the resolution of the image to be processed, such as: if the resolution of the image to be processed is 800*800, then f0 is 800. Specifically, first, substitute the coordinates of points A, B, and C into formula (3), and collect the coordinates of other points in the upper semi-ellipse in the coordinate system XOY and substitute them into formula (3) to construct a set of linear equations, which can be used to solve the ellipse equations P, Q, R, S, T, and U corresponding to the upper semi-ellipse. Then, after solving the ellipse equations P, Q, R, S, T, and U corresponding to the upper semi-ellipse and determining the ellipse equation corresponding to the upper semi-ellipse, the coordinates (x ) of the upper semi-ellipse in the coordinate system XOY can be obtained according to formulas (4), (5), and (6) in turn. e ,y e ), major axis a and minor axis b. Formulas (4), (5) and (6) are: as well as
[0084] Again, please refer to Figure 1 , cylindrical image area positioning. That is, first obtain the bottom ellipse pair for positioning the cylindrical image area in the image to be identified, and then locate the cylindrical image area in the image to be identified according to the bottom ellipse pair to obtain the cylindrical image area.
[0085] Then, a projection model is established, that is, a projection model is established to project the cylindrical image area into a virtual cylindrical object.
[0086] The specific implementation method of establishing a projection model that projects the cylindrical image area into a virtual cylindrical object is as follows: first, determine the two-dimensional coordinates of the ellipse corresponding to the bottom ellipse pair in the two-dimensional coordinate system of the cylindrical image. Second, based on the two-dimensional coordinates of the ellipse, determine the virtual cylinder bottom surface corresponding to the virtual cylinder object in the three-dimensional coordinate system based on the perspective projection principle. The first coordinate origin of the three-dimensional cylindrical coordinate system and the second coordinate origin of the two-dimensional cylindrical image coordinate system are on the same straight line, and the plane where the coordinate axes of the specified two dimensions in the three-dimensional coordinate system are located is parallel to the plane where the two-dimensional cylindrical image coordinate system is located. Third, determine the projection model based on the target elliptical arc pair, the bottom ellipse pair and the virtual cylinder bottom surface.
[0087] The process of determining the virtual cylinder base corresponding to the virtual cylinder object in the three-dimensional coordinate system based on the perspective projection principle according to the two-dimensional coordinates of the ellipse is as follows: First, determine the virtual cylinder base radius corresponding to the virtual cylinder base in the three-dimensional coordinate system based on the perspective projection principle according to the two-dimensional coordinates of the ellipse, and determine the virtual cylinder base center corresponding to the virtual cylinder base in the three-dimensional coordinate system. Then, determine the virtual cylinder base based on the virtual cylinder base radius and the virtual cylinder base center. For the specific implementation method of determining the virtual cylinder base radius and the virtual cylinder base center, please refer to Figure 1B, in this figure, the coordinate system xoy is the two-dimensional coordinate system of the cylindrical image; the coordinate system XYZ is the three-dimensional coordinate system; the plane corresponding to NP1P2LP3M is the cylindrical image area; o is the coordinate origin of the two-dimensional coordinate system xoy of the cylindrical image; O is the coordinate origin of the three-dimensional coordinate system XYZ; oO is on the same straight line, and the straight-line distance of oO is f, that is, the resolution of the image to be processed; E is the center of the bottom surface of the virtual cylinder. In the application scenario embodiment of the present application, the x-axis and y-axis of the two-dimensional coordinate system xoy of the cylindrical image are respectively parallel to the X-axis and Y-axis of the three-dimensional coordinate system XYZ, and the Z-axis of the three-dimensional coordinate system XYZ is on the same straight line as the straight line oO.
[0088] In the application scenario embodiment of the present application, taking ∠COJ=120 and the radius of the bottom surface of the virtual cylinder as R as an example, at this time, f satisfies formula (7), that is, In addition, since the projection center coordinates of point E on the XOZ plane of the three-dimensional coordinate system XYZ are: (0, Z E ), then we can construct equations (8) and (9), that is, X 2 +(Z E -Z) 2 =R 2 ......(8) and Z E =-|oO|-R......(9). Based on the perspective projection principle and the triangle similarity principle, Figure 1B We can further derive the line segment ratio relationship as shown in formula (10), that is,
[0089] Assume that the coordinates of P1 in the three-dimensional coordinate system XYZ are (0, Y1, Z1), and the coordinates of P1 in the two-dimensional cylindrical image coordinate system are (0, y1), where y1 can be determined according to formula (3), and formula (11) is obtained, that is, |Y1|=|y1|=|oP1|, Z1=-f......(11). Assume that the coordinates of A in the three-dimensional coordinate system XYZ are (X A , Y A ,Z A ), the coordinates of P2 in the two-dimensional cylindrical image coordinate system are (x2, y2). Since the plane where the virtual cylinder bottom surface E is located is parallel to the XOZ plane, the points on the virtual cylinder bottom surface E have the same Y coordinate in the three-dimensional coordinate system. Then we can further obtain formula (12), that is, |Y A |=|AB|=|oP1|......(12). According to Figure 1B , combining formula (10), (11) and (12) can further obtain formula (13), that is, Among them, |DB|, |Y A |, |OD| are the lengths of A on the X-axis, Y-axis, and Z-axis respectively. The coordinates of point A can be obtained according to the above formula (13), that is, Y A =y1,
[0090] After obtaining the coordinates of point A in the three-dimensional coordinate system XYZ (X A , Y A ,Z A ) can be used to A , Y A ,Z A ) into formulas (8) and (9), we can obtain R, that is, After obtaining the radius R of the bottom surface of the virtual cylinder, the center of the bottom surface of the virtual cylinder can be further determined.
[0091] In the application scenario embodiment of the present application, the so-called determining the projection model according to the target elliptical arc pair and the virtual cylinder bottom surface includes: determining the projection model according to the arc three-dimensional coordinates of the target elliptical arc pair in the three-dimensional coordinate system and the bottom three-dimensional coordinates of the virtual cylinder bottom surface in the three-dimensional coordinate system. Among them, the so-called determining the projection model according to the arc three-dimensional coordinates of the target elliptical arc pair in the three-dimensional coordinate system and the bottom three-dimensional coordinates of the virtual cylinder bottom surface in the three-dimensional coordinate system is specifically implemented as follows: according to the arc three-dimensional coordinates and the bottom three-dimensional coordinates, determining the perspective projection viewing angle of the perspective projection of the bottom surface ellipse into the bottom surface of the virtual cylinder in the three-dimensional coordinate system as the projection model. Specifically, according to Figure 1B And formula (16) and (17) to calculate the perspective projection viewing angle ∠P1OD, ∠P3OD and ∠BOD, that is,
[0092] Finally, please refer to Figure 1 Specifically, firstly, according to the projection model, the cylindrical image area is projected into a virtual cylindrical object, and the cylindrical text texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain the text texture projection data of the cylindrical texture data on the virtual cylindrical object; then, the virtual cylindrical object is cylindrically expanded to obtain the plane text texture data corresponding to the text texture projection data on the cylinder expansion plane of the virtual cylindrical object as the target plane texture data.
[0093] In the application scenario embodiment of the present application, after obtaining the projection model, the cylindrical image area can be projected into a virtual cylinder object in the three-dimensional coordinate system according to the perspective projection viewing angle, the virtual cylinder base radius corresponding to the virtual cylinder base in the three-dimensional coordinate system, and the virtual cylinder base center corresponding to the virtual cylinder base in the three-dimensional coordinate system.
[0094] Please refer to Figure 1CAfter obtaining the virtual cylinder object, the differential principle of calculus can be used to represent the side of the virtual cylinder object with multiple co-edge continuous quadrilateral primitives. Assume that the coordinates of the vertices of the quadrilateral primitive in the three-dimensional coordinate system XYZ are (X, Y, Z). At this time, a one-to-one correspondence is established between the cylindrical texture data on the cylindrical image area and the side of the virtual cylinder object using multiple co-edge continuous quadrilateral primitives. Then, the cylindrical texture data is projected onto the virtual cylinder object based on the control of the angle. The specific operation process is as follows: First, the texture two-dimensional coordinates of the cylindrical image area in the cylindrical image two-dimensional coordinate system are obtained. Then, according to the texture two-dimensional coordinates, the texture three-dimensional coordinates of the cylindrical texture data in the three-dimensional coordinate system are determined. Finally, according to the texture three-dimensional coordinates and the perspective projection angle, the cylindrical texture data is projected onto the virtual cylinder object.
[0095] In practical applications, the so-called projection of cylindrical texture data onto a virtual cylindrical object based on the texture 3D coordinates and perspective projection angle can be achieved in the following ways. For details, please refer to Figure 1D and Figure 1E .
[0096] exist Figure 1D middle, Figure 1E The circle E in the figure is based on Figure 1C The top view of the restored virtual cylinder object in . At this time, Figure 1E The x-axis in is not the cylindrical image 2D coordinate system, but the x-axis of the texture coordinate system formed by scaling the cylindrical image 2D coordinate system. The coordinates of the scaled texture data in the texture coordinate system are (x, y), x, y∈[0,1]. Correspondingly, the XOZ coordinate system is the coordinate system generated by scaling the XOZ plane of the 3D coordinate system XYZ. Figure 1D and Figure 1E In |J′C′|=1, |o′C′|=0.5, Figure 1E The ellipse pair in the two-dimensional coordinate system of the central cylindrical image becomes e1′ and e2′, and the semi-major axis corresponding to e1′ and e2′ is a1′=a2′=0.5. According to the proportional relationship between the major and minor axes of the base ellipse, the semi-extreme axes corresponding to e1′ and e2′ are b1′ and b2′.
[0097] After determining 1D and Figure 1E After the symbols in the table are identified, the coordinates of the cylindrical texture data in the texture 2D coordinate system can be further determined. Figure 1E The specific implementation method of determining the coordinates of the cylindrical texture data in the texture two-dimensional coordinate system is:
[0098] First, determine the x coordinate of the cylindrical texture data in the texture 2D coordinate system. Specifically, in order to uniformly project the cylindrical texture data onto the primitive, in the texture 2D coordinate system, let x change uniformly according to Figure 1D , the consensus is obtained by derivation (18), that is, At this time, x will change evenly with the change of perspective projection angle (0.1 radians). Figure 1D And formula (17), the cylindrical texture data can be evenly divided into n parts, where the size of n is given by formula (19), that is, to be sure.
[0099] Second, determine the y coordinate of the cylindrical texture data in the texture 2D coordinate system. Figure 1E As shown, since the ellipses E1 and E2 in the texture two-dimensional coordinate system correspond to the bottom ellipses e1′ and e2′ that need to correspond to the cylindrical image area, at this time, according to formula (3) and the x coordinate of the cylindrical texture data in the texture two-dimensional coordinate system, the y coordinate of the cylindrical texture data in the texture two-dimensional coordinate system can be further determined. Specifically, the mapping equations of the bottom ellipses e1′ and e2′ corresponding to the cylindrical image area and the ellipses E1 and E2 in the texture two-dimensional coordinate system are as shown in formula (20), that is, in, is the ordinate of the ellipse e1′, is the ordinate of the ellipse e2′.
[0100] Third, determine the coordinates (X, Y, Z) of the cylindrical texture data in the three-dimensional coordinate system XYZ. The specific implementation method is as follows: First, since the cylindrical texture data in the texture two-dimensional coordinate system changes evenly with the perspective projection viewing angle, according to Figure 1E The relationship between the above primitives and the perspective projection viewing angle can be established, that is, formula (21): Rsinβ=(L-Rcosβ)*tanθ, L=R+f, sin 2 β+cos 2 β=1......(21), β can be further solved according to formula (21). The specific solution process of β can refer to formula (22), that is, β=arccos(cosβ)......(22), Then, from the relationship between the primitive and the perspective projection viewing angle, that is, formula (21), the coordinates (X, Y, Z) of the cylindrical texture data in the three-dimensional coordinate system XYZ can be determined, as shown in formula (23), that is, β(i) = θ-i, X = Rsinβ(i), Z=Rcosβ(i)......(23), where, y l The coordinates of P1 in the two-dimensional cylindrical image coordinate system are (0, y1) l , y is the vertical coordinate of the cylindrical texture data in the two-dimensional texture coordinate system.
[0101] In the application scenario embodiment of the present application, the specific implementation method of performing cylindrical expansion on the virtual cylindrical object to obtain the plane text texture data corresponding to the text texture projection data on the cylinder expansion plane of the virtual cylindrical object is: performing cylindrical expansion on the virtual cylindrical object to obtain the plane text texture data corresponding to the text texture projection data on the cylinder expansion plane of the virtual cylindrical object as the target plane texture data. Specifically, the texture projection data can be expanded on a cylindrical expansion plane parallel to the XOZ plane of the three-dimensional coordinate system XYZ, and the expansion formula is as follows: Formula (24), that is, Among them, X is the coordinate in the three-dimensional coordinate system, X' is the coordinate in the cylindrical unfolding plane, y l The coordinates of P1 in the two-dimensional cylindrical image coordinate system are (0, y1) l .
[0102] Please refer to Figure 1 In the application scenario provided by the present application, after obtaining the target plane texture data, the text content on the cylindrical image area can be identified according to the target plane texture data. That is, the cylindrical support column can recognize the text "Transfer to Line 8", "Exit: E, F, G, G", "Tranfer to line 8", etc.
[0103] It should be noted that in the application scenario embodiment of the present application, the so-called cylindrical texture data on the cylindrical image area is the texture data corresponding to the content on the cylindrical image area in the image to be processed, and the so-called cylindrical text texture data on the cylindrical image area is the texture data corresponding to the text content on the cylindrical image area in the image to be processed. The so-called target plane texture data is the texture data corresponding to the cylindrical texture data on the cylindrical image area on the cylindrical expansion plane.
[0104] The application scenario embodiments of the present application do not specifically limit the application scenarios of the image processing method provided in the embodiments of the present application. For example, the image processing method provided in the present application can also be used in application scenarios for identifying content other than text content on the cylindrical image area in the image to be identified, which will not be described one by one here. The embodiments corresponding to the application scenarios of the above-mentioned image processing method are provided to facilitate the understanding of the image processing method provided in the present application, and are not used to limit the image processing method provided in the present application.
[0105] First embodiment
[0106] The first embodiment provides an image processing method, as follows: Figure 2 Provide explanation.
[0107] Figure 2 This is a flowchart of an image processing method provided in the fifth embodiment of the present application. Figure 2The image processing method shown includes: step S201 to step S204.
[0108] In step S201, a cylindrical image region in an image to be recognized is obtained.
[0109] In the fifth embodiment of the present application, the so-called image to be identified is an image containing at least one cylindrical image area, and the cylindrical image area contained in the image to be processed is not specifically limited in the application scenario embodiment of the present application. Since the image processing method provided in the application scenario embodiment of the present application, when the image to be processed contains multiple cylindrical image areas, the processing process of different cylindrical image areas is the same, the application scenario embodiment of the present application specifically takes the case where the image to be processed contains only one cylindrical image area as an example to illustrate the image processing method provided in the application scenario embodiment of the present application.
[0110] The so-called cylindrical image area is the image area to which the sub-image with a cylindrical shape in the image to be processed belongs. The sub-image with a cylindrical shape generally corresponds to cylindrical objects in the real world, such as: a water bottle with a cylindrical body, a cylindrical pen holder, a cylindrical support column, a street lamp pole, and a telephone pole.
[0111] In the fifth embodiment of the present application, before obtaining the image to be processed, image preprocessing may be performed on the image to be processed. The specific implementation method is: image quality enhancement of the image to be processed, such as: noise reduction processing of the image to be processed.
[0112] In the fifth embodiment of the present application, the specific implementation method of obtaining the cylindrical image area in the image to be identified is: first, obtain a bottom ellipse pair for locating the cylindrical image area in the image to be identified. Then, locate the cylindrical image area in the image to be identified based on the bottom ellipse pair to obtain the cylindrical image area. Among them, obtaining the bottom ellipse pair for locating the cylindrical image area in the image to be identified includes: first, obtaining a target ellipse pair corresponding to the cylindrical image area. Second, determine whether the target ellipse pair meets the preset restriction condition. Third, if so, use the target ellipse pair as the bottom ellipse pair. The so-called restriction condition is a condition used to indicate whether the target ellipse pair can locate the complete cylindrical image area in the image to be processed.
[0113] It should be noted that when obtaining the ellipse pair in the image to be processed, it is necessary to first obtain the target ellipse arc pair corresponding to the cylindrical image area and extract the pixel points on the target ellipse arc pair. After the pixel points on the target ellipse arc pair are obtained, the pixel points on the target ellipse arc pair are first fitted to obtain the ellipse equation corresponding to the target ellipse arc pair in the two-dimensional coordinate system of the cylindrical image, and then the target ellipse pair is further obtained according to the ellipse equation corresponding to the target ellipse arc pair.
[0114] In step S202, a projection model is established to project the cylindrical image area into a virtual cylindrical object.
[0115] In the fifth embodiment of the present application, the specific implementation method of establishing a projection model that projects the cylindrical image area into a virtual cylindrical object is as follows: first, determine the two-dimensional coordinates of the ellipse corresponding to the bottom ellipse pair in the two-dimensional coordinate system of the cylindrical image. Then, based on the two-dimensional coordinates of the ellipse, determine the virtual cylindrical bottom surface corresponding to the virtual cylindrical object in the three-dimensional coordinate system based on the perspective projection principle, the first coordinate origin of the three-dimensional cylindrical coordinate system and the second coordinate origin of the two-dimensional cylindrical image coordinate system are on the same line, and the plane where the coordinate axes of the specified two dimensions in the three-dimensional coordinate system are located is parallel to the plane where the two-dimensional cylindrical image coordinate system is located. Finally, determine the projection model based on the target ellipse arc pair and the virtual cylindrical bottom surface.
[0116] In the fifth embodiment of the present application, the specific execution steps of determining the virtual cylinder bottom surface corresponding to the virtual cylinder object in the three-dimensional coordinate system are as follows: first, according to the two-dimensional coordinates of the ellipse, based on the perspective projection principle, the virtual cylinder bottom surface radius corresponding to the virtual cylinder bottom surface in the three-dimensional coordinate system is determined, and the virtual cylinder bottom surface center corresponding to the virtual cylinder bottom surface in the three-dimensional coordinate system is determined. Then, according to the virtual cylinder bottom surface radius and the virtual cylinder bottom surface center, the virtual cylinder bottom surface is determined.
[0117] In addition, the so-called determining the projection model according to the target elliptical arc pair and the virtual cylindrical bottom surface includes: determining the projection model according to the arc three-dimensional coordinates of the target elliptical arc pair in the three-dimensional coordinate system and the bottom three-dimensional coordinates of the virtual cylindrical bottom surface in the three-dimensional coordinate system. The specific implementation method is: according to the arc three-dimensional coordinates and the bottom three-dimensional coordinates, determining the perspective projection angle of the bottom ellipse perspective projection into the virtual cylindrical bottom surface in the three-dimensional coordinate system as the projection model.
[0118] In step S203, according to the projection model, the cylindrical image area is projected into a virtual cylindrical object, and the cylindrical texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object.
[0119] In the fifth embodiment of the present application, the cylindrical texture data on the cylindrical image area is the texture data corresponding to the content on the cylindrical image area. The content on the cylindrical image area includes: symbols, text, shapes, graphics and other contents on the cylindrical image area, such as: symbols and advertising content on the cylindrical image area. The content on the cylindrical image area generally corresponds to the symbols, text, shapes, graphics and other contents on cylindrical objects in the real world, such as: the name, logo, production date, manufacturer and ingredient description text of the water on the water bottle, and also: road signs and subway signs posted on cylindrical support columns in subway stations.
[0120] The so-called method of projecting the cylindrical image area into a virtual cylindrical object according to the projection model is: according to the perspective projection viewing angle, the virtual cylinder base radius corresponding to the virtual cylinder base in the three-dimensional coordinate system, and the virtual cylinder base center corresponding to the virtual cylinder base in the three-dimensional coordinate system, the cylindrical image area is projected into a virtual cylindrical object in the three-dimensional coordinate system.
[0121] In addition, the specific implementation method of obtaining the texture projection data of the cylindrical texture data on the virtual cylindrical object is as follows: first, the texture two-dimensional coordinates of the cylindrical texture data in the cylindrical image two-dimensional coordinate system are obtained. Then, according to the texture two-dimensional coordinates, the texture three-dimensional coordinates of the cylindrical texture data in the three-dimensional coordinate system are determined. Finally, according to the texture three-dimensional coordinates and the perspective projection angle of view, the cylindrical texture data is projected onto the virtual cylindrical object.
[0122] In step S204, target plane texture data corresponding to the cylindrical image area is obtained according to the texture projection data.
[0123] In the fifth embodiment of the present application, the process of obtaining the target plane texture data corresponding to the cylindrical image area based on the texture projection data is: cylindrically unfolding the virtual cylindrical object; obtaining the plane texture data corresponding to the texture projection data on the cylindrical unfolding plane of the virtual cylindrical object as the target plane texture data.
[0124] The image processing method provided in the fifth embodiment of the present application, after obtaining the cylindrical image area in the image to be identified, first establishes a projection model that projects the cylindrical image area as a virtual cylindrical object; then, according to the projection model, projects the cylindrical image area as a virtual cylindrical object, and projects the cylindrical texture data on the cylindrical image area onto the virtual cylindrical object, to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object; then, according to the texture projection data, obtains the target plane texture data corresponding to the cylindrical image area. The image processing method provided in the fifth embodiment of the present application can obtain the target plane texture data corresponding to the cylindrical image area, and perform content recognition on the content on the cylindrical image area according to the target plane texture data corresponding to the cylindrical image area, without the need for additional hardware, and without the need to use multi-view images to complete the recognition of the content on the cylindrical image area, so that the recognition accuracy of the content on the cylindrical image area can be improved on the basis of ensuring applicability.
[0125] Second embodiment
[0126] Corresponding to the application scenario of the image processing method provided by the present application and the image processing method provided by the first embodiment, the second embodiment of the present application also provides an image processing device. Since the device embodiment is basically similar to the application scenario and the first embodiment, the description is relatively simple, and the relevant parts refer to the application scenario and the partial description of the first embodiment. The device embodiment described below is only illustrative.
[0127] Please refer to Figure 3 , which is a schematic diagram of an image processing device provided in the second embodiment of the present application.
[0128] The image processing device provided in the second embodiment of the present application includes:
[0129] The cylindrical image region obtaining unit 301 is used to obtain the cylindrical image region in the image to be identified;
[0130] A projection model building unit 302 is used to build a projection model that projects the cylindrical image area into a virtual cylindrical object;
[0131] A texture projection data obtaining unit 303 is used to project the cylindrical image area into the virtual cylindrical object according to the projection model, and project the cylindrical texture data on the cylindrical image area onto the virtual cylindrical object to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object;
[0132] The target plane texture data obtaining unit 304 is used to obtain the target plane texture data corresponding to the cylindrical image area according to the texture projection data.
[0133] Optionally, the target plane texture data obtaining unit 304 is specifically used to perform cylindrical expansion on the virtual cylindrical object; obtain plane texture data corresponding to the texture projection data on the cylindrical expansion plane of the virtual cylindrical object as the target plane texture data.
[0134] Optionally, performing cylindrical expansion on the virtual cylindrical object includes: performing cylindrical expansion on the virtual cylindrical object according to a parallel line method to obtain the cylindrical expansion plane.
[0135] Optionally, the cylindrical image area obtaining unit 301 is specifically used to obtain a base ellipse pair in the image to be identified for locating the cylindrical image area; locate the cylindrical image area in the image to be identified according to the base ellipse pair to obtain the cylindrical image area.
[0136] Optionally, obtaining a base ellipse pair for locating the cylindrical image area in the image to be identified includes:
[0137] Obtaining a target ellipse pair corresponding to the cylindrical image area;
[0138] Determining whether the target ellipse pair satisfies a preset restriction condition, wherein the restriction condition is a condition for indicating whether the target ellipse pair can locate a complete cylindrical image area in the image to be processed;
[0139] If so, the target ellipse pair is used as the base ellipse pair.
[0140] Optionally, obtaining the ellipse pair in the image to be processed includes:
[0141] Obtaining a target elliptical arc pair corresponding to the cylindrical image area, and extracting pixel points on the target elliptical arc pair;
[0142] Fitting the pixel points on the target elliptical arc pair to obtain the elliptical equation corresponding to the target elliptical arc pair in the two-dimensional coordinate system of the cylindrical image;
[0143] The target ellipse pair is obtained according to the ellipse equation corresponding to the target ellipse arc pair.
[0144] Optionally, the projection model establishing unit 302 is specifically used to determine the elliptical two-dimensional coordinates corresponding to the bottom ellipse pair in the cylindrical image two-dimensional coordinate system; determine the virtual cylindrical bottom surface corresponding to the virtual cylindrical object in the three-dimensional coordinate system based on the perspective projection principle according to the elliptical two-dimensional coordinates, the first coordinate origin of the three-dimensional cylindrical coordinate system and the second coordinate origin of the two-dimensional cylindrical image coordinate system are on the same line, and the plane where the coordinate axes of the specified two dimensions in the three-dimensional coordinate system are located is parallel to the plane where the two-dimensional cylindrical image coordinate system is located; determine the projection model according to the target elliptical arc pair and the virtual cylindrical bottom surface.
[0145] Optionally, determining the virtual cylinder bottom surface corresponding to the virtual cylinder object in the three-dimensional coordinate system based on the perspective projection principle according to the two-dimensional coordinates of the ellipse includes:
[0146] According to the two-dimensional coordinates of the ellipse, based on the perspective projection principle, determine the radius of the virtual cylinder bottom surface corresponding to the virtual cylinder bottom surface in the three-dimensional coordinate system, and determine the center of the virtual cylinder bottom surface corresponding to the virtual cylinder bottom surface in the three-dimensional coordinate system;
[0147] The virtual cylindrical bottom surface is determined according to the virtual cylindrical bottom surface radius and the center of the virtual cylindrical bottom surface.
[0148] Optionally, determining the projection model based on the target elliptical arc pair and the virtual cylinder bottom surface includes: determining the projection model based on the arc three-dimensional coordinates of the target elliptical arc pair in the three-dimensional coordinate system and the bottom three-dimensional coordinates of the virtual cylinder bottom surface in the three-dimensional coordinate system.
[0149] Optionally, the projection model is determined based on the arc three-dimensional coordinates of the target elliptical arc in the three-dimensional coordinate system and the bottom three-dimensional coordinates of the virtual cylinder bottom in the three-dimensional coordinate system, including: determining the perspective projection viewing angle of perspective projection of the bottom ellipse into the bottom surface of the virtual cylinder in the three-dimensional coordinate system as the projection model based on the arc three-dimensional coordinates and the bottom three-dimensional coordinates.
[0150] Optionally, the texture projection data acquisition unit 303 is specifically used to project the cylindrical image area into the virtual cylinder object in the three-dimensional coordinate system based on the perspective projection viewing angle, the virtual cylinder base radius corresponding to the virtual cylinder base in the three-dimensional coordinate system, and the virtual cylinder base center corresponding to the virtual cylinder base in the three-dimensional coordinate system.
[0151] Optionally, the texture projection data obtaining unit 303 is specifically used to obtain the texture two-dimensional coordinates of the cylindrical texture data in the cylindrical image two-dimensional coordinate system; and determine the texture three-dimensional coordinates of the cylindrical texture data in the three-dimensional coordinate system according to the texture two-dimensional coordinates;
[0152] The cylindrical texture data is projected onto the virtual cylindrical object according to the texture three-dimensional coordinates and the perspective projection viewing angle.
[0153] Optionally, the cylindrical image two-dimensional coordinate system is a two-dimensional coordinate system for the plane where the cylindrical image area is located.
[0154] Third embodiment
[0155] Corresponding to the application scenario of the image processing method provided by the present application and the image processing method provided by the first embodiment, the third embodiment of the present application further provides an electronic device. Since the third embodiment is basically similar to the application scenario and the first embodiment, the description is relatively simple, and the relevant parts refer to the application scenario and the partial description of the first embodiment. The third embodiment described below is only illustrative.
[0156] Please refer to Figure 4 , which is a schematic diagram of an electronic device provided in an embodiment of the present application.
[0157] The electronic device includes: a processor 401;
[0158] and a memory 402 for storing a program of the image processing method. After the device is powered on and the program of the image processing method is run by the processor, the following steps are performed:
[0159] Obtaining a cylindrical image region in an image to be recognized;
[0160] Establishing a projection model that projects the cylindrical image area into a virtual cylindrical object;
[0161] According to the projection model, the cylindrical image area is projected into the virtual cylindrical object, and the cylindrical texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object;
[0162] According to the texture projection data, target plane texture data corresponding to the cylindrical image area is obtained.
[0163] It should be noted that the detailed description of the electronic device provided in the third embodiment of the present application can refer to the application scenarios of the image processing method provided in the present application and the relevant description of the image processing method provided in the first embodiment, which will not be repeated here.
[0164] Fourth embodiment
[0165] Corresponding to the application scenario of the image processing method provided by the present application and the image processing method provided by the first embodiment, the fourth embodiment of the present application further provides a storage medium. Since the fourth embodiment is basically similar to the application scenario and the first embodiment, the description is relatively simple, and the relevant parts refer to the application scenario and the partial description of the first embodiment. The fourth embodiment described below is only illustrative.
[0166] The storage medium stores a computer program, which is executed by a processor to perform the following steps:
[0167] Obtaining a cylindrical image region in an image to be recognized;
[0168] Establishing a projection model that projects the cylindrical image area into a virtual cylindrical object;
[0169] According to the projection model, the cylindrical image area is projected into the virtual cylindrical object, and the cylindrical texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object;
[0170] According to the texture projection data, target plane texture data corresponding to the cylindrical image area is obtained.
[0171] It should be noted that the detailed description of the storage medium provided in the fourth embodiment of the present application can refer to the application scenarios of the image processing method provided in the present application and the relevant description of the image processing method provided in the first embodiment, and will not be repeated here.
[0172] Fifth embodiment
[0173] Corresponding to the application scenario of the image processing method provided by the present application and the image processing method provided by the first embodiment, the fifth embodiment of the present application further provides an image recognition method. Since the fifth embodiment is basically similar to the application scenario and the first embodiment, the description is relatively simple, and the relevant parts refer to the application scenario and the partial description of the first embodiment. The fifth embodiment described below is only illustrative.
[0174] Please refer to Figure 5 , which is a flowchart of an image recognition method provided in the fifth embodiment of the present application.
[0175] Step S501: obtaining a cylindrical image region in an image to be recognized.
[0176] In the fifth embodiment of the present application, the so-called image to be identified is an image containing at least one cylindrical image area. In the fifth embodiment of the present application, there is no specific limitation on the cylindrical image area contained in the image to be processed, and generally it only contains one cylindrical image area.
[0177] The so-called cylindrical image area is the image area to which the sub-image with a cylindrical shape in the image to be processed belongs. The sub-image with a cylindrical shape generally corresponds to cylindrical objects in the real world, such as: a water bottle with a cylindrical body, a cylindrical pen holder, a cylindrical support column, a street lamp pole, and a telephone pole.
[0178] In the fifth embodiment of the present application, before obtaining the image to be processed, image preprocessing may be performed on the image to be processed. The specific implementation method is: image quality enhancement of the image to be processed, such as: noise reduction processing of the image to be processed.
[0179] Step S502: establishing a projection model for projecting the cylindrical image area into a virtual cylindrical object.
[0180] Step S503: According to the projection model, the cylindrical image area is projected into a virtual cylindrical object, and the cylindrical texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain content texture projection data of the cylindrical texture data on the virtual cylindrical object.
[0181] In the fifth embodiment of the present application, the cylindrical texture data on the cylindrical image area is the texture data corresponding to the content on the cylindrical image area. The content on the cylindrical image area includes: symbols, text, shapes, graphics and other contents on the cylindrical image area, such as: symbols and advertising content on the cylindrical image area. The content on the cylindrical image area generally corresponds to the symbols, text, shapes, graphics and other contents on cylindrical objects in the real world, such as: the name, logo, production date, manufacturer and ingredient description text of the water on the water bottle, and also: road signs and subway signs posted on cylindrical support columns in subway stations.
[0182] Step S504: Expand the virtual cylinder object on a cylinder surface to obtain plane texture data corresponding to the content texture projection data on the cylinder expansion plane of the virtual cylinder object as target plane texture data.
[0183] In the fifth embodiment of the present application, the so-called target plane texture data is the texture data corresponding to the cylindrical texture data on the cylindrical image area on the cylindrical expansion plane.
[0184] Step S505: Identify the image content on the cylindrical image area according to the target plane texture data.
[0185] Sixth embodiment
[0186] Corresponding to the application scenario of the image processing method provided by the present application and the image processing method provided by the first embodiment, the sixth embodiment of the present application further provides a text recognition method. Since the sixth embodiment is basically similar to the application scenario and the first embodiment, the description is relatively simple, and the relevant parts refer to the application scenario and the partial description of the first embodiment. The sixth embodiment described below is only illustrative.
[0187] Please refer to Figure 6 , which is a flowchart of a text recognition method provided in the sixth embodiment of the present application.
[0188] Step S601: obtaining a cylindrical image region in an image to be recognized.
[0189] In the sixth embodiment of the present application, the so-called image to be identified is an image containing at least one cylindrical image area. In the sixth embodiment of the present application, there is no specific limitation on the cylindrical image area contained in the image to be processed, and generally it only contains one cylindrical image area.
[0190] The so-called cylindrical image area is the image area to which the sub-image with a cylindrical shape in the image to be processed belongs. The sub-image with a cylindrical shape generally corresponds to cylindrical objects in the real world, such as: a water bottle with a cylindrical body, a cylindrical pen holder, a cylindrical support column, a street lamp pole, and a telephone pole.
[0191] In the sixth embodiment of the present application, before obtaining the image to be processed, image preprocessing may be performed on the image to be processed. The specific implementation method is: image quality enhancement of the image to be processed, such as: noise reduction processing of the image to be processed.
[0192] Step S602: establishing a projection model for projecting the cylindrical image area into a virtual cylindrical object.
[0193] Step S603: According to the projection model, the cylindrical image area is projected into a virtual cylindrical object, and the cylindrical text texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain text texture projection data of the cylindrical texture data on the virtual cylindrical object.
[0194] In the sixth embodiment of the present application, the so-called cylindrical text texture data on the cylindrical image area is the texture data corresponding to the text content on the cylindrical image area. The so-called texture data corresponding to the text content on the cylindrical image area includes: Chinese, English, Arabic numerals and other foreign text content on the cylindrical image area, such as: instructions and advertisements on the cylindrical image area. The content on the cylindrical image area generally corresponds to Chinese, English, Arabic numerals and other foreign text content on cylindrical objects in the real world, such as: the name of the water, production date, manufacturer and ingredient description text on the water bottle, and also: road signs and subway signs posted on cylindrical support columns in subway stations.
[0195] Step S604: Expand the virtual cylindrical object on the cylinder surface to obtain the plane text texture data corresponding to the text texture projection data on the cylinder expansion plane of the virtual cylindrical object as the target plane texture data.
[0196] In the sixth embodiment of the present application, the so-called target plane texture data is the text texture data corresponding to the cylindrical texture data on the cylindrical image area on the cylindrical expansion plane.
[0197] Step S605: Identify text content on the cylindrical image area according to the target plane texture data.
[0198] Although the present application is disclosed as above in the preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
[0199] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0200] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0201] 1. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.
[0202] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
Claims
1. An image processing method, characterized in that: include: Obtaining a cylindrical image region in an image to be recognized; Establishing a projection model that projects the cylindrical image area into a virtual cylindrical object; According to the projection model, the cylindrical image area is projected into the virtual cylindrical object, and the cylindrical texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object; According to the texture projection data, obtaining target plane texture data corresponding to the cylindrical image area; Wherein, obtaining the cylindrical image area in the image to be identified includes: Obtaining a bottom ellipse pair for locating the cylindrical image area in the image to be identified, wherein the bottom ellipse pair is a target ellipse pair in the image to be identified that meets a preset restriction condition and is used to locate the cylindrical image area; The cylindrical image region is located in the image to be recognized according to the base ellipse to obtain the cylindrical image region.
2. The image processing method according to claim 1, characterized in that: The step of obtaining target plane texture data corresponding to the cylindrical image area according to the texture projection data comprises: Expanding the virtual cylinder object; The plane texture data corresponding to the texture projection data on the cylinder expansion plane of the virtual cylinder object is obtained as the target plane texture data.
3. The image processing method according to claim 2, characterized in that: The step of performing cylindrical expansion on the virtual cylindrical object comprises: The virtual cylindrical object is unfolded on the cylinder surface according to the parallel line method to obtain the cylindrical surface unfolding plane.
4. The image processing method according to claim 1, characterized in that: The step of obtaining a base ellipse pair for locating the cylindrical image area in the image to be identified includes: Obtaining a target ellipse pair corresponding to the cylindrical image area; Determining whether the target ellipse pair satisfies a preset restriction condition, wherein the restriction condition is a condition for indicating whether the target ellipse pair can locate a complete cylindrical image area in the image to be identified; If so, the target ellipse pair is used as the base ellipse pair.
5. The image processing method according to claim 4, characterized in that: Obtaining a target ellipse pair corresponding to the cylindrical image area includes: Obtaining a target elliptical arc pair corresponding to the cylindrical image area, and extracting pixel points on the target elliptical arc pair; Fitting the pixel points on the target elliptical arc pair to obtain the elliptical equation corresponding to the target elliptical arc pair in the two-dimensional coordinate system of the cylindrical image; The target ellipse pair is obtained according to the ellipse equation corresponding to the target ellipse arc pair.
6. The image processing method according to claim 1, characterized in that: The step of establishing a projection model for projecting the cylindrical image area into a virtual cylindrical object comprises: Determine the two-dimensional coordinates of the ellipse corresponding to the base ellipse pair in the two-dimensional coordinate system of the cylindrical image; According to the two-dimensional coordinates of the ellipse, a virtual cylinder bottom surface corresponding to the virtual cylinder object in a three-dimensional coordinate system is determined based on the perspective projection principle, a first coordinate origin of the three-dimensional coordinate system and a second coordinate origin of the two-dimensional coordinate system of the cylindrical image are on the same straight line, and a plane where the coordinate axes of the specified two dimensions in the three-dimensional coordinate system are located is parallel to a plane where the two-dimensional coordinate system of the cylindrical image is located; The projection model is determined according to the target elliptical arc pair corresponding to the cylindrical image area and the virtual cylinder bottom surface.
7. The image processing method according to claim 6, characterized in that: The step of determining the virtual cylinder bottom surface corresponding to the virtual cylinder object in the three-dimensional coordinate system based on the perspective projection principle according to the two-dimensional coordinates of the ellipse includes: According to the two-dimensional coordinates of the ellipse, based on the perspective projection principle, determine the radius of the virtual cylinder bottom surface corresponding to the virtual cylinder bottom surface in the three-dimensional coordinate system, and determine the center of the virtual cylinder bottom surface corresponding to the virtual cylinder bottom surface in the three-dimensional coordinate system; The virtual cylindrical bottom surface is determined according to the virtual cylindrical bottom surface radius and the center of the virtual cylindrical bottom surface.
8. The image processing method according to claim 7, characterized in that: The projection model is determined according to the target elliptical arc pair corresponding to the cylindrical image area and the virtual cylinder bottom surface, including: determining the projection model according to the arc three-dimensional coordinates of the target elliptical arc pair in the three-dimensional coordinate system and the bottom three-dimensional coordinates of the virtual cylinder bottom surface in the three-dimensional coordinate system.
9. The image processing method according to claim 8, characterized in that: The method of determining the projection model based on the arc three-dimensional coordinates of the target elliptical arc pair in the three-dimensional coordinate system and the bottom three-dimensional coordinates of the virtual cylinder bottom surface in the three-dimensional coordinate system includes: determining, based on the arc three-dimensional coordinates and the bottom three-dimensional coordinates, a perspective projection viewing angle for perspectively projecting the bottom elliptical pair into the bottom surface of the virtual cylinder in the three-dimensional coordinate system as the projection model.
10. The image processing method according to claim 9, characterized in that: The projecting of the cylindrical image area into the virtual cylindrical object according to the projection model includes: projecting the cylindrical image area into the virtual cylindrical object in the three-dimensional coordinate system according to the perspective projection viewing angle, the radius of the virtual cylinder bottom surface corresponding to the virtual cylinder bottom surface in the three-dimensional coordinate system, and the center of the virtual cylinder bottom surface corresponding to the virtual cylinder bottom surface in the three-dimensional coordinate system.
11. The image processing method according to claim 10, characterized in that: The projecting the cylindrical texture data on the cylindrical image area onto the virtual cylindrical object comprises: Obtain texture two-dimensional coordinates of the cylindrical texture data in the cylindrical image two-dimensional coordinate system; Determining the texture three-dimensional coordinates of the cylindrical texture data in the three-dimensional coordinate system according to the texture two-dimensional coordinates; The cylindrical texture data is projected onto the virtual cylindrical object according to the texture three-dimensional coordinates and the perspective projection viewing angle.
12. The image processing method according to claim 5 or 6, characterized in that: The cylindrical image two-dimensional coordinate system is a two-dimensional coordinate system for the plane where the cylindrical image area is located.
13. An image processing device, characterized in that: include: A cylindrical image region obtaining unit, used for obtaining a cylindrical image region in an image to be identified; A projection model building unit, used to build a projection model that projects the cylindrical image area into a virtual cylindrical object; a texture projection data obtaining unit, configured to project the cylindrical image region into the virtual cylindrical object according to the projection model, and project the cylindrical texture data on the cylindrical image region onto the virtual cylindrical object, so as to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object; A target plane texture data obtaining unit, used for obtaining target plane texture data corresponding to the cylindrical image area according to the texture projection data; Among them, the cylindrical image area acquisition unit is also used to obtain a base ellipse pair in the image to be identified for locating the cylindrical image area, wherein the base ellipse pair is a target ellipse pair in the image to be identified that meets preset restriction conditions and is used to locate the cylindrical image area; the cylindrical image area is located in the image to be identified according to the base ellipse pair to obtain the cylindrical image area.
14. An electronic device, characterized in that: include: processor; as well as The memory is used to store a program of the image processing method. After the device is powered on and the program of the image processing method is run by the processor, the following steps are performed: Obtaining a cylindrical image region in an image to be recognized; Establishing a projection model that projects the cylindrical image area into a virtual cylindrical object; According to the projection model, the cylindrical image area is projected into the virtual cylindrical object, and the cylindrical texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object; According to the texture projection data, obtaining target plane texture data corresponding to the cylindrical image area; Wherein, obtaining the cylindrical image area in the image to be identified includes: Obtaining a bottom ellipse pair for locating the cylindrical image area in the image to be identified, wherein the bottom ellipse pair is a target ellipse pair in the image to be identified that meets a preset restriction condition and is used to locate the cylindrical image area; The cylindrical image region is located in the image to be recognized according to the base ellipse to obtain the cylindrical image region.
15. A storage medium, characterized in that: A program storing an image processing method is executed by a processor to perform the following steps: Obtaining a cylindrical image region in an image to be recognized; Establishing a projection model that projects the cylindrical image area into a virtual cylindrical object; According to the projection model, the cylindrical image area is projected into the virtual cylindrical object, and the cylindrical texture data on the cylindrical image area is projected onto the virtual cylindrical object to obtain texture projection data of the cylindrical texture data on the virtual cylindrical object; According to the texture projection data, obtaining target plane texture data corresponding to the cylindrical image area; Wherein, obtaining the cylindrical image area in the image to be identified includes: Obtaining a bottom ellipse pair for locating the cylindrical image area in the image to be identified, wherein the bottom ellipse pair is a target ellipse pair in the image to be identified that meets a preset restriction condition and is used to locate the cylindrical image area; The cylindrical image region is located in the image to be recognized according to the base ellipse to obtain the cylindrical image region.
Citation Information
Patent Citations
Fisheye image processing method and device and electronic equipment
CN109816587A