Frame question method and device based on movement track, electronic equipment and storage medium

文档序号:1253277 发布日期:2020-08-21 浏览:10次 中文

阅读说明:本技术 基于移动轨迹的框题方法、装置、电子设备及存储介质 (Frame question method and device based on movement track, electronic equipment and storage medium ) 是由 曾菲 于 2020-04-30 设计创作,主要内容包括:本发明实施例涉及智能设备技术领域,公开了一种基于移动轨迹的框题方法、装置、电子设备及存储介质。该方法包括:当接收到框题指令时,开启摄像头识别操作体在承载体上的移动轨迹;利用移动轨迹和预设规则对承载体拍照,得到粗框图像;当移动轨迹为连续轨迹时,确定移动轨迹在粗框图像中的起点坐标和终点坐标,并获取粗框图像中起点坐标和终点坐标之间任意行的字符形成的基准直线;在起点坐标和终点坐标之间的连线与基准直线不平行时,基于起点坐标和终点坐标分别构建第一直线和第二直线;构建选择框,获取选择框内字符的图片。实施本发明实施例,只要基于起点坐标和终点坐标构建第一直线和第二直线即可得到选择框,操作更加方便。(The embodiment of the invention relates to the technical field of intelligent equipment, and discloses a frame question method and device based on a movement track, electronic equipment and a storage medium. The method comprises the following steps: when a frame question instruction is received, starting a camera to identify the moving track of an operating body on a bearing body; photographing the bearing body by using the moving track and a preset rule to obtain a coarse frame image; when the moving track is a continuous track, determining a starting point coordinate and an end point coordinate of the moving track in the coarse frame image, and acquiring a reference straight line formed by any row of characters between the starting point coordinate and the end point coordinate in the coarse frame image; when a connecting line between the starting point coordinate and the end point coordinate is not parallel to the reference straight line, respectively constructing a first straight line and a second straight line based on the starting point coordinate and the end point coordinate; and constructing a selection frame and acquiring the picture of the characters in the selection frame. By implementing the embodiment of the invention, the selection frame can be obtained by only constructing the first straight line and the second straight line based on the starting point coordinate and the end point coordinate, so that the operation is more convenient.)

1. A frame question method based on a moving track is characterized by comprising the following steps:

when a frame question instruction is received, a camera is started to identify the moving track of a user on a bearing body through an operation body;

photographing the bearing body by using the moving track and a preset rule to obtain a coarse frame image;

when the moving track is a continuous track, determining a starting point coordinate and an end point coordinate of the moving track in the coarse frame image, and acquiring a reference straight line formed by any row of characters between the starting point coordinate and the end point coordinate in the coarse frame image;

when a connecting line between the starting point coordinate and the end point coordinate is not parallel to the reference straight line, respectively constructing a first straight line and a second straight line which are parallel to the reference straight line based on the starting point coordinate and the end point coordinate;

and constructing a selection frame by using the first straight line, the second straight line and the edge of the rough frame image between the first straight line and the second straight line, and acquiring a picture of the character in the selection frame.

2. The framing method of claim 1, wherein constructing a first straight line and a second straight line parallel to the reference straight line based on the start point coordinates and the end point coordinates, respectively, comprises:

detecting whether the starting point coordinate and the end point coordinate fall on a character or not;

and if the starting point coordinate and the end point coordinate do not fall on the character, the constructed first straight line and the second straight line respectively pass through the starting point coordinate and the end point coordinate.

3. The framing method of claim 2, wherein if the start point coordinates or/and the end point coordinates fall on a character:

establishing a plane coordinate system of the coarse frame image by taking the base alignment line or a straight line parallel to the base alignment line as an abscissa axis;

determining the size of the longitudinal coordinate values of the starting point coordinate and the end point coordinate;

if the ordinate of the point falling on the character is a large value, adding a first preset value on the basis of the ordinate of the large value as a point through which a first straight line passes;

and if the ordinate of the point falling on the character is a smaller value, subtracting a second preset value on the basis of the ordinate of the smaller value to be used as a point through which a second straight line passes.

4. The framing method of claim 3, wherein the first character of the to-be-framed subject is taken as the start point coordinate of the movement track, and the last character of the to-be-framed subject is taken as the end point coordinate of the movement track; taking a line segment between the first character and the last character of the subject to be framed as a moving track;

adding a first preset value on the basis of the ordinate of the starting point coordinate to serve as a point through which a first straight line passes;

and subtracting a second preset value on the basis of the ordinate of the end point coordinate to serve as a point through which a second straight line passes.

