CN113706661B - Method and device for forming kaleidoscope special effect, electronic equipment and storage medium - Google Patents

Method and device for forming kaleidoscope special effect, electronic equipment and storage medium Download PDF

Info

Publication number
CN113706661B
CN113706661B CN202111250485.6A CN202111250485A CN113706661B CN 113706661 B CN113706661 B CN 113706661B CN 202111250485 A CN202111250485 A CN 202111250485A CN 113706661 B CN113706661 B CN 113706661B
Authority
CN
China
Prior art keywords
slice
image
filled
angle
square
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111250485.6A
Other languages
Chinese (zh)
Other versions
CN113706661A (en
Inventor
舒心
王轶
李一凡
刘铁华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Meishe Network Technology Co ltd
Original Assignee
Beijing Meishe Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Meishe Network Technology Co ltd filed Critical Beijing Meishe Network Technology Co ltd
Priority to CN202111250485.6A priority Critical patent/CN113706661B/en
Publication of CN113706661A publication Critical patent/CN113706661A/en
Application granted granted Critical
Publication of CN113706661B publication Critical patent/CN113706661B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)

Abstract

The invention provides a method and a device for forming a kaleidoscope special effect, electronic equipment and a storage medium, wherein the method comprises the following steps: the method comprises the steps of obtaining the width, the length and the number of slices of an image, determining the slice angle of the slices according to the number of the slices, obtaining a sampling slice from the image according to the slice angle and the width, creating a square image to be filled with the side length being the length, determining the shape, the size and the position of each slice in the square image to be filled according to the slice angle, and filling the sampling slice into each slice of the square image to be filled to form a kaleidoscope special effect image. By applying the method and the device, after the images and the number of slices are obtained, the kaleidoscope special effect images required by the user are directly obtained, the user does not need to manually and complexly operate post-processing software to process the images, meanwhile, the effect of the kaleidoscope special effect images can be determined according to the number of the slices input by the user, and the phenomenon that the kaleidoscope special effect images with single effect are generated by one key of an APP at a mobile terminal is avoided.

Description

