Detailed Description
In order to make the technical problems, technical solutions and advantages of the present invention more apparent, the following detailed description is given with reference to the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided only to help the full understanding of the embodiments of the present invention. Thus, it will be apparent to those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the invention. In addition, descriptions of well-known functions and constructions are omitted for clarity and conciseness.
Unless defined otherwise, technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention belongs. The use of "first," "second," and similar terms in the present application do not denote any order, quantity, or importance, but rather the terms are used to distinguish one element from another. Also, the use of the terms "a" or "an" and the like do not denote a limitation of quantity, but rather denote the presence of at least one.
As shown in fig. 1, a method for generating a track color according to an embodiment of the present invention includes:
step 101, receiving track input;
step 102, determining a track coordinate point input by a track and an initial color of the track coordinate point;
103, judging whether the initial color is similar to a predetermined candidate color;
and 104, under the condition that the initial color is similar to the candidate color, determining a target color according to the initial color, and updating the color of the track coordinate point to the target color.
It is easily understood that the track input may be an input of a user on a corresponding electronic device, where the electronic device may be a device such as a mobile terminal, a computer, or an electronic whiteboard, and is not specifically limited herein; the electronic device has a screen for display, such as a touch screen or a non-touch screen. For a touch screen, a user can directly slide on the touch screen through a finger or a tool such as a brush pen to realize track input; for a non-touch screen, a user may operate an external input device, such as a mouse, a touch pad, an electronic drawing board, etc., to implement track input.
For convenience of description, the following description mainly takes a user to perform a trace input on an electronic device through a brush pen as an example, and the trace color generation method provided by the embodiment of the present invention is described.
A trajectory input necessarily has a corresponding input position, which is typically reflected as a trajectory coordinate point. Here, the trajectory coordinate point may refer to a unit generated according to a preset minimum color, such as a pixel point at a coordinate position, or a coordinate area of a certain size. In practical operation, a trajectory formed by the trajectory input may be a line including a plurality of trajectory coordinate points, and for convenience of description, if no specific description is provided, the trajectory coordinate points in this embodiment may correspond to real-time contact positions of the user with the electronic whiteboard screen during the trajectory input process.
In practical applications, the screen of the electronic whiteboard may be pre-displayed with contents such as pictures, documents, etc., so that the coordinate points of the trajectory may have corresponding initial colors, which are determined by the pre-displayed contents and may be considered as ground colors. Meanwhile, when a painting brush used by a user inputs a track on an electronic screen, the painting brush can be provided with a predetermined color, namely the candidate color; the candidate color may be a default specific color, or a color selected by the user through a brush color selection input before the trace input, and the like, which is not specifically limited herein.
In the case of obtaining the initial color and the candidate color of the trajectory coordinate point, it may be determined whether the two colors are similar, specifically, at least one of the information of the spectrum, the gray value, the RGB value, the brightness, and the like of the two colors may be used to compare the similarity, and the selection of the specific information is not limited herein.
Taking spectral information as an example, when the initial color and the candidate color both belong to the same spectral color, the two colors can be considered to be similar; taking the gray value information as an example, when the absolute value of the difference between the gray values of the initial color and the candidate color is smaller than a certain gray threshold, the two colors can be considered to be similar.
When the initial color and the candidate color are similar, if a track is generated on the screen according to the candidate color, the track color may be similar to the ground color, and the track may be difficult to recognize; therefore, the present embodiment determines the target color in this case from the initial color. The target color may be a color that is dissimilar from the initial color. For example, when the initial color and the brush color (corresponding to the above candidate color) are black, the target color may be determined to be white; for another example, when the initial color and the brush color are light, the target color may be determined to be dark, and the distinction between light and dark of the colors may be implemented by setting the brightness of the colors.
After the target color is determined, the color of the trajectory coordinate point may be updated to the target color. It is readily understood that from the operating system perspective, the tracks and the pre-displayed content may be located in the same or different windows or layers; from the viewpoint of display technology, the color of the light-emitting unit of the track coordinate point may be changed, and the specific change process is to update the initial color of the track coordinate point to the target color.
The track color generation method provided by the embodiment of the invention receives track input, determines the track coordinate point of the track input and the initial color of the track coordinate point, compares the initial color with the predetermined candidate color, judges whether the initial color and the predetermined candidate color are similar, determines the target color according to the initial color under the similar condition, and updates the color of the track coordinate point from the initial color to the target color, so that the track color can be integrally distinguished from the ground color, the condition that the track identification degree is lower due to the similarity of the two colors is avoided, the identification degree of the track is effectively improved, and the track color generation effect is improved.
As shown in fig. 2, a method for generating a track color according to another embodiment of the present invention includes:
step 201, receiving track input;
step 202, determining a track coordinate point input by a track and an initial color of the track coordinate point;
step 203, judging whether the initial color is similar to a predetermined candidate color;
and 204, under the condition that the initial color is similar to the candidate color, determining a target color according to the initial color, and updating the color of the track coordinate point to the target color.
And step 205, in the case that the initial color is not similar to the candidate color, updating the color of the track coordinate point to the candidate color.
Steps 201 to 204 correspond to steps 101 to 104 in the previous embodiment, respectively, and are not described herein again.
As described above, the candidate color may be a brush color. In this embodiment, when the base color of the position of the brush pen input on the electronic whiteboard, that is, the initial color of the trajectory coordinate point is not similar to the brush pen color, the brush pen color can be presented with a higher degree of recognition, and therefore, the color of the trajectory coordinate point can be directly updated to a candidate color, so that the process of determining the target color according to the initial color is omitted, and the trajectory color generation efficiency is improved.
Optionally, as shown in fig. 3, the determining whether the initial color is similar to a predetermined candidate color includes:
step 301, judging whether the absolute value of the difference value between the first RGB value of the initial color and the second RGB value of the candidate color is smaller than the RGB difference value threshold value;
step 302, if the absolute value of the difference between the first RGB value and the second RGB value is smaller than the RGB difference threshold, determining that the initial color is similar to the candidate color;
in step 303, if the absolute value of the difference between the first RGB value and the second RGB value is greater than or equal to the RGB difference threshold, it is determined that the initial color is not similar to the candidate color.
The RGB value is a value determined based on an RGB color mode, the RGB color mode obtains various colors by the change of three color channels of Red (Red, R), Green (Green, G) and Blue (Blue, B) and the superposition of the three color channels, the RGB represents the three color channels of Red, Green and Blue, and the value range of each color channel can be 0-255. For example, the RGB value of black may be (0, 0, 0), the RGB value of red may be (255, 0, 0), and the RGB value of green may be (0, 255, 0).
The first RGB value is the RGB value of the initial color and the second RGB value is the RGB value of the candidate color. Setting the RGB difference threshold value to (128, 0, 0), and the first RGB value to (0, 1, 2); when the second RGB value is (3, 1, 2), the absolute value of the difference between the two RGB values is (3, 0, 0), and is less than the difference threshold, it may be determined that the initial color is similar to the candidate color; when the second RGB value is (200, 1, 2), the absolute value of the difference between the two RGB values is (200, 0, 0), and is greater than the difference threshold, it can be determined that the initial color is not similar to the candidate color.
The color is represented by the specific RGB value, whether the colors are similar or not can be judged through numerical operation, and convenience of similarity judgment is improved.
Alternatively, as shown in fig. 4, in the case that the initial color is similar to the candidate color, determining the target color according to the initial color and updating the color of the trajectory coordinate point to the target color includes:
step 401, determining a third RGB value of the target color according to a sum or difference of the first RGB value and the RGB difference threshold;
and step 402, updating the color of the track coordinate point to be the target color according to the third RGB value.
The following describes the present embodiment with reference to a specific application example:
assuming that the RGB difference threshold is (128, 0, 0), when the first RGB value is (0, 1, 2), the third RGB value may be determined as a sum of the RGB difference threshold and the first RGB value, i.e., (128, 1, 2); of course, alternatively, the third RGB value may also be determined as the difference of the first RGB value and the RGB difference threshold. Considering that the value range of each color channel is within 0-255, a calculated value may be greater than 255 when the value of some color channels in the first RGB value is added with the corresponding difference threshold, and in this case, 256 may be subtracted from the calculated value; for example, when the first RGB value is (128, 0, 200), after adding this difference threshold of (128, 0, 0), the resulting third RGB value may be (0, 200). Or, when the calculated value is a negative value after subtracting the corresponding difference threshold from the values of some color channels in the first RGB values, 256 may be added to the negative value to obtain the values of the third RGB values in these color channels.
And the third RGB value, that is, the RGB value of the target color, may update the color of the trajectory coordinate point by the third RGB value when the third RGB value is determined.
According to the embodiment, the track color and the ground color at the coordinate position are different, and the phenomenon that the identification degree of some coordinate positions in the finally generated track is low is effectively avoided.
Also, in order to avoid the phenomenon that the coordinate positions in the finally generated trajectory are less distinguishable, the present invention further provides a variation of the previous embodiment, and specifically, as shown in fig. 5, where the initial color is similar to the candidate color, the determining of the target color according to the initial color and the updating of the color of the coordinate point of the trajectory to the target color includes:
step 501, determining a third RGB value of the target color according to a preset RGB value mapping relation and the first RGB value;
and 502, updating the color of the track coordinate point to be the target color according to the third RGB value.
The preset RGB value mapping relationship may be a mapping relationship between the first RGB value and the third RGB value, for example, when a value of any color channel in the first RGB value is 0 to 127, a value corresponding to the color channel in the third RGB value may be determined to be 255; when the value of any color channel in the first RGB values is 128-255, the value corresponding to the color channel in the third RGB values can be determined to be 0; if the first RGB value corresponding to a certain track point is (5, 200, 5), the third RGB value determined for the track point is (255, 0, 255). Determining a third RGB value from the first RGB value by establishing an RGB value mapping relationship
It should be noted that, in the above embodiments, the specific value mapping relationship between the specific value of the RGB difference threshold and the preset RGB value mapping relationship is only an example for convenience of description, and in practical applications, the specific value mapping relationship may be set according to needs.
Optionally, the predetermined candidate color is a preset color.
In this embodiment, the candidate color may be a default color in the electronic whiteboard or a color selected by the user, for example, a control for color selection may be displayed on the electronic whiteboard, the user may perform a selection operation on the control before performing a trajectory input on the electronic whiteboard through a brush, and the electronic whiteboard determines the preset color in response to the selection operation. When the subsequent electronic whiteboard generates the track color according to the track input of the user, the preset color can be used as a candidate color to judge the similarity with the initial color of the track coordinate point.
According to the embodiment, the generated track color can be effectively distinguished from the ground color, and the track color is kept as the preset color as far as possible, so that the requirement of a user on the personalized selection of the track color is met.
As a variation of the previous embodiment, in the present embodiment, the trajectory input includes a plurality of trajectory coordinate points; and the candidate color used for judging whether the initial color of the first track coordinate point is similar to the candidate color of the initial color of the first track coordinate point is predetermined as the updated color of the last track coordinate point, wherein the first track coordinate point is any one track coordinate point which is not the initial track coordinate point in the plurality of track coordinate points.
As described above, the trajectory formed by the trajectory input may be a line including a plurality of trajectory coordinate points, that is, the trajectory input carries the position information of the trajectory, specifically, the trajectory input includes a plurality of trajectory coordinate points; the plurality of track coordinate points can correspond to the real-time contact positions of the brush and the electronic whiteboard screen and the screen positions of which the track color updating is finished.
For the starting trajectory coordinate point of the plurality of trajectory coordinate points, the candidate color thereof may be a default color or a user-selected color, which is not specifically limited herein. Unlike the previous embodiment, in the present embodiment, there may be a change in the candidate color during the subsequent trajectory input.
Specifically, for any one of the plurality of trajectory coordinate points other than the initial trajectory coordinate point, that is, the first trajectory coordinate point, the color of the updated trajectory coordinate point is determined to correspond to the predetermined color candidate. Taking the first trajectory coordinate point as the second trajectory coordinate point in the input trajectory as an example, the last trajectory coordinate point is the initial trajectory coordinate point, and the updated color of the initial trajectory coordinate point has two conditions, one is to keep the candidate color corresponding to the initial trajectory coordinate point, and the other is to determine the target color according to the initial color, and the specific determination process is explained in detail in the above embodiment, and is not repeated here; in either case, there is a color updating process for the initial trajectory coordinate point, and the updated color can be used as a predetermined candidate color for the second trajectory coordinate point.
Combining an actual application scene, wherein the left half part of the electronic whiteboard is white, the right half part of the electronic whiteboard is black, and the color of the painting brush is pre-selected to be black; the input trajectory moves from left to right, and when entering the right half from the left part, there is a process of determining a target color (white) from an initial color (black) at the trajectory coordinate point of the boundary line, while the input trajectory continues to move to the right, a predetermined candidate color for the trajectory coordinate point of each real-time contact position is changed to white, and then the color of the trajectory coordinate point may be directly determined as a candidate color, and a process of determining the target color (white) from a predetermined black candidate color and determining the color of the trajectory coordinate point as white is omitted.
By combining the practical application scenarios, the present embodiment can effectively improve the track color generation efficiency under the condition that a large-area color block exists in the ground color.
As shown in fig. 6, an embodiment of the present invention further provides a trajectory color generation apparatus, including:
a receiving module 601, configured to receive a trajectory input;
a determining module 602, configured to determine a trajectory coordinate point of the trajectory input and an initial color of the trajectory coordinate point;
a judging module 603, configured to judge whether the initial color is similar to a predetermined candidate color;
and a first updating module 604, configured to determine a target color according to the initial color and update the color of the trajectory coordinate point to the target color if the initial color is similar to the candidate color.
Optionally, the apparatus further comprises:
and in the case that the initial color is not similar to the candidate color, updating the color of the track coordinate point to the candidate color.
Optionally, the determining module 603 includes:
a judging unit for judging whether the absolute value of the difference between the first RGB value of the initial color and the second RGB value of the candidate color is smaller than the RGB difference threshold value;
a first determination unit configured to determine that the initial color is similar to the candidate color if an absolute value of a difference between the first RGB value and the second RGB value is smaller than an RGB difference threshold;
and the second judging unit is used for judging that the initial color is not similar to the candidate color if the absolute value of the difference value of the first RGB value and the second RGB value is greater than or equal to the RGB difference value threshold.
Optionally, the first updating module 604 includes:
the first determining unit is used for determining a third RGB value of the target color according to the sum or difference of the first RGB value and the RGB difference threshold value;
and the first updating unit is used for updating the color of the track coordinate point to the target color according to the third RGB value.
Optionally, the first updating module 604 includes:
the second determining unit is used for determining a third RGB value of the target color according to the preset RGB value mapping relation and the first RGB value;
and the second updating unit is used for updating the color of the track coordinate point to the target color according to the third RGB value.
Optionally, the predetermined candidate color is a preset color.
Optionally, the trajectory input comprises a plurality of trajectory coordinate points; and the candidate color used for judging whether the initial color of the first track coordinate point is similar to the candidate color of the initial color of the first track coordinate point is predetermined as the updated color of the last track coordinate point, wherein the first track coordinate point is any one track coordinate point which is not the initial track coordinate point in the plurality of track coordinate points.
The trajectory color generation device is a device corresponding to the trajectory color generation method, and all the implementation manners in the method embodiment are applicable to the embodiment of the device, so that the same technical effects can be achieved.
Optionally, an embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the trajectory color generation method described above when executing the computer program.
Optionally, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the trajectory color generation method described above.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.