5. The framing method of any one of claims 1-4, further comprising, after said obtaining the coarse frame image: and correcting the coarse frame image to enable the coarse frame image to be rectangular.

6. The framing method of any one of claims 1-4, wherein if a connecting line between the start point coordinates and the end point coordinates is parallel to a reference straight line, a picture of a character through which the connecting line between the start point coordinates and the end point coordinates passes is obtained.

7. A frame topic device based on a moving track is characterized by comprising:

the identification unit is used for starting the camera to identify the moving track of the user on the bearing body through the operation body when the frame question instruction is received;

the photographing unit is used for photographing the bearing body by utilizing the moving track and a preset rule to obtain a coarse frame image;

the acquisition unit is used for determining a starting point coordinate and an end point coordinate of the moving track in the coarse frame image and acquiring a reference straight line formed by any row of characters between the starting point coordinate and the end point coordinate in the coarse frame image when the moving track is a continuous track;

the construction unit is used for respectively constructing a first straight line and a second straight line which are parallel to the reference straight line based on the starting point coordinate and the end point coordinate when a connecting line between the starting point coordinate and the end point coordinate is not parallel to the reference straight line;

and the frame selection unit is used for constructing a selection frame by using the first straight line, the second straight line and the edge of the thick frame image between the first straight line and the second straight line, and acquiring the picture of the characters in the selection frame.

8. The framing apparatus of claim 7, wherein the building unit comprises:

the detection subunit is used for detecting whether the start point coordinate and the end point coordinate fall on the character;

the first judgment subunit is used for constructing a first straight line and a second straight line which respectively pass through the start point coordinate and the end point coordinate if the start point coordinate and the end point coordinate do not fall on the character;

a second judging subunit, configured to, if the start point coordinate or/and the end point coordinate falls on a character: establishing a plane coordinate system of the coarse frame image by taking the base alignment line or a straight line parallel to the base alignment line as an abscissa axis; determining the size of the longitudinal coordinate values of the starting point coordinate and the end point coordinate; if the ordinate of the point falling on the character is a large value, adding a first preset value on the basis of the ordinate of the large value as a point through which a first straight line passes; and if the ordinate of the point falling on the character is a smaller value, subtracting a second preset value on the basis of the ordinate of the smaller value to be used as a point through which a second straight line passes.

9. An electronic device, comprising: a memory storing executable program code; a processor coupled with the memory; the processor calls the executable program code stored in the memory for executing a movement trajectory based question method of any one of claims 1 to 6.

10. A computer-readable storage medium storing a computer program, wherein the computer program causes a computer to execute a method of framing a moving trajectory according to any one of claims 1 to 6.

Technical Field

The invention relates to the technical field of intelligent equipment, in particular to a method and a device for framing a question based on a moving track, electronic equipment and a storage medium.

Background

In order to solve the difficult problems of the homework of primary and secondary schools, a plurality of application programs for searching questions or gathering wrong questions for solving the difficult problems of the homework of students appear on the market at present, and all the application programs shoot the question pictures through a camera to be stored as wrong questions or used for searching corresponding answers. The implementation methods thereof are roughly divided into three types:

the first method is to select the question desired by the user in a mode of manually dragging the user to a cutting frame, and the cutting frame is required to be operated for multiple times in the mode so that the cutting frame is enlarged or reduced, and the question picture can be accurately acquired.

The second method is that a point is selected by using an operation body on a bearing body, then a picture is taken according to the point and a question picture is obtained by a certain training model based on a preset rule, which is more intelligent than the first method, but because the recognition phenomenon is usually concentrated in the range of one point, the obtained content picture is possibly incomplete or invalid information exists, and the result of searching the question is easy to make mistakes.

The third method is a track-based method, for example, an operation body is moved on a carrier, so that a moving track forms a closed curve frame, a camera recognizes the moving track, and the smart device selects a content frame in the closed curve frame based on the moving track, or a rectangular frame is constructed on the carrier by taking a start point coordinate and an end point coordinate of content to be framed as two ends of the moving track, and then a diagonal line is formed based on the start point coordinate and the end point coordinate, so as to obtain content in the rectangular frame.