Method and device for forming kaleidoscope special effect, electronic equipment and storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and an apparatus for forming a kaleidoscope special effect, an electronic device, and a storage medium.
Background
In image/video post-processing software and mobile terminal APP, the kaleidoscope special effect means that an image/video is simulated into a kaleidoscope form according to a specific rule. This is also a novel and user may be interested in special effects.
However, if an image/video is processed by the post-processing software, the user needs to store certain use knowledge of the post-processing software, the operation is complicated, and the image/video is generated by one key of the mobile terminal APP, so that the effect is single, and the requirements of the user cannot be met.
Disclosure of Invention
In view of the above problems, embodiments of the present invention provide a method and an apparatus for forming a kaleidoscope special effect, an electronic device, and a storage medium, which are used to solve the problems that the kaleidoscope special effect forming process is complex in operation, or the effect after formation is single.
In order to solve the above problems, an embodiment of the present invention discloses a method for forming a special effect of a kaleidoscope, which includes:
acquiring the width, the length and the number of slices of the image;
determining the slicing angle of the slices according to the number of the slices;
intercepting a sampling slice from the image according to the slice angle and the width;
creating a square image to be filled with the side length of the square image as the length;
determining the shape size and the position of each slice in the square image to be filled according to the slice angle; each slice in the square image to be filled forms a kaleidoscope around the central point of the square image to be filled;
and filling the sampling slices into each slice of the square image to be filled to form a kaleidoscope special effect image.
Optionally, the cutting out the sampling slice from the image according to the angle and the width of the slice includes:
intercepting a square image with the side length being the width from the image; wherein the center point position of the square image is the same as the center point position of the image;
and intercepting the sampling slice from the square image according to the slice angle.
Optionally, the cutting the sampling slice from the square image according to the angle of the slice includes:
determining a first reference line in the square image; the first reference line is a straight line connecting the position of the center point of the square image and the position of the long midpoint of one side of the square image;
determining the shape, size and position of the sampling slice in the square image according to the slice angle and the first reference line;
and truncating the sampling slice from the square image according to the shape size and the position of the sampling slice.
Optionally, the determining, according to the slice angle and the first reference line, the shape, size, and position of the sampling slice in the square image includes:
forming a right-angle triangle according to the slicing angle, the first datum line and the right angle between the first datum line and the side length; the central point position of the square image is used as the vertex of the slice angle, and the first datum line is used as the adjacent side of the slice angle;
and determining the shape size and the position of the sampling slice from the square image according to the right triangle.
Optionally, the determining the shape, size and position of each slice in the square image to be filled according to the slice angle includes:
determining a second reference line in the square image to be filled; the second reference line is a straight line connecting the position of the center point of the square image to be filled and the position of the long midpoint of one side of the square image to be filled;
and determining the shape, size and position of each slice in the square image to be filled according to the slice angle and the second datum line.
Optionally, the determining, according to the slice angle and the second reference line, the shape, size and position of each slice in the square image to be filled includes:
forming a right-angle triangle according to the slicing angle, the second datum line and the right angle between the second datum line and the side length; the position of the central point of the square image to be filled is used as the vertex of the slice angle, and the second datum line is used as the adjacent side of the slice angle;
determining the shape size and the position of the slice from the square image to be filled according to the right triangle;
taking the hypotenuse of the right triangle as a reference standard to obtain a mirror image right triangle of the right triangle;
determining the shape size and position of a mirror image slice of the slice from the square image to be filled according to the mirror image right triangle;
and taking the mirror image second reference line of the mirror image slice as the second reference line of the next slice, and determining the shape size and the position of the next slice from the square image to be filled so as to determine the shape size and the position of each slice and each mirror image slice in the square image to be filled.
Optionally, the filling the sampling slice as a base element into the slice of the square image to be filled to form a kaleidoscope special effects image includes:
obtaining a mirror image sampling slice of the sampling slice according to the sampling slice;
and filling the sampling slices into the slices of the square image to be filled, and filling the mirror image sampling slices into the mirror image slices of the square image to be filled to form a kaleidoscope special effect image.
Optionally, after the filling the sampling slice as a basic element into the slice of the square image to be filled to form a kaleidoscope special effects image, the method further includes:
intercepting an output image from the kaleidoscope special effect image according to the length and the width, and outputting the output image; and the position of the central point of the output image is the same as that of the central point of the kaleidoscope special effect image.
The embodiment of the invention discloses a device for forming a kaleidoscope special effect, which comprises:
the data acquisition module is used for acquiring the width, the length and the number of slices of the image;
the angle determining module is used for determining the slicing angles of the slices according to the number of the slices;
the slice intercepting module is used for intercepting a sampling slice from the image according to the slice angle and the width;
the image creating module is used for creating a square image to be filled, and the side length of the square image is the length;
the data determining module is used for determining the shape, size and position of each slice in the square image to be filled according to the slice angle; each slice in the square image to be filled forms a kaleidoscope around the central point of the square image to be filled;
and the slice filling module is used for filling the sampling slice into each slice of the square image to be filled to form a kaleidoscope special effect image.
Optionally, the slice truncation module includes:
the image intercepting submodule is used for intercepting a square image with the side length being the width from the image; wherein the center point position of the square image is the same as the center point position of the image;
and the slice intercepting submodule is used for intercepting the sampling slice from the square image according to the slice angle.
Optionally, the slice truncation sub-module includes:
a reference line determination unit for determining a first reference line in the square image; the first reference line is a straight line connecting the position of the center point of the square image and the position of the long midpoint of one side of the square image;
a first data determining unit, configured to determine, according to the slice angle and the first reference line, a shape size and a position of the sampling slice in the square image;
and the slice cutting unit is used for cutting out the sampling slice from the square image according to the shape size and the position of the sampling slice.
Optionally, the first data determining unit includes:
the triangle forming subunit is used for forming a right-angle triangle according to the slicing angle, the first datum line and the right angle between the first datum line and the side length; the central point position of the square image is used as the vertex of the slice angle, and the first datum line is used as the adjacent side of the slice angle;
and the data determining subunit is used for determining the shape size and the position of the sampling slice from the square image according to the right triangle.
Optionally, the data determining module includes:
a reference line determining submodule for determining a second reference line in the square image to be filled; the second reference line is a straight line connecting the position of the center point of the square image to be filled and the position of the long midpoint of one side of the square image to be filled;
and the data determination submodule is used for determining the shape, size and position of each slice in the square image to be filled according to the slice angle and the second datum line.
Optionally, the data determination sub-module includes:
the triangle forming unit is used for forming a right-angle triangle according to the slicing angle, the second datum line and the right angle between the second datum line and the side length; the position of the central point of the square image to be filled is used as the vertex of the slice angle, and the second datum line is used as the adjacent side of the slice angle;
the second data determination unit is used for determining the shape size and the position of the slice from the square image to be filled according to the right triangle;
a mirror triangle obtaining unit configured to obtain a mirror right triangle of the right triangle by using a hypotenuse of the right triangle as a reference;
a third data determination unit, configured to determine, according to the mirror right triangle, a shape size and a position of a mirror image slice of the slice from the square image to be filled;
and a fourth data determination unit, configured to determine a shape size and a position of a next slice from the square image to be filled, using a mirror image second reference line of the mirror image slice as a second reference line of the next slice, so as to determine a shape size and a position of each slice and each mirror image slice in the square image to be filled.
Optionally, the slice filling module comprises:
the mirror image slice obtaining submodule is used for obtaining a mirror image sampling slice of the sampling slice according to the sampling slice;
and the slice filling sub-module is used for filling the sampling slices into the slices of the square image to be filled, and the mirror image sampling slices are filled into the mirror image slices of the square image to be filled to form the kaleidoscope special effect image.
Optionally, the method further comprises:
the image intercepting module is used for intercepting an output image from the kaleidoscope special effect image according to the length and the width and outputting the output image; and the position of the central point of the output image is the same as that of the central point of the kaleidoscope special effect image.
The embodiment of the invention discloses electronic equipment, which comprises a processor, a memory and a computer program which is stored on the memory and can run on the processor, wherein when the computer program is executed by the processor, the steps of the kaleidoscope special effect forming method are realized.
The embodiment of the invention discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the steps of the kaleidoscope special effect forming method are realized.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, the width, the length and the number of slices of an image are acquired, the slice angle of the slice is determined according to the number of the slices, a sampling slice is obtained by cutting from the image according to the slice angle and the width, a square image to be filled with the length of one side is created, and the shape, the size and the position of each slice in the square image to be filled are determined according to the slice angle, wherein each slice in the square image to be filled forms a kaleidoscope around the central point of the square image to be filled, and the sampling slice is filled into each slice of the square image to be filled to form a kaleidoscope special effect image. By applying the embodiment of the invention, the kaleidoscope special effect image required by the user is directly obtained after the image and the number of slices are obtained, the user does not need to manually and complexly operate the post-processing software to process the image, and meanwhile, the effect of the kaleidoscope special effect image can be determined according to the number of the slices input by the user, so that the phenomenon that the kaleidoscope special effect image with single effect is generated by one key of the APP at the mobile terminal is avoided.
Drawings
FIG. 1 is a flow chart of the steps of an embodiment of a method of forming a kaleidoscope effect of the present invention;
FIG. 2 is a flow chart of steps in another embodiment of a method of forming a kaleidoscope effect of the present invention;
FIG. 3 is a schematic diagram of a square image capture embodiment of the present invention;
FIG. 4 is a schematic view of a sample slice truncation embodiment of the present invention;
FIG. 5 is a schematic diagram of a slice and mirror slice determination embodiment of the present invention;
FIG. 6 is a schematic diagram of an embodiment of an acquired image of the present invention;
FIG. 7 is one of the schematic diagrams of an output image embodiment of the present invention;
FIG. 8 is a second schematic diagram of an embodiment of an output image according to the present invention;
FIG. 9 is a third schematic diagram of an embodiment of an output image according to the present invention;
FIG. 10 is a block diagram of an embodiment of a device for forming a special effect of a kaleidoscope image according to the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a method for forming a special effect of a kaleidoscope according to the present invention is shown, and the embodiment of the present invention may specifically include the following steps:
step 101, acquiring the width, length and number of slices of an image.
The method for forming the kaleidoscope special effect is applied to special effect processing and synthesizing software of high-quality and high-efficiency videos and images, and can be used for carrying out special effect processing on the videos as well as special effect processing on the images; the number of slices refers to the number of slices in the formed kaleidoscope special effect image.
Specifically, before the image kaleidoscope special effect processing is performed, the width and the length of the image and the number of slices input by the user are acquired.
And 102, determining the slice angle of the slice according to the number of the slices.
Specifically, the slices have the same shape and size, and in the kaleidoscope special effect image to be formed, the slices surround the central point of the image to form the complete kaleidoscope, so that the slice angle can be obtained according to the number of the slices.
And 103, intercepting the image according to the slice angle and the width to obtain a sampling slice.
Specifically, a sampling slice is obtained by cutting from the image according to the slice angle and the width of the image, and the sampling slice is a basic element filled in the slice.
And 104, creating a square image to be filled with the side length of the square image to be filled.
And 105, determining the shape, size and position of each slice in the square image to be filled according to the slice angle.
And the slices in the square image to be filled form a kaleidoscope around the central point of the square image to be filled, and the slices have the same shape and size.
Specifically, a square image to be filled is created by taking the length of the image as the side length, the shape size and the position of each slice in the square image to be filled are determined according to the slice angle, and each slice in the square image to be filled forms a kaleidoscope around the center point of the square image to be filled.
And 106, filling the sampling slices into each slice of the square image to be filled to form a kaleidoscope special effect image.
Specifically, the sampling slices obtained by cutting out the image are used as basic elements to be filled in each slice of the square image to be filled, and a kaleidoscope special effect image is formed.
In the embodiment of the invention, after the images and the number of slices are obtained, the kaleidoscope special effect images required by the user are directly obtained, the user does not need to manually and complexly operate the post-processing software to process the images, and meanwhile, the effect of the kaleidoscope special effect images can be determined according to the number of the slices input by the user, so that the situation that the kaleidoscope special effect images with single effect are generated by one key of an APP at a mobile terminal is avoided.
Referring to fig. 2, a flow chart of steps of another embodiment of a method for forming a specific kaleidoscope effect of the present invention is shown, and the embodiment of the present invention may specifically include the following steps:
step 201, the width, length, and number of slices of the image are acquired.
And step 202, determining the slice angle of the slice according to the number of the slices.
The formed kaleidoscope special effect image also comprises mirror image slices corresponding to the slices besides the slices, the number of the mirror image slices is the same as that of the slices, the slices and the mirror image slices form a group of graphs, and the plurality of groups of graphs form the complete picture of the kaleidoscope.
Specifically, if the number of slices input is x, the number of mirror-image slices is also equal to x, so that the kaleidoscope special effect image to be formed is divided into 2x angles with the image center point position as the origin, resulting in a slice angle a = 360 °/2 x. For example, if the number of slices to be input is 3, then the number of mirror-image slices is also equal to 3, so that the kaleidoscope special effect image to be formed is divided into 6 angles with the image center point as the origin, resulting in a slice angle a = 360 °/6 =60 °.
And step 203, intercepting a square image with the side length being the width from the image.
The position of the central point of the square image is the same as that of the central point of the image; whether video or image, is generally rectangular, but a few are squares, the center point location is at the intersection of the diagonals of the rectangle or square.
Specifically, a central point in the image is taken as a reference, and a square image with the side length being the width is cut out from the image according to the width of the image and is used as a sampling texture. Referring to fig. 3, a schematic diagram of a square image clipping embodiment of the present invention is shown, as can be seen, the length of the image is w, and the width is h, a square image with a side length of h is clipped from the image, and the origin OA of the sampling texture is set at OB.
In the embodiment of the invention, the square image with the side length being the image width is cut out from the image, so that the situation that the sampling slice crosses the boundary of the original image in the subsequent step of cutting out the sampling slice is mainly prevented, and the source of the kaleidoscope special effect image is ensured to be from the original image which is not stretched.
In an example of the present invention, a square image with a length of one side being a width may also be cut out based on other positions of the image, for example, midpoint positions of four sides of the image (corresponding to midpoint positions of four sides of the square image), or a certain point position may be specified in the image according to a user requirement, which is not limited by the embodiment of the present invention.
And 204, intercepting the sampling slice from the square image according to the slice angle.
The step 204 includes: a first reference line in the square image is determined. The first reference line is a straight line connecting the position of the center point of the square image and the position of the long midpoint of one side of the square image; determining the shape, size and position of the sampling slice in the square image according to the slice angle and the first reference line; and truncating the sampling slice from the square image according to the shape size and the position of the sampling slice.
In an embodiment of the present invention, the determining, according to the slice angle and the first reference line, the shape, size and position of the sampling slice in the square image includes: forming a right-angle triangle according to the slicing angle, the first datum line and the right angle between the first datum line and the side length; the central point position of the square image is used as the vertex of the slice angle, and the first datum line is used as the adjacent side of the slice angle; and determining the shape size and the position of the sampling slice from the square image according to the right triangle.
Specifically, the central point position of the square image and the central point position of any side length of the square image are connected, the obtained straight line is a first reference line, the right angle between the first reference line and the side length is used as the right angle of a right-angled triangle, the first reference line takes a slicing angle at the central point position end of the square image, according to the slicing angle and the first reference line, the right angle between the first reference line and the side length is used as the right angle of the right-angled triangle, a right-angled triangle in the square image is determined, the shape size and the position of the triangle are the shape size and the position of a sampling slice in the square image, and the sampling slice is intercepted from the square image according to the shape size and the position of the sampling slice. Specifically, referring to fig. 4, a schematic diagram of an embodiment of sampling slice extraction of the present invention is shown, as can be seen, in a square image, O is an origin, OP is a first reference line, angle POQ is a slice angle a, and a right triangle OPQ is a required sampling slice. The OP' Q is a mirror image sample slice of the sample slice OPQ, and is obtained by mirroring the sample slice OPQ with OQ as a reference.
Step 205, creating a square image to be filled with the side length being the length.
And step 206, determining the shape, size and position of each slice in the square image to be filled according to the slice angle. And forming a kaleidoscope by each slice in the square image to be filled around the central point of the square image to be filled.
The step 206 includes: determining a second reference line in the square image to be filled; the second reference line is a straight line connecting the position of the center point of the square image to be filled and the position of the long midpoint of one side of the square image to be filled; and determining the shape, size and position of each slice in the square image to be filled according to the slice angle and the second datum line.
In an embodiment of the present invention, the determining, according to the slice angle and the second reference line, the shape, size and position of each slice in the square image to be filled includes: forming a right-angle triangle according to the slicing angle, the second datum line and the right angle between the second datum line and the side length; the position of the central point of the square image to be filled is used as the vertex of the slice angle, and the second datum line is used as the adjacent side of the slice angle; determining the shape size and the position of the slice from the square image to be filled according to the right triangle; taking the hypotenuse of the right triangle as a reference standard to obtain a mirror image right triangle of the right triangle; determining the shape size and position of a mirror image slice of the slice from the square image to be filled according to the mirror image right triangle; and taking the mirror image second reference line of the mirror image slice as the second reference line of the next slice, and determining the shape size and the position of the next slice from the square image to be filled so as to determine the shape size and the position of each slice and each mirror image slice in the square image to be filled.
Specifically, in the created square image to be filled, the position of the center point of the square image to be filled and the position of the long midpoint of any side of the square image to be filled are connected to obtain a second reference line, and the position of the center point of the square image to be filled is used as the vertex of the slice angle. Forming a right-angle triangle according to the slice angle, the second reference line and the right angle between the second reference line and the side length, so as to determine the shape, size and position of a slice from the square image to be filled according to the right-angle triangle; then, the hypotenuse of the right triangle is taken as a reference to obtain a mirror image right triangle of the right triangle, and the shape size and position of the mirror image slice of the slice are determined from the square image to be filled according to the mirror image right triangle, so that the combination of the first pair of slices and the mirror image slice is obtained.
After the combination of the first pair of slices and the mirror-image slice is obtained, the mirror-image second reference line (obtained by mirroring the first reference line of the slice) of the mirror-image slice is used as the second reference line of the next slice, and the shape size and the position of the next slice are determined from the square image to be filled so as to determine the shape size and the position of each slice and each mirror-image slice in the square image to be filled.
Specifically, referring to fig. 5, a schematic diagram of an embodiment of determining a slice and a mirror-image slice according to the present invention is shown, as can be seen, for the coordinates of the square image to be filled of (0,0) — (1,1), OP is a second reference line and is (0.5 ) and (1,0.5), and the coordinates of Q can also be obtained as (0.5+0.5cos (a),0.5+0.5sin (a)) according to the simple trigonometric function formula, so as to determine a right triangle OPQ with a slice angle a, that is, the slice, and OP2Q is a mirror-image slice of the slice OPQ. And operating by using special points, wherein the circle in the graph is an inscribed circle of the square image to be filled, each Pi point is positioned on the inscribed circle based on the second datum line, and the coordinates of any Pi are (cos (a) i, sin (a) i), namely O (0.5 ), Pi (cos (a) i, sin (a) i), a slice angle a, the length of one side (the length of the second datum line) and a right angle of each slice or mirror image slice are obtained, and further the shape size and the position of each slice and each mirror image slice in the square image to be filled are determined.
And step 207, filling the sampling slices into each slice of the square image to be filled to form a kaleidoscope special effect image.
In an embodiment of the present invention, the filling the sampling slice as a basic element into the slice of the square image to be filled to form a kaleidoscope special effects image includes: obtaining a mirror image sampling slice of the sampling slice according to the sampling slice; and filling the sampling slices into the slices of the square image to be filled, and filling the mirror image sampling slices into the mirror image slices of the square image to be filled to form a kaleidoscope special effect image.
The method comprises the following steps that a kaleidoscope is formed by surrounding the center point of a square image to be filled with each slice in the square image to be filled; the shape and size of each slice are the same, and the mirror image slices are also included, and the shape and size of the mirror image slices are the same as the shape and size of the slices, and the directions are opposite.
Specifically, referring to fig. 5, in the square image to be filled, OPQ is a slice, OP2Q is a mirror image slice of the slice OPQ, each slice in the square image to be filled and each mirror image slice form a kaleidoscope around the center point position of the square image to be filled, a sampling slice is filled into each slice in the square image, and the mirror image sampling slice is filled into each mirror image slice in the square image, so that a kaleidoscope special effect image is formed.
In an embodiment of the present invention, after the filling the sampling slice as a basic element into the slice of the square image to be filled to form a kaleidoscope special effects image, the method further includes: intercepting an output image from the kaleidoscope special effect image according to the length and the width, and outputting the output image; and the position of the central point of the output image is the same as that of the central point of the kaleidoscope special effect image.
Specifically, after the square image to be filled forms the kaleidoscope special effect image, the output image is cut out from the kaleidoscope special effect image according to the length and the width of the image, and referring to fig. 5, as can be seen from the figure, after the square image to be filled is filled to form the kaleidoscope special effect image, the output image (gray dotted frame) with the width of h and the length of w is cut out from the kaleidoscope special effect image so as to ensure that the output image and the input image have the same size.
Referring to fig. 6, a schematic diagram illustrating an embodiment of an acquired image according to the present invention, after the image of fig. 6 is acquired, the effect of the subsequent output image is different according to the acquired number of slices, referring to fig. 7, an effect diagram of an output image with the number of slices of 6, referring to fig. 8, an effect diagram of an output image with the number of slices of 12, referring to fig. 9, an effect diagram of an output image with the number of slices of 24.
In the embodiment of the invention, after the images and the number of slices are obtained, the kaleidoscope special effect images required by the user are directly obtained, the user does not need to manually and complexly operate the post-processing software to process the images, and meanwhile, the effect of the kaleidoscope special effect images can be determined according to the number of the slices input by the user, so that the situation that the kaleidoscope special effect images with single effect are generated by one key of the APP at the mobile terminal is avoided.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 10, a block diagram of a structure of an embodiment of a device for forming a special effect of a kaleidoscope image according to the present invention is shown, and the embodiment of the present invention may specifically include the following modules:
a data acquisition module 1001 for acquiring the width, length, and number of slices of an image;
an angle determining module 1002, configured to determine a slice angle of a slice according to the number of slices;
a slice intercepting module 1003, configured to intercept a sampling slice from the image according to the slice angle and the width;
an image creating module 1004, configured to create a square image to be filled, where a side length is the length;
a data determining module 1005, configured to determine, according to the slice angle, a shape size and a position of each slice in the square image to be filled; each slice in the square image to be filled forms a kaleidoscope around the central point of the square image to be filled;
a slice filling module 1006, configured to fill the sampling slice into each slice of the square image to be filled, so as to form a kaleidoscope special effects image.
In an embodiment of the present invention, the slice intercepting module 1003 includes:
the image intercepting submodule is used for intercepting a square image with the side length being the width from the image; wherein the center point position of the square image is the same as the center point position of the image;
and the slice intercepting submodule is used for intercepting the sampling slice from the square image according to the slice angle.
In an embodiment of the present invention, the slice truncation sub-module includes:
a reference line determination unit for determining a first reference line in the square image; the first reference line is a straight line connecting the position of the center point of the square image and the position of the long midpoint of one side of the square image;
a first data determining unit, configured to determine, according to the slice angle and the first reference line, a shape size and a position of the sampling slice in the square image;
and the slice cutting unit is used for cutting out the sampling slice from the square image according to the shape size and the position of the sampling slice.
In an embodiment of the present invention, the first data determining unit includes:
the triangle forming subunit is used for forming a right-angle triangle according to the slicing angle, the first datum line and the right angle between the first datum line and the side length; the central point position of the square image is used as the vertex of the slice angle, and the first datum line is used as the adjacent side of the slice angle;
and the data determining subunit is used for determining the shape size and the position of the sampling slice from the square image according to the right triangle.
In an embodiment of the present invention, the data determining module 1005 includes:
a reference line determining submodule for determining a second reference line in the square image to be filled; the second reference line is a straight line connecting the position of the center point of the square image to be filled and the position of the long midpoint of one side of the square image to be filled;
and the data determination submodule is used for determining the shape, size and position of each slice in the square image to be filled according to the slice angle and the second datum line.
In an embodiment of the present invention, the data determination sub-module includes:
the triangle forming unit is used for forming a right-angle triangle according to the slicing angle, the second datum line and the right angle between the second datum line and the side length; the position of the central point of the square image to be filled is used as the vertex of the slice angle, and the second datum line is used as the adjacent side of the slice angle;
the second data determination unit is used for determining the shape size and the position of the slice from the square image to be filled according to the right triangle;
a mirror triangle obtaining unit configured to obtain a mirror right triangle of the right triangle by using a hypotenuse of the right triangle as a reference;
a third data determination unit, configured to determine, according to the mirror right triangle, a shape size and a position of a mirror image slice of the slice from the square image to be filled;
and a fourth data determination unit, configured to determine a shape size and a position of a next slice from the square image to be filled, using a mirror image second reference line of the mirror image slice as a second reference line of the next slice, so as to determine a shape size and a position of each slice and each mirror image slice in the square image to be filled.
In an embodiment of the present invention, the slice filling module 1006 includes:
the mirror image slice obtaining submodule is used for obtaining a mirror image sampling slice of the sampling slice according to the sampling slice;
and the slice filling sub-module is used for filling the sampling slices into the slices of the square image to be filled, and the mirror image sampling slices are filled into the mirror image slices of the square image to be filled to form the kaleidoscope special effect image.
In an embodiment of the present invention, the method further includes:
the image intercepting module is used for intercepting an output image from the kaleidoscope special effect image according to the length and the width and outputting the output image; and the position of the central point of the output image is the same as that of the central point of the kaleidoscope special effect image.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiment of the invention discloses electronic equipment, which comprises a processor, a memory and a computer program which is stored on the memory and can run on the processor, wherein when the computer program is executed by the processor, the steps of the forming method embodiment of the kaleidoscope special effect are realized.
The embodiment of the invention discloses a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and the computer program is used for realizing the steps of the forming method embodiment of the kaleidoscope special effect when being executed by a processor.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The method for forming the kaleidoscope special effect, the device for forming the kaleidoscope special effect, the electronic equipment and the storage medium provided by the invention are described in detail, specific examples are applied in the text to explain the principle and the implementation mode of the invention, and the description of the examples is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (8)

