Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a method and a system for adjusting the brightness of a light-emitting device.
The invention provides a brightness adjusting method of a light-emitting device, which comprises the following steps:
acquiring a sliding starting point and a sliding ending point of a sliding action on a screen of the mobile terminal;
determining the sliding direction of the sliding action according to the sliding starting point and the sliding ending point;
determining a unit pixel brightness value according to the pixel value corresponding to the sliding direction;
and determining a sliding pixel value according to the sliding direction, the sliding starting point and the sliding ending point, and acquiring a brightness difference value according to the sliding pixel value and the unit pixel brightness value so as to adjust the current brightness of the light-emitting device according to the brightness difference value.
According to the brightness adjusting method of the light emitting device provided by the invention, the determining the sliding direction of the sliding action according to the sliding starting point and the sliding ending point comprises the following steps:
acquiring a horizontal distance between the sliding starting point and the sliding end point and a vertical distance between the sliding starting point and the sliding end point according to the sliding starting point and the sliding end point;
judging the horizontal distance and the vertical distance, and if the horizontal distance is greater than the vertical distance, judging that the sliding direction is the horizontal direction;
and if the horizontal distance is smaller than or equal to the vertical distance, judging to acquire that the sliding direction is the vertical direction.
According to the brightness adjusting method of the light emitting device provided by the invention, the determining the unit pixel brightness value according to the pixel value corresponding to the sliding direction comprises the following steps:
if the sliding direction is the horizontal direction, determining the brightness value of the unit pixel according to the pixel value of the screen width corresponding to the horizontal direction;
and if the sliding direction is the vertical direction, determining the unit pixel brightness value according to the pixel value of the screen height corresponding to the vertical direction.
According to a luminance adjusting method of a light emitting device provided by the present invention, determining a sliding pixel according to the sliding direction, the sliding start point and the sliding end point, and obtaining a luminance difference value according to the sliding pixel and the unit pixel luminance value, includes:
if the sliding direction is the horizontal direction, determining a first sliding pixel according to the horizontal distance between the sliding end point and the sliding start point, and acquiring a brightness difference value corresponding to the first sliding pixel according to the first sliding pixel and the unit pixel brightness value;
and if the sliding direction is the vertical direction, determining a second sliding pixel according to the vertical distance between the sliding end point and the sliding start point, and acquiring a brightness difference value corresponding to the second sliding pixel according to the second sliding pixel and the unit pixel brightness value.
According to a luminance adjusting method of a light emitting apparatus provided by the present invention, after the obtaining of the luminance difference value according to the sliding pixel and the unit pixel luminance value, the method further includes:
acquiring a brightness value to be adjusted of the light-emitting device according to the current brightness value of the light-emitting device and the brightness difference value;
and judging the brightness value to be adjusted of the light-emitting device, and adjusting the brightness of the light-emitting device according to the judgment result.
According to the brightness adjusting method of the light emitting device provided by the invention, the judging of the brightness value to be adjusted of the light emitting device and the brightness adjustment of the light emitting device according to the judging result comprise the following steps:
judging the brightness value to be adjusted of the light-emitting device, and if the brightness value to be adjusted of the light-emitting device is judged to be larger than a first preset threshold, adjusting the current brightness value of the light-emitting device to be the first preset threshold;
if the brightness value to be adjusted of the light-emitting device is judged to be smaller than a second preset threshold value, adjusting the current brightness value of the light-emitting device to the second preset threshold value;
and if the brightness value to be adjusted of the light-emitting device is judged to be greater than or equal to the second preset threshold value and less than or equal to the first preset threshold value, adjusting the current brightness value of the light-emitting device to the brightness adjustment value of the light-emitting device.
The present invention also provides a brightness adjusting system of a light emitting device, comprising:
the sliding position determining module is used for acquiring a sliding starting point and a sliding ending point of a sliding action on a screen of the mobile terminal;
a sliding direction obtaining module, configured to determine a sliding direction of the sliding motion according to the sliding starting point and the sliding ending point;
the unit pixel brightness determining module is used for determining the unit pixel brightness value according to the pixel value corresponding to the sliding direction;
and the brightness difference value acquisition module is used for determining a sliding pixel value according to the sliding direction, the sliding starting point and the sliding ending point, and acquiring a brightness difference value according to the sliding pixel value and the unit pixel brightness value so as to adjust the current brightness of the light-emitting device according to the brightness difference value.
According to the brightness adjusting system of the light emitting device provided by the present invention, the sliding direction obtaining module further comprises:
a distance determining unit for acquiring a horizontal distance between the sliding start point and the sliding end point and a vertical distance between the sliding start point and the sliding end point according to the sliding start point and the sliding end point;
the first judging unit is used for judging the horizontal distance and the vertical distance, and if the horizontal distance is greater than the vertical distance, judging that the sliding direction is the horizontal direction;
and the second judging unit is used for judging that the sliding direction is the vertical direction if the horizontal distance is smaller than or equal to the vertical distance.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the steps of the method for adjusting the brightness of the light-emitting device.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method for adjusting the brightness of a light emitting device as described in any one of the above.
According to the brightness adjusting method and system of the light-emitting device, the screen of the mobile terminal slides, the sliding direction is determined according to the sliding starting point and the sliding end point, and the screen of the mobile phone can slide at any position quickly; obtaining the brightness value of the unit pixel through the screen pixel value corresponding to the sliding direction; and obtaining a brightness difference value according to the sliding pixel value and the brightness value of the unit pixel, thereby realizing the rapid and continuous brightness adjustment of the light-emitting equipment according to the brightness difference value and improving the convenience of the operation of the user terminal.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. 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.
Fig. 3 is a schematic flow chart of a method for adjusting brightness of a light emitting device according to the present invention, and as shown in fig. 3, the present invention provides a method for adjusting brightness of a light emitting device, including:
step 301, acquiring a sliding starting point and a sliding ending point of a sliding action on a screen of the mobile terminal;
step 302, determining the sliding direction of the sliding action according to the sliding starting point and the sliding ending point;
step 303, determining a unit pixel brightness value according to the pixel value corresponding to the sliding direction;
step 304, determining a sliding pixel value according to the sliding direction, the sliding starting point and the sliding ending point, and obtaining a brightness difference value according to the sliding pixel value and the unit pixel brightness value to adjust the current brightness of the light-emitting device according to the brightness difference value.
In the invention, the user takes the whole screen of the mobile terminal as an effective operation area (for example, in a control page of a smart lamp H5), and performs a sliding action at any position of the screen of the mobile terminal, so as to obtain a sliding starting point and a sliding ending point of the sliding action on the screen of the mobile terminal. Specifically, the swipe start point is the start point coordinate of the swipe action, and the swipe end point is the end point coordinate of the swipe action.
Further, the sliding direction of the sliding motion is further determined by acquiring the sliding start point coordinate and the sliding end point coordinate of the sliding motion. The sliding direction may be a horizontal direction, a vertical direction, or a direction with any angle.
Further, since each pixel has a corresponding luminance value, the unit pixel luminance value is determined by the corresponding pixel value on the screen of the mobile terminal in the sliding direction.
Further, judging the sliding direction, and obtaining a sliding pixel value according to the judgment result of the sliding direction, the sliding starting point coordinate and the sliding ending point coordinate; acquiring a brightness difference value according to the sliding pixel value and the brightness value of the unit pixel; and further obtaining a brightness value to be adjusted of the target light-emitting device through the brightness difference value, and sending the brightness value to be adjusted of the target light-emitting device to the light-emitting device, so as to adjust the brightness value of the light-emitting device.
Since the screen interface of the user terminal is complex and needs to be refined, the old or the children may not be able to understand how to operate immediately (the old may not see the screen clearly because of eyesight). The brightness adjusting method of the light-emitting equipment provided by the invention has the advantages that the sliding direction is determined according to the sliding starting point and the sliding ending point by sliding on the screen of the mobile terminal, so that the sliding of the screen of the mobile phone at any position is realized; obtaining the brightness value of the unit pixel through the screen pixel value corresponding to the sliding direction; and obtaining a brightness difference value according to the sliding pixel value and the brightness value of the unit pixel, thereby realizing the rapid and continuous brightness adjustment of the light-emitting equipment according to the brightness difference value and improving the convenience of the operation of the user terminal.
On the basis of the above embodiment, the determining the sliding direction of the sliding motion according to the sliding starting point and the sliding ending point includes:
acquiring a horizontal distance between the sliding starting point and the sliding end point and a vertical distance between the sliding starting point and the sliding end point according to the sliding starting point and the sliding end point;
judging the horizontal distance and the vertical distance, and if the horizontal distance is greater than the vertical distance, judging that the sliding direction is the horizontal direction;
and if the horizontal distance is smaller than or equal to the vertical distance, judging to acquire that the sliding direction is the vertical direction.
Fig. 4 is a schematic diagram of a sliding position on a screen of a mobile terminal according to the present invention, as shown in fig. 4, a plane coordinate system is established with an upper left corner of the screen as a coordinate origin (0, 0), a horizontal direction as an x-axis, a vertical direction as a y-axis, and a coordinate of the sliding origin is a (x) (x-axis)1,y1) The coordinates of the end point of sliding are B (x)2,y2). Optionally, when the mobile terminal places the screen in a normal state, the horizontal direction is the width direction of the screen, and the vertical direction is the height direction of the screen; when the mobile terminal turns over the screen, the horizontal direction is the height direction of the screen, and the vertical direction is the width direction of the screen.
Further, according to the sliding starting point coordinate and the sliding ending point coordinate, obtaining a horizontal distance | x between the sliding starting point coordinate and the sliding ending point coordinate2-x1I, which is the absolute value of the difference between the two horizontal coordinates; obtaining the vertical distance y between the coordinates of the sliding starting point and the sliding ending point2-y1I, the absolute value of the difference between the two ordinate.
Further, if the horizontal distance is greater than the vertical distance, | x2-x1|>|y2-y1If the sliding direction is the x axis in the horizontal direction; if the horizontal distance is less than or equal to the vertical distance, | x2-x1|≤|y2-y1And the y axis in the vertical direction is taken as the sliding direction.
On the basis of the above embodiment, the determining a unit pixel brightness value according to the pixel value corresponding to the sliding direction includes:
if the sliding direction is the horizontal direction, determining the brightness value of the unit pixel according to the pixel value of the screen width corresponding to the horizontal direction;
and if the sliding direction is the vertical direction, determining the unit pixel brightness value according to the pixel value of the screen height corresponding to the vertical direction.
In one embodiment, the mobile terminal is normally placed, the upper left corner of the screen is used as a coordinate origin (0, 0), the horizontal direction is used as an x axis, the vertical direction is used as a y axis to establish a plane coordinate system, and included angles between a straight line where a sliding starting point and a sliding ending point are located and the x axis and the y axis are obtained according to the sliding starting point coordinate and the sliding ending point coordinate. If the included angle between the straight line and the x axis is larger than the included angle between the straight line and the y axis, determining the sliding direction as the vertical direction; otherwise, determining the sliding direction as the horizontal direction.
Further, if the sliding direction of the sliding motion on the screen of the mobile terminal is the x axis in the horizontal direction, the unit pixel brightness value is obtained according to the pixel value of the screen width corresponding to the horizontal direction. Specifically, if the sliding direction is the horizontal direction, the unit pixel luminance value is the pixel value of the screen width ÷ m.
And if the sliding direction of the sliding action on the screen of the mobile terminal is a vertical direction y axis, obtaining the brightness value of the unit pixel according to the pixel value of the screen height corresponding to the vertical direction. Specifically, if the sliding direction is the horizontal direction, the unit pixel luminance value is the pixel value of the screen height ÷ m. Wherein m represents the maximum value of the brightness adjusting range of the light-emitting device, and the value of the invention is 100.
On the basis of the above embodiment, determining a sliding pixel according to the sliding direction, the sliding start point, and the sliding end point, and obtaining a luminance difference value according to the sliding pixel and the unit pixel luminance value includes:
if the sliding direction is the horizontal direction, determining a first sliding pixel according to the horizontal distance between the sliding end point and the sliding start point, and acquiring a brightness difference value corresponding to the first sliding pixel according to the first sliding pixel and the unit pixel brightness value;
and if the sliding direction is the vertical direction, determining a second sliding pixel according to the vertical distance between the sliding end point and the sliding start point, and acquiring a brightness difference value corresponding to the second sliding pixel according to the second sliding pixel and the unit pixel brightness value.
In the invention, if the sliding direction of the sliding motion on the screen of the mobile terminal is the x axis in the horizontal direction, the first sliding pixel is x2-x1So that the brightness difference corresponding to the first sliding pixel is the product of the first pixel and the unit pixel brightness value. If the sliding direction of the sliding motion on the screen of the mobile terminal is a vertical y-axis, the second sliding pixel is y2-y1So that the luminance difference value corresponding to the second sliding pixel is the product of the luminance value of the second pixel and the luminance value of the unit pixel.
On the basis of the above embodiment, after the obtaining of the luminance difference value according to the sliding pixel and the unit pixel luminance value, the method further includes:
acquiring a brightness value to be adjusted of the light-emitting device according to the current brightness value of the light-emitting device and the brightness difference value;
and judging the brightness value to be adjusted of the light-emitting device, and adjusting the brightness of the light-emitting device according to the judgment result.
In the invention, the whole screen of the mobile terminal is used as an effective operation range, the sliding direction and the sliding distance are calculated according to the sliding starting point coordinate and the sliding ending point coordinate, and the brightness value of a unit pixel is calculated according to the width and the height of the screen; acquiring a brightness difference value according to the brightness values of the sliding pixel and the unit pixel; and adding the current brightness value and the brightness difference value of the light-emitting device to obtain a brightness value to be adjusted of the light-emitting device, so as to adjust the brightness of the light-emitting device according to the brightness value to be adjusted of the light-emitting device.
Furthermore, the range of the brightness value to be adjusted of the light-emitting device is judged, and the brightness value to be adjusted of the light-emitting device beyond the range is correspondingly changed according to the judgment result, so that the adjustment of the light-emitting device is more accurate.
In the invention, the user can quickly and continuously adjust the brightness of the light-emitting device in a finger sliding mode without accurately clicking a fixed position of a screen or staring at the screen for operation, so that the operation of the user is more convenient and simpler, and the user experience is effectively improved.
On the basis of the above embodiment, the determining the value to be adjusted of the luminance of the light emitting device and adjusting the luminance of the light emitting device according to the determination result includes:
judging the brightness value to be adjusted of the light-emitting device, and if the brightness value to be adjusted of the light-emitting device is judged to be larger than a first preset threshold, adjusting the current brightness value of the light-emitting device to be the first preset threshold;
if the brightness value to be adjusted of the light-emitting device is judged to be smaller than a second preset threshold value, adjusting the current brightness value of the light-emitting device to the second preset threshold value;
and if the brightness value to be adjusted of the light-emitting device is judged to be greater than or equal to the second preset threshold value and less than or equal to the first preset threshold value, adjusting the current brightness value of the light-emitting device to the brightness adjustment value of the light-emitting device.
In the invention, a first preset threshold and a second preset threshold correspond to the adjusting range of the light brightness, the first preset threshold is the maximum value of the adjusting range of the light-emitting device brightness, and the second preset threshold is the minimum value of the adjusting range of the light-emitting device brightness.
In the present invention, the first preset threshold value is 100, and the second preset threshold value is 0.
Further, adding the current brightness value and the brightness difference value of the light-emitting device to obtain a brightness value to be adjusted of the light-emitting device, judging the brightness value to be adjusted of the light-emitting device, and if the brightness value to be adjusted of the light-emitting device is greater than 100, obtaining a final brightness value to be adjusted of the light brightness of 100, adjusting the brightness of the light-emitting device to the maximum brightness; if the brightness value to be adjusted of the light-emitting device is smaller than 0, and the final brightness value to be adjusted of the light-emitting device is 0, adjusting the brightness of the light-emitting device to the lowest brightness, namely, turning off the light-emitting device; and if the brightness value to be adjusted of the light-emitting device is more than or equal to 0 and less than or equal to 100, adjusting the brightness of the light-emitting device according to the brightness value to be adjusted of the light-emitting device obtained by adding the brightness value of the light-emitting device and the brightness difference value of the lamp light.
It should be noted that the brightness adjusting method for the lighting device mentioned in the above embodiments is not only applicable to lighting devices, but also applicable to temperature adjustment by air conditioner, or sound adjustment for similar household appliances.
Fig. 5 is a schematic structural diagram of a brightness adjusting system of a light emitting device according to the present invention, and as shown in fig. 5, the brightness adjusting system of a light emitting device according to the present invention includes a slidingposition determining module 501, a slidingdirection obtaining module 502, a unit pixelbrightness determining module 503, and a brightnessdifference obtaining module 504, where the slidingposition determining module 501 obtains a sliding start point and a sliding end point of a sliding action on a screen of a mobile terminal; the slidingdirection obtaining module 502 is configured to determine a sliding direction of the sliding action according to the sliding starting point and the sliding ending point; the unit pixelbrightness determining module 503 is configured to determine a unit pixel brightness value according to a pixel value corresponding to the sliding direction; the luminancedifference obtaining module 504 is configured to determine a sliding pixel value according to the sliding direction, the sliding start point, and the sliding end point, and obtain a luminance difference value according to the sliding pixel value and the unit pixel luminance value, so as to adjust the current luminance of the light emitting device according to the luminance difference value.
The brightness adjusting system of the light-emitting equipment provided by the invention can determine the sliding direction according to the sliding starting point and the sliding ending point by sliding on the screen of the mobile terminal, thereby realizing the sliding of the screen of the mobile phone at any position; obtaining the brightness value of the unit pixel through the screen pixel value corresponding to the sliding direction; and obtaining a brightness difference value according to the sliding pixel value and the brightness value of the unit pixel, thereby realizing the rapid and continuous brightness adjustment of the light-emitting equipment according to the brightness difference value and improving the convenience of the operation of the user terminal.
On the basis of the above embodiment, the sliding direction obtaining module further includes a distance determining unit, a first judging unit and a second judging unit, where the distance determining unit is configured to obtain a horizontal distance between the sliding start point and the sliding end point and a vertical distance between the sliding start point and the sliding end point according to the sliding start point and the sliding end point; the first judging unit is used for judging the horizontal distance and the vertical distance, and if the horizontal distance is greater than the vertical distance, judging that the sliding direction is the horizontal direction; the second judging unit is used for judging that the sliding direction is the vertical direction if the horizontal distance is smaller than or equal to the vertical distance.
The system provided by the present invention is used for executing the above method embodiments, and for the specific processes and details, reference is made to the above embodiments, which are not described herein again.
Fig. 6 is a schematic structural diagram of an electronic device provided in the present invention, and as shown in fig. 6, the electronic device may include: a processor (processor)601, a communication Interface (Communications Interface)602, a memory (memory)603 and acommunication bus 604, wherein theprocessor 601, thecommunication Interface 602 and thememory 603 complete communication with each other through thecommunication bus 604. Theprocessor 601 may invoke logic instructions in thememory 603 to perform a lighting device brightness adjustment method comprising: acquiring a sliding starting point and a sliding ending point of a sliding action on a screen of the mobile terminal; determining the sliding direction of the sliding action according to the sliding starting point and the sliding ending point; determining a unit pixel brightness value according to the pixel value corresponding to the sliding direction; and determining a sliding pixel value according to the sliding direction, the sliding starting point and the sliding ending point, and acquiring a brightness difference value according to the sliding pixel value and the unit pixel brightness value so as to adjust the current brightness of the light-emitting device according to the brightness difference value.
In addition, the logic instructions in thememory 603 may be implemented in the form of software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, which when executed by a computer, enable the computer to perform the method for adjusting the brightness of a light emitting device provided by the above methods, the method comprising: acquiring a sliding starting point and a sliding ending point of a sliding action on a screen of the mobile terminal; determining the sliding direction of the sliding action according to the sliding starting point and the sliding ending point; determining a unit pixel brightness value according to the pixel value corresponding to the sliding direction; and determining a sliding pixel value according to the sliding direction, the sliding starting point and the sliding ending point, and acquiring a brightness difference value according to the sliding pixel value and the unit pixel brightness value so as to adjust the current brightness of the light-emitting device according to the brightness difference value.
In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, the computer program being implemented by a processor to perform the above-provided brightness adjustment method for a lighting apparatus, the method comprising: acquiring a sliding starting point and a sliding ending point of a sliding action on a screen of the mobile terminal; determining the sliding direction of the sliding action according to the sliding starting point and the sliding ending point; determining a unit pixel brightness value according to the pixel value corresponding to the sliding direction; and determining a sliding pixel value according to the sliding direction, the sliding starting point and the sliding ending point, and acquiring a brightness difference value according to the sliding pixel value and the unit pixel brightness value so as to adjust the current brightness of the light-emitting device according to the brightness difference value.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.