In the method of closing the curve frame, when the operation body is moved, the operation body is not displayed explicitly, and the situation that the drawing of the user is incomplete easily occurs, the intelligent terminal cannot recognize the selection frame and may need to interact with the user for many times to complete, so that the user experience is affected, and for the situation that the start point coordinate and the end point coordinate are used as diagonal lines, if the first character of the content to be framed is not retracted or the last character is at the end of the last character, it is easy to rectangle the frame and determine the framed content, as shown in fig. 1, the rectangle 14 is obtained according to the diagonal line formed by the start point coordinate 12 and the end point coordinate 13 of the movement track 11. In fact, many times, the first and last lines of the subject to be framed may not occupy the same line as the middle line, and in this case, the starting point coordinate and the ending point coordinate have no reference object, and the content in the obtained rectangular frame is likely to be incomplete, as shown in fig. 2, since the positions of the starting point and the ending point are not easy to grasp, the rectangular frame 24 obtained from the diagonal line formed by the starting point coordinate 22 and the ending point coordinate 23 of the moving track 21 cannot be framed to obtain the complete content.

Disclosure of Invention

Aiming at the defects, the embodiment of the invention discloses a frame question method and device based on a moving track, electronic equipment and a storage medium, which ensure that the frame question is accurate and the operation is more convenient.

The first aspect of the embodiment of the invention discloses a frame question method based on a moving track, which comprises the following steps:

when a frame question instruction is received, a camera is started to identify the moving track of a user on a bearing body through an operation body;

photographing the bearing body by using the moving track and a preset rule to obtain a coarse frame image;

when the moving track is a continuous track, determining a starting point coordinate and an end point coordinate of the moving track in the coarse frame image, and acquiring a reference straight line formed by any row of characters between the starting point coordinate and the end point coordinate in the coarse frame image;

when a connecting line between the starting point coordinate and the end point coordinate is not parallel to the reference straight line, respectively constructing a first straight line and a second straight line which are parallel to the reference straight line based on the starting point coordinate and the end point coordinate;

and constructing a selection frame by using the first straight line, the second straight line and the edge of the rough frame image between the first straight line and the second straight line, and acquiring a picture of the character in the selection frame.

As an alternative implementation, in the first aspect of the embodiment of the present invention, the constructing a first straight line and a second straight line parallel to the reference straight line based on the start point coordinate and the end point coordinate respectively includes:

detecting whether the starting point coordinate and the end point coordinate fall on a character or not;

and if the starting point coordinate and the end point coordinate do not fall on the character, the constructed first straight line and the second straight line respectively pass through the starting point coordinate and the end point coordinate.

As an alternative implementation, in the first aspect of the embodiment of the present invention, if the start point coordinate or/and the end point coordinate falls on a character, then:

establishing a plane coordinate system of the coarse frame image by taking the base alignment line or a straight line parallel to the base alignment line as an abscissa axis;

determining the size of the longitudinal coordinate values of the starting point coordinate and the end point coordinate;

if the ordinate of the point falling on the character is a large value, adding a first preset value on the basis of the ordinate of the large value as a point through which a first straight line passes;

and if the ordinate of the point falling on the character is a smaller value, subtracting a second preset value on the basis of the ordinate of the smaller value to be used as a point through which a second straight line passes.

As an optional implementation manner, in the first aspect of the embodiment of the present invention, a first character of a to-be-framed question is used as a start point coordinate of a movement track, and a last character of the to-be-framed question is used as an end point coordinate of the movement track; taking a line segment between the first character and the last character of the subject to be framed as a moving track;

adding a first preset value on the basis of the ordinate of the starting point coordinate to serve as a point through which a first straight line passes;

and subtracting a second preset value on the basis of the ordinate of the end point coordinate to serve as a point through which a second straight line passes.

As an optional implementation manner, in the first aspect of the embodiment of the present invention, after the obtaining the coarse frame image, the method further includes: and correcting the coarse frame image to enable the coarse frame image to be rectangular.

As an alternative implementation manner, in the first aspect of the embodiment of the present invention, if a connection line between the start point coordinate and the end point coordinate is parallel to a reference straight line, a picture of a character through which the connection line between the start point coordinate and the end point coordinate passes is obtained.

The second aspect of the embodiments of the present invention discloses a question framing device based on a movement trajectory, which includes:

the identification unit is used for starting the camera to identify the moving track of the user on the bearing body through the operation body when the frame question instruction is received;

the photographing unit is used for photographing the bearing body by utilizing the moving track and a preset rule to obtain a coarse frame image;

the acquisition unit is used for determining a starting point coordinate and an end point coordinate of the moving track in the coarse frame image and acquiring a reference straight line formed by any row of characters between the starting point coordinate and the end point coordinate in the coarse frame image when the moving track is a continuous track;

the construction unit is used for respectively constructing a first straight line and a second straight line which are parallel to the reference straight line based on the starting point coordinate and the end point coordinate when a connecting line between the starting point coordinate and the end point coordinate is not parallel to the reference straight line;