1. A method of forming a kaleidoscope effect, the method comprising:
acquiring the width, the length and the number of slices of the image; the shape and the size of each slice are the same, each slice is provided with a corresponding mirror image slice, the number of the mirror image slices is the same as that of the slices, and each slice and the mirror image slices surround a central point to form a kaleidoscope;
determining the slicing angle of the slices according to the number of the slices and the number of the mirror image slices;
intercepting a sampling slice from the image according to the slice angle and the width;
creating a square image to be filled with the side length of the square image as the length;
determining a second reference line in the square image to be filled; the second reference line is a straight line connecting the position of the center point of the square image to be filled and the position of the long midpoint of one side of the square image to be filled;
forming a right-angle triangle according to the slicing angle, the second datum line and the right angle between the second datum line and the side length; the position of the central point of the square image to be filled is used as the vertex of the slice angle, and the second datum line is used as the adjacent side of the slice angle;
determining the shape size and the position of the slice from the square image to be filled according to the right triangle;
taking the hypotenuse of the right triangle as a reference standard to obtain a mirror image right triangle of the right triangle;
determining the shape size and position of a mirror image slice of the slice from the square image to be filled according to the mirror image right triangle;
taking a mirror image second reference line of the mirror image slice as a second reference line of a next slice, and determining the shape size and the position of the next slice from the square image to be filled so as to determine the shape size and the position of each slice and each mirror image slice in the square image to be filled;
obtaining a mirror image sampling slice of the sampling slice according to the sampling slice;
and filling the sampling slices into the slices of the square image to be filled, and filling the mirror image sampling slices into the mirror image slices of the square image to be filled to form a kaleidoscope special effect image.
2. The method of claim 1, wherein said truncating a sample slice from the image according to the angle and the width of the slice comprises:
intercepting a square image with the side length being the width from the image; wherein the center point position of the square image is the same as the center point position of the image;
and intercepting the sampling slice from the square image according to the slice angle.
3. The method of claim 2, wherein said truncating the sample slice from the square image according to the slice angle comprises:
determining a first reference line in the square image; the first reference line is a straight line connecting the position of the center point of the square image and the position of the long midpoint of one side of the square image;
determining the shape, size and position of the sampling slice in the square image according to the slice angle and the first reference line;
and truncating the sampling slice from the square image according to the shape size and the position of the sampling slice.
4. The method of claim 3, wherein said determining the shape size and position of the sample slice in the square image based on the slice angle and the first reference line comprises:
forming a right-angle triangle according to the slicing angle, the first datum line and the right angle between the first datum line and the side length; the central point position of the square image is used as the vertex of the slice angle, and the first datum line is used as the adjacent side of the slice angle;
and determining the shape size and the position of the sampling slice from the square image according to the right triangle.
5. The method according to claim 1, wherein after said filling the sampled slice as a base element into the slice of the square image to be filled, forming a kaleidoscope special effects image, further comprising:
intercepting an output image from the kaleidoscope special effect image according to the length and the width, and outputting the output image; and the position of the central point of the output image is the same as that of the central point of the kaleidoscope special effect image.
6. An apparatus for forming a kaleidoscope effect, the apparatus comprising:
the data acquisition module is used for acquiring the width, the length and the number of slices of the image; the shape and the size of each slice are the same, each slice is provided with a corresponding mirror image slice, the number of the mirror image slices is the same as that of the slices, and each slice and the mirror image slices surround a central point to form a kaleidoscope;
the angle determining module is used for determining the slice angle of the slice according to the slice number and the mirror image slice number;
the slice intercepting module is used for intercepting a sampling slice from the image according to the slice angle and the width;
the image creating module is used for creating a square image to be filled, and the side length of the square image is the length;
the data determining module is used for determining a second datum line in the square image to be filled; the second reference line is a straight line connecting the position of the center point of the square image to be filled and the position of the long midpoint of one side of the square image to be filled;
forming a right-angle triangle according to the slicing angle, the second datum line and the right angle between the second datum line and the side length; the position of the central point of the square image to be filled is used as the vertex of the slice angle, and the second datum line is used as the adjacent side of the slice angle;
determining the shape size and the position of the slice from the square image to be filled according to the right triangle;
taking the hypotenuse of the right triangle as a reference standard to obtain a mirror image right triangle of the right triangle;
determining the shape size and position of a mirror image slice of the slice from the square image to be filled according to the mirror image right triangle;
taking a mirror image second reference line of the mirror image slice as a second reference line of a next slice, and determining the shape size and the position of the next slice from the square image to be filled so as to determine the shape size and the position of each slice and each mirror image slice in the square image to be filled;
the slice filling module is used for obtaining a mirror image sampling slice of the sampling slice according to the sampling slice;
and filling the sampling slices into the slices of the square image to be filled, and filling the mirror image sampling slices into the mirror image slices of the square image to be filled to form a kaleidoscope special effect image.
7. An electronic device comprising a processor, a memory and a computer program stored on the memory and operable on the processor, the computer program, when executed by the processor, implementing the steps of the method of forming a kaleidoscope effect of any of claims 1 to 5.
8. A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of the method of forming a kaleidoscope effect as claimed in any one of claims 1 to 5.
CN202111250485.6A 2021-10-26 2021-10-26 Method and device for forming kaleidoscope special effect, electronic equipment and storage medium Active CN113706661B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111250485.6A CN113706661B (en) 2021-10-26 2021-10-26 Method and device for forming kaleidoscope special effect, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111250485.6A CN113706661B (en) 2021-10-26 2021-10-26 Method and device for forming kaleidoscope special effect, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113706661A CN113706661A (en) 2021-11-26
CN113706661B true CN113706661B (en) 2022-02-25

Family

ID=78647041

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111250485.6A Active CN113706661B (en) 2021-10-26 2021-10-26 Method and device for forming kaleidoscope special effect, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113706661B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6091423A (en) * 1993-04-17 2000-07-18 Sony Corporation Image transformation system for producing a kaleidoscope effect
US6300983B1 (en) * 1996-11-06 2001-10-09 Atr Media Integration & Communication Research Laboratories Electronic kaleidoscopic apparatus capable of forming kaleidoscopic image containing in situ image of observer himself
CN106331435A (en) * 2016-08-22 2017-01-11 北京小鸟科技股份有限公司 Real-time image special-effect display realization method
CN108012090A (en) * 2017-10-25 2018-05-08 北京川上科技有限公司 A kind of method for processing video frequency, device, mobile terminal and storage medium
CN108510563A (en) * 2018-03-12 2018-09-07 天津大学 A kind of pattern rapid generation for imitating Art Deco Style Art-Deco and carrying out
CN110276817A (en) * 2019-06-28 2019-09-24 北京金山安全软件有限公司 Method and device for making picture and electronic equipment
CN110991617A (en) * 2019-12-02 2020-04-10 华东师范大学 Construction method of kaleidoscope convolution network

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9649555B2 (en) * 2013-05-17 2017-05-16 Brain Enterprises, LLC System and process for a puzzle game
CN109784105A (en) * 2019-01-29 2019-05-21 博智税通信息科技股份有限公司广东分公司 Information-pushing method, medium, device and terminal device
CN110619318B (en) * 2019-09-27 2021-03-02 腾讯科技(深圳)有限公司 Image processing method, microscope, system and medium based on artificial intelligence

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6091423A (en) * 1993-04-17 2000-07-18 Sony Corporation Image transformation system for producing a kaleidoscope effect
US6300983B1 (en) * 1996-11-06 2001-10-09 Atr Media Integration & Communication Research Laboratories Electronic kaleidoscopic apparatus capable of forming kaleidoscopic image containing in situ image of observer himself
CN106331435A (en) * 2016-08-22 2017-01-11 北京小鸟科技股份有限公司 Real-time image special-effect display realization method
CN108012090A (en) * 2017-10-25 2018-05-08 北京川上科技有限公司 A kind of method for processing video frequency, device, mobile terminal and storage medium
CN108510563A (en) * 2018-03-12 2018-09-07 天津大学 A kind of pattern rapid generation for imitating Art Deco Style Art-Deco and carrying out
CN110276817A (en) * 2019-06-28 2019-09-24 北京金山安全软件有限公司 Method and device for making picture and electronic equipment
CN110991617A (en) * 2019-12-02 2020-04-10 华东师范大学 Construction method of kaleidoscope convolution network

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Kaleidoscope: Adding colors to Kademlia;Gil Einziger等;《IEEE》;20131219;全文 *
P. Sjögren等.Structuring the engineering change management process around change carriers.《IEEE》.2016, *
双曲镜面成像单目全景感知三维重构技术研究;郭伟青;《小型微型计算机系统》;20190531;全文 *