and the frame selection unit is used for constructing a selection frame by using the first straight line, the second straight line and the edge of the thick frame image between the first straight line and the second straight line, and acquiring the picture of the characters in the selection frame.

As an optional implementation manner, in the second aspect of the embodiment of the present invention, the building unit includes:

the detection subunit is used for detecting whether the start point coordinate and the end point coordinate fall on the character;

the first judgment subunit is used for constructing a first straight line and a second straight line which respectively pass through the start point coordinate and the end point coordinate if the start point coordinate and the end point coordinate do not fall on the character;

a second judging subunit, configured to, if the start point coordinate or/and the end point coordinate falls on a character: establishing a plane coordinate system of the coarse frame image by taking the base alignment line or a straight line parallel to the base alignment line as an abscissa axis; determining the size of the longitudinal coordinate values of the starting point coordinate and the end point coordinate; if the ordinate of the point falling on the character is a large value, adding a first preset value on the basis of the ordinate of the large value as a point through which a first straight line passes; and if the ordinate of the point falling on the character is a smaller value, subtracting a second preset value on the basis of the ordinate of the smaller value to be used as a point through which a second straight line passes.

A third aspect of an embodiment of the present invention discloses an electronic device, including: a memory storing executable program code; a processor coupled with the memory; the processor calls the executable program code stored in the memory to execute the frame topic method based on the movement track disclosed by the first aspect of the embodiment of the invention.

A fourth aspect of the embodiments of the present invention discloses a computer-readable storage medium storing a computer program, where the computer program enables a computer to execute the method for framing a topic based on a movement trajectory disclosed in the first aspect of the embodiments of the present invention.

A fifth aspect of the embodiments of the present invention discloses a computer program product, which, when running on a computer, causes the computer to execute the method for framing a topic based on a movement trajectory disclosed in the first aspect of the embodiments of the present invention.

A sixth aspect of the present invention discloses an application publishing platform, where the application publishing platform is configured to publish a computer program product, and when the computer program product runs on a computer, the computer is enabled to execute a frame problem method based on a movement track disclosed in the first aspect of the present invention.

Compared with the prior art, the embodiment of the invention has the following beneficial effects:

in the embodiment of the invention, when a frame question instruction is received, a camera is started to identify the moving track of a user on a bearing body through an operation body; photographing the bearing body by using the moving track and a preset rule to obtain a coarse frame image; when the moving track is a continuous track, determining a starting point coordinate and an end point coordinate of the moving track in the coarse frame image, and acquiring a reference straight line formed by any row of characters between the starting point coordinate and the end point coordinate in the coarse frame image; when a connecting line between the starting point coordinate and the end point coordinate is not parallel to the reference straight line, respectively constructing a first straight line and a second straight line which are parallel to the reference straight line based on the starting point coordinate and the end point coordinate; and constructing a selection frame by using the first straight line, the second straight line and the edge of the rough frame image between the first straight line and the second straight line, and acquiring a picture of the character in the selection frame. Therefore, by implementing the embodiment of the invention, the selection frame can be obtained only by constructing the first straight line and the second straight line based on the starting point coordinate and the end point coordinate, so that accurate frame-based theme fetching is ensured, the operation is more convenient, and the user experience can be improved.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without creative efforts.

FIG. 1 is a schematic diagram of a conventional block diagram method;

FIG. 2 is a schematic diagram of another structure of the conventional block method;

FIG. 3 is a flow chart of a block method based on a moving track according to an embodiment of the present invention;

FIG. 4 is a flow chart of another block method based on a moving track according to the embodiment of the present invention;

FIG. 5 is a schematic diagram illustrating an example of a block method based on a moving track according to an embodiment of the present invention;

FIG. 6 is a schematic diagram illustrating an example of another block method based on a moving track according to an embodiment of the present invention;

FIG. 7 is a schematic structural diagram of a block device based on a moving track according to an embodiment of the present invention;

fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

It should be noted that the terms "first", "second", "third", "fourth", and the like in the description and the claims of the present invention are used for distinguishing different objects, and are not used for describing a specific order. The terms "comprises," "comprising," and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.

The embodiment of the invention discloses a frame question method and device based on a moving track, electronic equipment and a storage medium, wherein a selection frame can be obtained only by constructing a first straight line and a second straight line according to a starting point coordinate and an end point coordinate of the moving track, the operation is very simple and convenient, the completeness of a question can be ensured, the user experience is improved, and the following detailed description is combined with the attached drawings.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种题目收集的方法、装置、电子设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!