Also Published As

Publication number Publication date
CN113706661A (en) 2021-11-26

Similar Documents

Publication Publication Date Title
US11681745B2 (en) Digital image presentation
CN111950056B (en) BIM display method and related equipment for building informatization model
CN112004032B (en) Video processing method, terminal device and storage medium
JP7182689B2 (en) Video frame processing method and apparatus
CN112581632B (en) House source data processing method and device
CN109118456B (en) Image processing method and device
CN108510084B (en) Method and apparatus for generating information
CN111787312A (en) Video delay test method, system, electronic equipment and storage medium
CN110765799A (en) Client code scanning identification method, device, equipment and storage medium
CN113538502A (en) Picture clipping method and device, electronic equipment and storage medium
CN111340960A (en) Image modeling method and device, storage medium and electronic equipment
CN113706661B (en) Method and device for forming kaleidoscope special effect, electronic equipment and storage medium
CN110363837A (en) The processing method and processing device of texture image, electronic equipment, storage medium in game
CN112445394B (en) Screenshot method and screenshot device
US12008034B2 (en) Digital image presentation
CN111724329B (en) Image processing method and device and electronic equipment
CN114007056A (en) Method and device for generating three-dimensional panoramic image
CN111275800B (en) Animation generation method and device, electronic equipment and computer readable storage medium
CN114419298A (en) Virtual object generation method, device, equipment and storage medium
CN113810755A (en) Panoramic video preview method and device, electronic equipment and storage medium
CN111461966B (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN113726948B (en) Picture display method and device
CN113781544B (en) Plane detection method and device
CN112766285B (en) Image sample generation method and device and electronic equipment
CN114066722B (en) Method and device for acquiring image and electronic equipment

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
GR01 Patent grant
GR01 Patent grant