CN116887053A - Flash lamp control method and device, electronic equipment and storage medium - Google Patents

Flash lamp control method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116887053A
CN116887053A CN202310948863.0A CN202310948863A CN116887053A CN 116887053 A CN116887053 A CN 116887053A CN 202310948863 A CN202310948863 A CN 202310948863A CN 116887053 A CN116887053 A CN 116887053A
Authority
CN
China
Prior art keywords
regulation
flash lamp
flash
sample image
model
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.)
Pending
Application number
CN202310948863.0A
Other languages
Chinese (zh)
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.)
Xian Wingtech Information Technology Co Ltd
Original Assignee
Xian Wingtech Information 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 Xian Wingtech Information Technology Co Ltd filed Critical Xian Wingtech Information Technology Co Ltd
Priority to CN202310948863.0A priority Critical patent/CN116887053A/en
Publication of CN116887053A publication Critical patent/CN116887053A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene
    • H04N23/74Circuitry for compensating brightness variation in the scene by influencing the scene brightness using illuminating means
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)

Abstract

The embodiment of the application discloses a flash lamp control method and device, electronic equipment and a storage medium. The method comprises the following steps: inputting an original image into a flash lamp regulation model, and determining flash lamp regulation parameters according to image characteristics of the original image through the flash lamp regulation model; the flashlight regulation and control model is obtained through training according to a sample image set, wherein the sample image set comprises a plurality of sample images and shooting environment information corresponding to each sample image; according to the flash regulation and control parameters, the flash lamp of the camera is controlled, so that the flash lamp of the camera is automatically controlled, a user does not need to manually control the flash lamp, the user operation is simplified, the flash regulation and control parameters output by the flash training model are more accurate, and the shot image quality is improved.

Description

Flash lamp control method and device, electronic equipment and storage medium
Technical Field
The application relates to the technical field of terminals, in particular to a flash lamp control method and device, electronic equipment and a storage medium.
Background
In the traditional image shooting process, a user needs to manually control the starting of a flash lamp and manually adjust related parameters of the flash lamp, such as brightness of flash, and the like, so that the problem of complex operation exists, and sometimes the quality of a shot photo or video can be influenced due to untimely reaction or inaccurate adjustment of the user.
Disclosure of Invention
The embodiment of the application discloses a flash lamp control method and a flash lamp control device, which can automatically control a flash lamp of a camera, simplify user operation and improve the quality of photographed images.
The embodiment of the application discloses a flash lamp control method, which comprises the following steps:
inputting an original image into a flash lamp regulation model, and determining flash lamp regulation parameters according to image characteristics of the original image through the flash lamp regulation model; the flashlight regulation and control model is obtained by training according to a sample image set, wherein the sample image set comprises a plurality of sample images and shooting environment information corresponding to each sample image;
and controlling the flash lamp of the camera according to the flash lamp regulating and controlling parameters.
As an alternative embodiment, the flash regulation parameters include: one or more of a switching parameter, a brightness parameter, and a color parameter, the switching parameter being used to indicate whether the flash is on or off.
As an optional implementation manner, the controlling the flash of the camera according to the flash regulation parameter includes:
generating a pulse control signal based on the flash lamp regulation and control parameters, and sending the pulse control signal to a pulse modulation module connected with the flash lamp;
And adjusting the level and the power of the flash lamp according to the pulse control signal through the pulse modulation module so as to enable the display effect of the flash lamp to be matched with the regulation and control parameters of the flash lamp.
As an alternative embodiment, before the inputting the original image into the flash regulation model, the method further includes:
acquiring a sample image set; the sample image set comprises a plurality of sample images, shooting environment information corresponding to each sample image and target regulation and control parameters;
training a flashlight regulation model to be trained according to the sample image set, determining a predicted regulation parameter corresponding to the sample image according to the sample image and corresponding shooting environment information through the flashlight regulation model to be trained, and adjusting model parameters of the flashlight regulation model to be trained according to an error between the predicted regulation parameter and a target regulation parameter corresponding to the sample image so as to obtain the trained flashlight regulation model.
As an alternative embodiment, after the acquiring the sample image set, the method further comprises:
preprocessing the sample image to obtain a preprocessed sample image;
Extracting shooting scene characteristics of the preprocessed sample image;
training the flashlight regulation model to be trained according to the sample image set, determining the prediction regulation parameters corresponding to the sample image according to the sample image and the corresponding shooting environment information through the flashlight regulation model to be trained, including:
inputting shooting scene characteristics of the preprocessed sample image into a flash lamp regulation model to be trained, and determining prediction regulation parameters according to the shooting scene characteristics and shooting environment information corresponding to the preprocessed sample image through the flash lamp regulation model to be trained.
As an optional implementation manner, the preprocessing the sample image to obtain a preprocessed sample image includes:
adjusting the brightness of the sample image; and/or adjusting the contrast of the sample image; and/or adjusting the white balance of the sample image.
As an alternative embodiment, the method further comprises:
when detecting that a shooting scene corresponding to the camera changes, acquiring a new original image through the camera, inputting the new original image into the flash lamp regulation model, and determining a new flash lamp regulation parameter through the flash lamp regulation model according to the image characteristics of the new original image;
And controlling the flash lamp of the camera according to the new flash lamp regulating and controlling parameters.
The embodiment of the application discloses a flash lamp control device, which comprises:
the determining module is used for inputting an original image into the flash lamp regulation and control model, and determining flash lamp regulation and control parameters according to the image characteristics of the original image through the flash lamp regulation and control model; the flashlight regulation and control model is obtained by training according to a sample image set, wherein the sample image set comprises a plurality of sample images and shooting environment information corresponding to each sample image;
and the control module is used for controlling the flash lamp of the camera according to the flash lamp regulation and control parameters.
As an alternative embodiment, the flash regulation parameters include one or more of a switching parameter, a brightness parameter, a color parameter, and a flash frequency parameter, where the switching parameter is used to instruct to turn on or off the flash.
As an alternative embodiment, the apparatus further comprises:
the control module is also used for generating a pulse control signal based on the flash lamp regulation and control parameters and sending the pulse control signal to a pulse modulation module connected with the flash lamp; and adjusting the level and the power of the flash lamp according to the pulse control signal through the pulse modulation module so as to enable the display effect of the flash lamp to be matched with the regulation and control parameters of the flash lamp.
As an alternative embodiment, the apparatus further comprises:
the sample image set acquisition module is used for acquiring a sample image set; the sample image set comprises a plurality of sample images, shooting environment information corresponding to each sample image and target regulation and control parameters;
the training module is used for training the flashlight regulation model to be trained according to the sample image set, determining the prediction regulation parameters corresponding to the sample image according to the sample image and the corresponding shooting environment information through the flashlight regulation model to be trained, and adjusting the model parameters of the flashlight regulation model to be trained according to the errors between the prediction regulation parameters and the target regulation parameters corresponding to the sample image so as to obtain the flashlight regulation model after training.
As an alternative embodiment, the apparatus further comprises:
the sample image processing module is used for preprocessing the sample image to obtain a preprocessed sample image;
the extraction feature module is used for extracting shooting scene features of the preprocessed sample image;
the training module is further configured to input the shooting scene feature of the preprocessed sample image into a flash regulation model to be trained, and determine a prediction regulation parameter according to the shooting scene feature and shooting environment information corresponding to the preprocessed sample image through the flash regulation model to be trained.
As an optional implementation manner, the sample image processing module is further configured to adjust brightness of the sample image; and/or adjusting the contrast of the sample image; and/or adjusting the white balance of the sample image.
As an optional implementation manner, the determining module is further configured to, when detecting that a shooting scene corresponding to the camera changes, collect a new original image through the camera, input the new original image to the flash regulation model, and determine a new flash regulation parameter according to an image feature of the new original image through the flash regulation model;
the control module is also used for controlling the flash lamp of the camera according to the new flash lamp regulation and control parameters.
The embodiment of the application discloses an electronic device, which comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor realizes any one of the flash lamp control methods disclosed by the embodiment of the application.
The embodiment of the application discloses a computer readable storage medium which stores a computer program, wherein the computer program enables a computer to execute any one of the flash lamp control methods disclosed by the embodiment of the application.
Compared with the related art, the embodiment of the application has the following beneficial effects:
the embodiment of the application provides a flash lamp control method and a flash lamp control device, which are characterized in that an original image is input into a flash regulation model, the flash regulation model determines flash regulation parameters according to the image characteristics of the input original image, and then the flash lamp for shooting is controlled according to the flash regulation parameters; the flash training model is obtained by training according to a sample image set, wherein the sample image set comprises a plurality of sample images and shooting environment information corresponding to each sample image. The original image acquired by the camera can be analyzed by using the flash regulation and control model, the flash regulation and control parameters are output, the flash lamp of the camera is automatically controlled, a user does not need to manually control the flash lamp, the user operation is simplified, the flash regulation and control parameters output by using the flash training model are more accurate, and the shot image quality is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed 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 application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is an application scenario diagram of a flash control method disclosed in an embodiment of the present application;
FIG. 2 is a flow chart of a flash control method in one embodiment;
FIG. 3 is a flow chart of controlling a flash of a camera according to flash regulation parameters in one embodiment;
FIG. 4 is a flow chart of training a flash regulation model in one embodiment;
FIG. 5 is a block diagram of a flash control device in one embodiment;
fig. 6 is a block diagram of an electronic device in one embodiment.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be noted that the terms "comprising" and "having" and any variations thereof in the embodiments of the present application and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus.
It will be understood that the terms first, second, etc. as used herein may be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another element. For example, a first threshold may be referred to as a second threshold, and similarly, a second threshold may be referred to as a first threshold, without departing from the scope of the application. Both the first threshold and the second threshold are thresholds, but they are not the same threshold.
In the current state of the art, there have been some automatic flash control methods and systems. For example, an environment sensor is used for collecting environment information, judging whether a flash needs to be started or not based on the environment information, or judging whether the flash needs to be started or not through manual setting of a user, and controlling the brightness and the color of the flash through a preset flash mode; or, based on an image processing algorithm, such as edge detection and illumination estimation are performed on the acquired image, so as to determine whether the flash needs to be turned on. However, these methods have some drawbacks.
For example, the lack of accuracy, conventional environmental sensors cannot provide sufficiently accurate illumination information, and methods based on image processing algorithms are susceptible to noise and image variations, resulting in insufficiently accurate control of the flash. Therefore, there is a lack of accuracy in determining whether a flash needs to be turned on and adjusting the flash brightness and color.
For example, the user needs to perform complicated intervention on the flash control, and many related technologies need to manually set the flash mode or select the shooting scene, which increases the operation complexity of the user and reduces the shooting convenience. The user may not be able to accurately determine when the flash needs to be turned on, thereby affecting the quality of the pictures and videos taken.
For example, the parameters of the flash lamp are not flexible enough, such as the brightness and color are selected only by fixed options. The flash lamp control in the prior art generally only provides fixed brightness and color options, and cannot be dynamically adjusted according to different shooting scenes and illumination conditions. This may cause the image to be overexposed or dimmed in some cases, and thus may not provide an optimal photographing effect.
In summary, the prior art has the disadvantages of lack of accuracy in automatic flash control, complicated intervention of a user for flash control, inflexible parameter selection of a flash, and the like. These problems limit the convenience and flexibility of the photographing operation and the improvement of the quality of photographed and video. Therefore, a further improvement and lifting space is required for the control method of the flash.
The embodiment of the application provides a flash lamp control method and device, electronic equipment and a storage medium, which can automatically control a flash lamp of a camera, simplify user operation and improve the quality of photographed images.
Referring to fig. 1, fig. 1 is an application scenario diagram of a flash control method according to an embodiment of the present application. The application scenario may include the electronic device 100, and the electronic device 100 may include the camera 101 and the flash 102. The electronic device 100 may include, but is not limited to, a smart camera, a mobile phone, a tablet computer, a wearable device, a notebook computer, a PC (Personal Computer ), a vehicle-mounted terminal, etc., and embodiments of the present application are not limited thereto.
When the electronic device 100 executes a shooting task, an original image is acquired through the camera 101 on the electronic device 100, the original image is input into a flash regulation model in the electronic device 100, flash regulation parameters are determined through the flash regulation model according to image characteristics of the original image, the flash regulation model is obtained through training according to a sample image set, the sample image set comprises a plurality of sample images and shooting environment information corresponding to each sample image, and then the flash 102 in the camera 101 is controlled according to the flash regulation parameters.
Referring to fig. 2, fig. 2 is a flow chart of a flash lamp control method according to an embodiment of the application. The flash control method described in fig. 2 is applicable to an electronic device, and may include the following steps:
step S201, inputting the original image into a flash regulation model, and determining flash regulation parameters according to the image characteristics of the original image through the flash regulation model.
When a user performs a shooting task, that is, when the user uses a camera in the electronic device to shoot a target object, the user needs to turn on the camera of the electronic device, and at the same time, when the user needs to perform the shooting task, the user needs to turn on a flash lamp. Therefore, when the electronic equipment detects that the camera is started, the original image can be acquired through the camera, whether the flash lamp is controlled or not is judged by utilizing the original image, and specific flash lamp regulation and control parameters are determined. The flashlight regulation and control model is obtained through training according to a sample image set, wherein the sample image set comprises a plurality of sample images and shooting environment information corresponding to each sample image. The shooting environment information refers to shooting environment parameters of a shooting environment where the electronic device is located when the electronic device executes a shooting task, and the shooting environment information includes one or more of shooting illumination parameters, shooting scene type parameters, camera setting parameters and the like.
The shooting illumination parameters are parameters in which illumination intensity and illumination direction at the shooting time are recorded, and the illumination direction can be a direction opposite to the light direction or a direction opposite to the light direction, wherein the opposite to the light direction is a direction in which a camera performs shooting by a straight surface light source at the shooting time, and the direction opposite to the light source is a direction in which the camera performs shooting by facing away from the light source at the shooting time, and in addition, a side light direction, a side backlight direction and the like, a plurality of illumination directions can be defined according to different shooting scenes, and the method is not limited herein.
The shooting scene type parameters are parameters of the scene type where shooting is recorded, the shooting scene type parameters can be an indoor shooting scene, a scenery shooting scene and a portrait shooting scene, and according to the different shooting scene type parameters, the flash lamp regulation and control parameters corresponding to the shooting scene type parameters can be preset so as to achieve the purpose of automatically controlling the flash lamp according to different shooting scenes.
The camera setting parameters are parameters for recording the settings of the camera during shooting, and may be composed of shooting exposure time parameters, IOS (International Organization for Standardization, i.e. sensitivity, which is a measure of the sensitivity of the film to light) parameters, white balance parameters, and the like, so that for meeting different shooting requirements, the electronic device may set and collect different camera setting parameters, which is not limited herein.
As an embodiment, the camera of the electronic device may acquire the original image in real time or at regular time periods (e.g. every 0.1 seconds, etc.), and the original image may include a photograph and/or video of the shooting scene in which the electronic device is located.
In one embodiment, in the training process of the flash regulation model, after the sample image set is acquired, shooting scene features may be extracted from the sample image, where the shooting scene features refer to features related to shooting illumination and scene, and the shooting scene features may include one or more features of light intensity, color distribution, contrast, illumination direction and the like of the image, but are not limited thereto, and then the flash regulation model is trained according to the extracted features.
After the electronic device inputs the original image into the flash regulation model, the flash regulation model can extract image features of the original image, the image features can comprise shooting scene features, and flash regulation parameters are determined according to the image features.
Alternatively, the flash regulation parameters may include one or more of a switching parameter of the flash, a color parameter of the flash, a brightness parameter, a flash frequency parameter, and the like. The switching parameters of the flash lamp can be used for indicating whether the flash lamp is in an on or off state, and whether the flash lamp is started or not can be automatically selected according to the switching parameters; the color parameters of the flash lamp can be used for indicating the color presented by the flash lamp, for example, when the flash lamp regulation and control model determines that the current shooting scene requiring warm tone is in accordance with the image feature analysis of the original image, the color parameters of the flash lamp can be output to be warm yellow; the brightness parameter of the flash lamp is used for indicating the brightness of the flash lamp, for example, when an original image acquired by the electronic equipment shows an overexposed state, the flash lamp regulation and control model can output a smaller brightness parameter to reduce the brightness of the flash lamp; the flash frequency parameter can indicate to adjust the working frequency of the flash lamp, the higher the flash frequency of the flash lamp is, the more times the flash lamp can flash, the continuous action of the target object can be shot into the same photo by making the flash lamp flash for a plurality of times, for example, when the track of the raindrops falling in a rainy day needs to be shot, the track of the raindrops in the air can be presented by increasing the frequency of the flash lamp.
Optionally, the flash regulation parameter may further include a delay time of the flash, where the delay time of the flash refers to a duration of the flash when the flash performs the shooting task, and may be used to add a special effect in shooting or meet a specific requirement. It should be noted that, the specific flash lamp adjusting parameters may be further expanded and customized according to the actual requirements, so as to meet more shooting requirements and scenes, which is not limited by the embodiment of the present application.
As an implementation manner, the flash regulation model may include an artificial neural network algorithm (ANN, artificial Neural Networks) or a support vector machine (SVM, support Vector Machine), and the like, and the flash regulation model may optimize image features of an original image to obtain optimized image features, and classify the original image according to the optimized image features to obtain a classification result. The method comprises the steps that a plurality of categories can be preset, each category can correspond to one shooting scene, corresponding flash lamp regulation parameters can be preset for each category, the preset flash lamp regulation parameters can be ideal flash lamp regulation parameters under the shooting scene corresponding to the category, and the image effect obtained by shooting under the shooting scene corresponding to the category can be better. After the class corresponding to the original image is determined by the flash regulation model, preset flash regulation parameters corresponding to the class can be obtained and output.
Furthermore, the electronic device may further input the original image and the shooting environment information corresponding to the original image to a flash regulation model, where the flash regulation model may determine the flash adjustment parameter according to the original image and the shooting environment information corresponding to the original image.
Step S202, controlling the flash lamp of the camera according to the flash lamp regulation parameters.
After the electronic equipment obtains the flash regulation parameters output by the flash regulation model, the flash of the camera can be controlled according to the flash regulation parameters.
As a specific embodiment, whether the flash lamp needs to be turned on or not may be determined according to the switching parameter, if the flash lamp needs to be turned on, the brightness of the flash lamp may be adjusted according to the brightness parameter, the color of the flash lamp may be adjusted according to the color parameter, the flash frequency of the flash lamp may be adjusted according to the flash frequency parameter, and the like. For example, if the adjustment parameter of the flash is to turn off the flash, the adjustment of the brightness parameter, the color parameter, the flash frequency parameter, and the like of the flash is not required; if the adjustment parameter of the flash lamp is to turn on the flash lamp, the brightness parameter, the color parameter, the flash frequency parameter and the like of the flash lamp need to be further adjusted according to the flash lamp adjustment parameter.
As a specific implementation mode, when detecting that a shooting scene corresponding to a camera changes, acquiring a new original image through the camera, inputting the new original image into a flash regulation model, and determining new flash regulation parameters through the flash regulation model according to the image characteristics of the new original image; and controlling the flash lamp of the camera according to the new flash lamp regulating and controlling parameters. The camera detecting the corresponding change of the shooting scene may be represented by the change of the shooting scene where the camera is located, for example, the shooting scene is changed from an indoor scene to an outdoor scene. And taking an original image acquired by the camera after the shooting scene changes as a new original image. The electronic equipment controls the flash lamp of the camera based on the flash lamp regulation and control model according to the new original image, namely, parameters of the flash lamp can be regulated and controlled in real time according to the change of shooting scenes so as to adapt to different shooting scene requirements, and therefore the quality of the shooting image is improved.
In the embodiment of the application, the original image is acquired through the camera, the original image is input into the flash lamp regulation and control model, the flash lamp regulation and control parameters are determined through the flash lamp regulation and control model according to the characteristics of the original image, then the flash lamp of the camera is controlled according to the flash lamp regulation and control parameters output by the flash lamp regulation and control model, and therefore, the flash lamp of the camera can be automatically controlled without manually regulating and controlling the flash lamp parameters by a user, the operation of the user is simplified, and the shot image quality is improved.
Referring to fig. 3, fig. 3 is a flowchart of controlling a flash of a camera according to a flash control parameter according to an embodiment of the present application. As shown in fig. 3, the step of controlling the flash of the camera according to the flash regulation parameters may include the following steps:
step S301, a pulse control signal is generated based on the flash lamp regulation parameters, and the pulse control signal is sent to a pulse modulation module connected with the flash lamp.
The principle of the pulse modulation module is various pulse width modulation (Pulse width modulation, PWM), and the specific principle is to modulate the bias of the base electrode of a built-in transistor or the grid electrode of a Metal-Oxide-Semiconductor Field-Effect Transistor (Metal Oxide semiconductor field effect transistor) according to the change of the corresponding load of a connected power supply so as to change the conduction time of a lens or a MOS transistor, thereby realizing the switching regulated power supply with changed output. This way, the output voltage of the power supply can be kept constant when the operating conditions change, and is a very effective technique for controlling the analog circuit by means of the digital signal of the microprocessor.
As an embodiment, the pulse control signal may be a current signal or a wireless signal, which is not limited in the present application. The electronic equipment can control the on/off of the flash lamp according to the pulse control signal generated by the flash lamp regulating and controlling parameters, and adjust the color of the flash lamp, the brightness of the flash lamp and the frequency of the flash lamp.
As one implementation mode, the electronic equipment generates a pulse control signal based on the flash regulation parameters output by the flash regulation model and sends the pulse control signal to the pulse modulation module connected with the flash, and the pulse modulation module can change the power supply working period of the flash, so that the level and the power of the flash are adjusted, and the purpose of controlling the flash of the camera is achieved.
Step S302, the level and the power of the flash lamp are adjusted by the pulse modulation module according to the pulse control signal, so that the display effect of the flash lamp is matched with the regulation and control parameters of the flash lamp.
As one implementation mode, after the pulse control signal is received by the pulse modulation module, the pulse modulation module can adjust the level and the power of the flash lamp by changing the working period of the flash lamp power supply, and different flash lamp effects can be presented according to the level and the power of the flash lamp, so as to meet shooting requirements under different shooting light rays and scenes. Taking the brightness parameter of the regulated flash lamp as an example, after the pulse modulation module receives the pulse control signal, the power supply working period of the flash lamp can be shortened by controlling the bias of the base electrode of the transistor or the grid electrode of the MOS tube in the pulse modulation control module, so that the power of the flash lamp is improved, the power of the flash lamp is increased, the brightness of the flash lamp is improved, the flash lamp of the camera can be automatically controlled, the user operation is simplified, and the shooting image quality is improved.
Optionally, in the process that the display effect of the flash lamp is matched with the flash lamp regulation parameters, the flash lamp regulation parameters can be one or more parameters, and if the flash lamp regulation parameters only comprise the switch parameters, the switch parameters are in a closed state, the display effect of the flash lamp is that the flash lamp is closed; if the regulation parameters of the flash lamp are (on state, brightness value, warm tone), the display effect of the flash lamp is to turn on the flash lamp, adjust the brightness of the flash lamp to the brightness value and adjust the color of the flash lamp to the warm tone.
In the embodiment of the application, the electronic equipment generates the pulse control signal based on the regulation and control parameters of the flash lamp, and sends the pulse control signal to the pulse modulation module connected with the flash lamp, and the pulse modulation module adjusts the level and the power of the flash lamp according to the pulse control signal so as to enable the display effect of the flash lamp to be matched with the regulation and control parameters of the flash lamp, thereby realizing automatic control of the flash lamp and improving the quality of photographed pictures and videos. Meanwhile, the whole-course user does not need manual intervention in the control method of the flash lamp, so that the user can more conveniently and rapidly carry out shooting operation.
Referring to fig. 4, fig. 4 is a flowchart of training a flashlight modulation model according to an embodiment of the present application.
As shown in fig. 4, training the flash regulation model may include the steps of:
step S401, acquiring a sample image set; the sample image set comprises a plurality of sample images, shooting environment information corresponding to each sample image and target regulation and control parameters.
The sample image set is used for training a flash lamp regulation model to be trained, and comprises a plurality of sample images, shooting environment information corresponding to each sample image and target regulation parameters, each sample image can be an acquired photo or video, and the like, and the shooting environment information corresponding to each sample image can comprise one or more of shooting illumination parameters, shooting scene type parameters, camera setting parameters and the like.
As an embodiment, the sample image set may be acquired by a camera on the electronic device, or by a sensor on the electronic device, such as a light sensor, a gyroscope, or the like.
As an implementation manner, the target regulation and control parameter corresponding to the sample image may refer to an ideal flash lamp regulation and control parameter corresponding to the sample image, and after the flash lamp is regulated and controlled by using the target regulation and control parameter, a sample image with a better display effect may be obtained, and the target regulation and control parameter may be set by a user according to an actual shooting requirement.
In some embodiments, after the sample image set is acquired, the sample image may be preprocessed to obtain a preprocessed sample image, and then the flashlight regulation model to be trained is trained according to the preprocessed sample image.
As one embodiment, the step of preprocessing the sample image may include one or more of image denoising, image cropping, image rotation and flipping, image scaling, image enhancement, image color space conversion, and the like. The image denoising processing is to denoise the image, and the definition and quality of the image can be ensured to be within a preset range by removing noise in the image. The image clipping is to clip the image according to the requirement of collecting image data, remove unnecessary area or adjust the image to a preset size. The image rotation and overturn are to rotate or overturn the image according to the requirement of the collected image data, so as to adjust the direction of the image or realize specific shooting effect. Image scaling is to perform a scaling operation or an enlarging operation on an image, and the size of the image is adjusted to adapt to the output requirements of different display screens. Image enhancement is by increasing the sharpness of the image and/or applying preset image filters to enhance the details and effects of the image. Image color space conversion is the conversion of an image from one color space to another color space to enable an electronic device to better process and adjust the color of the image, such as converting the color space of the image from an RGB color space to an HSV color space.
In one embodiment, preprocessing a sample image to obtain a preprocessed sample image includes: adjusting the brightness of the sample image; and/or adjusting the contrast of the sample image; and/or adjusting the white balance of the sample image.
The adjusting of the brightness, contrast and white balance of the sample image may be adjusting the brightness of the sample image according to a preset brightness, contrast and white balance range of the sample image, and the preset brightness, contrast and white balance range of the sample image may be set according to the brightness of the sample image required by the flashlight regulation model to be trained.
Step S402, training a flashlight regulation model to be trained according to a sample image set, determining a predicted regulation parameter corresponding to a sample image according to the sample image and corresponding shooting environment information through the flashlight regulation model to be trained, and adjusting model parameters of the flashlight regulation model to be trained according to an error between the predicted regulation parameter and a target regulation parameter corresponding to the sample image so as to obtain the trained flashlight regulation model.
As an implementation manner, before training the flashlight regulation model to be trained, shooting scene characteristics of the preprocessed sample image can be extracted, then the shooting scene characteristics of the preprocessed sample image are input into the flashlight regulation model to be trained, and prediction regulation parameters are determined according to the shooting scene characteristics and shooting environment information corresponding to the preprocessed sample image through the flashlight regulation model to be trained.
The shot scene features may be features related to shot illumination and the scene and may include light intensity features, color distribution features, image contrast features, and illumination direction features. The light intensity characteristic can be used as a characteristic basis for judging whether the flash lamp needs to be started or not and adjusting the brightness of the flash lamp. The color distribution characteristics are characteristic bases for reflecting color information in the image and can be used for adjusting the color of the flash lamp to adapt to different shooting scenes. The image contrast feature reflects the difference in brightness in the image and can be used to adjust the brightness of the flash. The illumination direction characteristics can reflect the direction of the light source and can be used as characteristic basis for adjusting the flash lamp in a special shooting scene.
As an implementation manner, extracting the shooting scene features of the preprocessed sample image set is a process of converting data information in an image into corresponding image vectors, and a flash regulation model to be trained usually needs the vectors as input to achieve the purpose of training the model, so that the machine learning model can recognize and process the information in the image conveniently by converting the information in the image into the image vectors. These image vectors may contain parameters such as image color information, image texture features, and image edge information. The technician can set the image vector to contain different parameters according to the requirements of different training flash regulation models.
As an implementation manner, the feature processing is further performed on the extracted shooting scene features, which may include performing data cleaning, outlier removal and normalization processing on the shooting scene features, where the data cleaning and outlier removal may remove interference information in the shooting scene features, so as to ensure effectiveness and consistency of the shooting scene features; the normalization processing is to reduce or enlarge shooting scene characteristics to a unified preset range, so that different shooting scene characteristics have the same dimension, and the problem that a predicted regulation and control parameter and an actual flash regulation and control parameter have larger errors due to the fact that the value of the shooting scene characteristic of a flash regulation and control model to be trained has a difference in size in the training process is avoided.
As an embodiment, the shooting scene feature after feature processing and shooting environment information corresponding to the sample image after preprocessing may be combined with the corresponding tag to form a sample data set.
As an embodiment, the sample image may be classified according to the feature of the shooting scene after feature processing and the shooting environment information corresponding to the sample image after preprocessing, and the corresponding class label may be determined, so as to form a sample data set. A plurality of categories can be preset, each category can correspond to one shooting scene, corresponding flash lamp regulation and control parameters can be preset for each category, and target regulation and control parameters corresponding to the sample image are preset flash lamp regulation and control parameters corresponding to the sample image.
The classification of the sample images can be performed according to the actual flash debugging condition and the requirements of the user on using the flash, for example, the shooting scene corresponding to the type A is a scene with a light direction, an indoor scene and an illumination color being cool white, the type label corresponding to the type A is A, and the preset flash regulation parameters corresponding to the type A are (on state, brightness value and warm tone). The shooting scene characteristics of the sample image and the corresponding shooting environment information may be combined with the corresponding category labels.
The feature of the shooting scene after feature processing and shooting environment information corresponding to the sample image after preprocessing are combined with the corresponding labels, so that the flashlight regulation model to be trained can be subjected to supervised training.
The supervised training of the flash regulation model may be to obtain the flash regulation model by training using a sample image set input to the flash regulation model to be trained, where the flash regulation model may output flash regulation parameters according to the input original image, and the flash regulation parameters are predicted target parameters.
As one embodiment, the predictive control parameters may be determined from the sample dataset by a flash control model to be trained. The flashlight regulation model to be trained can be established based on a machine learning algorithm such as a support vector machine and an artificial neural network algorithm, the flashlight regulation model to be trained can firstly optimize the values of a plurality of parameters in a sample data set by using the built-in artificial neural network algorithm to obtain optimized output values, and the optimized output values can be one or more, so that the limitation is not set. Based on the optimized shooting scene characteristics obtained by the artificial neural network, classifying the optimized shooting scene characteristics through a support vector machine, determining a preset flash lamp prediction regulation parameter of a class corresponding to the shooting scene characteristics as a prediction regulation parameter, comparing the prediction regulation parameter with a target regulation parameter corresponding to the shooting scene characteristics, calculating errors of the prediction regulation parameter and the target regulation parameter, and finishing training if the errors are within a preset range. The trained flashlight regulation and control model selects corresponding flashlight regulation and control parameters to output according to the classification result of the sample data, and the electronic equipment generates pulse control signals according to the flashlight regulation and control parameters so as to realize automatic control of the flashlight.
In the embodiment of the application, the collected sample image is preprocessed, the preprocessed sample image is subjected to feature extraction, the shooting scene feature after feature processing and the shooting environment information corresponding to the preprocessed sample image are combined with the corresponding label to form a sample data set, and the flash lamp regulation model to be trained is trained, so that the flash lamp regulation model capable of outputting accurate flash lamp regulation parameters according to the shooting scene is obtained, automatic control of the flash lamp is realized, and the quality of the shot photo and video is improved.
As shown in fig. 5, in one embodiment, a flash control apparatus 500 is provided, which is applicable to the above-mentioned electronic device. The flash control apparatus 500 may include a determination module 501 and a control module 502.
The determining module 501 is configured to input an original image to a flash regulation model, and determine flash regulation parameters according to image features of the original image through the flash regulation model; the flashlight regulation and control model is obtained through training according to a sample image set, wherein the sample image set comprises a plurality of sample images and shooting environment information corresponding to each sample image.
The control module 502 is configured to control a flash of the camera according to the flash regulation parameter.
As an alternative embodiment, the flash regulation parameters include one or more of a switching parameter, a brightness parameter, a color parameter, and a flash frequency parameter, where the switching parameter is used to instruct to turn on or off the flash.
As an alternative embodiment, the apparatus further comprises:
the control module 502 is further configured to generate a pulse control signal based on the flash lamp regulation parameter, and send the pulse control signal to a pulse modulation module connected to the flash lamp; the level and the power of the flash lamp are adjusted through the pulse modulation module according to the pulse control signal, so that the display effect of the flash lamp is matched with the regulation and control parameters of the flash lamp.
As an alternative embodiment, the apparatus further comprises:
the sample image set acquisition module is used for acquiring a sample image set; the sample image set comprises a plurality of sample images, shooting environment information corresponding to each sample image and target regulation and control parameters;
the training module is used for training the flashlight regulation model to be trained according to the sample image set, determining the prediction regulation parameters corresponding to the sample image according to the sample image and the corresponding shooting environment information through the flashlight regulation model to be trained, and adjusting the model parameters of the flashlight regulation model to be trained according to the errors between the prediction regulation parameters and the target regulation parameters corresponding to the sample image so as to obtain the flashlight regulation model after training.
As an alternative embodiment, the apparatus further comprises:
the sample image processing module is used for preprocessing the sample image to obtain a preprocessed sample image;
the extraction feature module is used for extracting shooting scene features of the preprocessed sample image;
the training module is further configured to input the shooting scene feature of the preprocessed sample image into a flash regulation model to be trained, and determine a prediction regulation parameter according to the shooting scene feature and shooting environment information corresponding to the preprocessed sample image through the flash regulation model to be trained.
As an optional implementation manner, the sample image processing module is further configured to adjust brightness of the sample image; and/or adjusting the contrast of the sample image; and/or adjusting the white balance of the sample image.
As an optional implementation manner, the determining module 501 is further configured to, when detecting that a shooting scene corresponding to the camera changes, collect a new original image through the camera, input the new original image to the flash regulation model, and determine a new flash regulation parameter according to an image feature of the new original image through the flash regulation model;
The control module 502 is further configured to control a flash of the camera according to the new flash regulation parameter.
In the embodiment of the application, the original image is acquired through the camera, the original image is input into the flash lamp regulation and control model, the regulation and control parameters of the flash lamp are determined according to the image characteristics of the original image through the flash lamp regulation and control model, and the automatic control of the flash lamp is realized according to the flash lamp regulation and control parameters, and meanwhile, the quality of photographed pictures and videos is improved.
Fig. 6 is a block diagram of an electronic device in one embodiment. The electronic device may be a mobile communication device, a notebook computer, a camera, etc. As shown in fig. 6, the electronic device 600 may include one or more of the following components: the system comprises a processor 601, a memory 602 connected to the processor 601, and an image capturing module 603, wherein the memory 602 may store one or more computer programs that may be configured to be executed by the one or more processors 601 such that the one or more processors 501 perform the methods as described in the embodiments above.
Processor 601 may include one or more processing cores. The processor 610 utilizes various interfaces and lines to connect various portions of the overall electronic device 600, perform various functions of the electronic device 600, and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 602, and invoking data stored in the memory 602. Alternatively, the processor 601 may be implemented in hardware in at least one of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA). The processor 710 may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for being responsible for rendering and drawing of display content; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 601 and may be implemented solely by a single communication chip.
The Memory 602 may include random access Memory (Random Access Memory, RAM) or Read-Only Memory (rom). Memory 602 may be used to store instructions, programs, code, a set of codes, or a set of instructions. The memory 602 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (e.g., a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described above, and the like. The storage data area may also store data created by the electronic device 600 in use, and the like.
The camera module 603 may include a camera and a flash. The processor 601 runs a flash control model, and the processor 601 inputs an original image acquired by the camera into the flash control model and outputs flash regulation parameters by using the flash control model, so that regulation of the flash is realized, and the flash regulation parameters can comprise a switching parameter, a brightness parameter, a color parameter, a frequency parameter and the like of the flash.
It will be appreciated that the electronic device 600 may include more or fewer structural elements than those described in the above structural block diagrams, including, for example, a power source, input keys, a camera, a speaker, a screen, an RF (Radio Frequency) circuit, a Wi-Fi (Wireless Fidelity) module, a bluetooth module, a sensor, etc., and may not be limited herein.
The embodiments of the present application disclose a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method as described in the above embodiments.
Embodiments of the present application disclose a computer program product comprising a non-transitory computer readable storage medium storing a computer program, which when executed by a processor, implements a method as described in the above embodiments.
Those skilled in the art will appreciate that all or part of the processes in the methods of the above embodiments may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a non-volatile computer readable storage medium, and where the program, when executed, may include processes in the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), or the like.
Any reference to memory, storage, database, or other medium as used herein may include non-volatile and/or volatile memory. Suitable nonvolatile memory can include ROM, programmable ROM (PROM), erasable PROM (EPROM), electrically Erasable PROM (Electrically Erasable PROM, EEPROM), or flash memory. Volatile memory can include random access memory (random access memory, RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (Dynamic Random Access Memory, DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDR SDRAM), enhanced SDRAM (Enhanced Synchronous DRAM, ESDRAM), synchronous Link DRAM (SLDRAM), memory bus Direct RAM (Rambus DRAM), and Direct memory bus dynamic RAM (DRDRAM).
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. Those skilled in the art will also appreciate that the embodiments described in the specification are alternative embodiments and that the acts and modules referred to are not necessarily required for the present application.
In various embodiments of the present application, it should be understood that the sequence numbers of the foregoing processes do not imply that the execution sequences of the processes should be determined by the functions and internal logic of the processes, and should not be construed as limiting the implementation of the embodiments of the present application.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units described above, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present application, or a part contributing to the prior art or all or part of the technical solution, may be embodied in the form of a software product stored in a memory, comprising several requests for a computer device (which may be a personal computer, a server or a network device, etc., in particular may be a processor in a computer device) to execute some or all of the steps of the above-mentioned method of the various embodiments of the present application.
The above describes in detail a method and apparatus for controlling a flash lamp, an electronic device, and a storage medium according to embodiments of the present application, and specific examples are applied to illustrate principles and implementations of the present application, where the foregoing examples are only used to help understand the method and core idea of the present application. Meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. A method of flash control, the method comprising:
inputting an original image into a flash lamp regulation model, and determining flash lamp regulation parameters according to image characteristics of the original image through the flash lamp regulation model; the flashlight regulation and control model is obtained by training according to a sample image set, wherein the sample image set comprises a plurality of sample images and shooting environment information corresponding to each sample image;
and controlling the flash lamp of the camera according to the flash lamp regulating and controlling parameters.
2. The method of claim 1, wherein the flash regulation parameters include one or more of a switching parameter, a brightness parameter, a color parameter, and a flash frequency parameter, the switching parameter being used to indicate whether the flash is on or off.
3. The method of claim 1, wherein controlling the flash of the camera according to the flash regulation parameter comprises:
generating a pulse control signal based on the flash lamp regulation and control parameters, and sending the pulse control signal to a pulse modulation module connected with the flash lamp;
and adjusting the level and the power of the flash lamp according to the pulse control signal through the pulse modulation module so as to enable the display effect of the flash lamp to be matched with the regulation and control parameters of the flash lamp.
4. The method of claim 1, wherein prior to said inputting the original image into the flash regulation model, the method further comprises:
acquiring a sample image set; the sample image set comprises a plurality of sample images, shooting environment information corresponding to each sample image and target regulation and control parameters;
training a flashlight regulation model to be trained according to the sample image set, determining a predicted regulation parameter corresponding to the sample image according to the sample image and corresponding shooting environment information through the flashlight regulation model to be trained, and adjusting model parameters of the flashlight regulation model to be trained according to an error between the predicted regulation parameter and a target regulation parameter corresponding to the sample image so as to obtain the trained flashlight regulation model.
5. The method of claim 4, wherein after the acquiring the sample image set, the method further comprises:
preprocessing the sample image to obtain a preprocessed sample image;
extracting shooting scene characteristics of the preprocessed sample image;
training the flashlight regulation model to be trained according to the sample image set, determining the prediction regulation parameters corresponding to the sample image according to the sample image and the corresponding shooting environment information through the flashlight regulation model to be trained, including:
Inputting shooting scene characteristics of the preprocessed sample image into a flash lamp regulation model to be trained, and determining prediction regulation parameters according to the shooting scene characteristics and shooting environment information corresponding to the preprocessed sample image through the flash lamp regulation model to be trained.
6. The method of claim 1, wherein the preprocessing the sample image to obtain a preprocessed sample image comprises:
adjusting the brightness of the sample image; and/or adjusting the contrast of the sample image; and/or adjusting the white balance of the sample image.
7. The method according to any one of claims 1 to 6, further comprising:
when detecting that a shooting scene corresponding to the camera changes, acquiring a new original image through the camera, inputting the new original image into the flash lamp regulation model, and determining a new flash lamp regulation parameter through the flash lamp regulation model according to the image characteristics of the new original image;
and controlling the flash lamp of the camera according to the new flash lamp regulating and controlling parameters.
8. A flash control apparatus, comprising:
the determining module is used for inputting an original image into the flash lamp regulation and control model, and determining flash lamp regulation and control parameters according to the image characteristics of the original image through the flash lamp regulation and control model; the flashlight regulation and control model is obtained by training according to a sample image set, wherein the sample image set comprises a plurality of sample images and shooting environment information corresponding to each sample image;
and the control module is used for controlling the flash lamp of the camera according to the flash lamp regulation and control parameters.
9. An electronic device comprising a memory and a processor, the memory having stored therein a computer program which, when executed by the processor, causes the processor to implement the method of any of claims 1 to 7.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method according to any of claims 1 to 7.
CN202310948863.0A 2023-07-31 2023-07-31 Flash lamp control method and device, electronic equipment and storage medium Pending CN116887053A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310948863.0A CN116887053A (en) 2023-07-31 2023-07-31 Flash lamp control method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310948863.0A CN116887053A (en) 2023-07-31 2023-07-31 Flash lamp control method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116887053A true CN116887053A (en) 2023-10-13

Family

ID=88271396

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310948863.0A Pending CN116887053A (en) 2023-07-31 2023-07-31 Flash lamp control method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116887053A (en)

Similar Documents

Publication Publication Date Title
US11006046B2 (en) Image processing method and mobile terminal
CN108322646B (en) Image processing method, image processing device, storage medium and electronic equipment
US9843730B2 (en) Scene motion correction in fused image systems
CN109547701B (en) Image shooting method and device, storage medium and electronic equipment
US20200068121A1 (en) Imaging Processing Method and Apparatus for Camera Module in Night Scene, Electronic Device and Storage Medium
CN108197546B (en) Illumination processing method and device in face recognition, computer equipment and storage medium
JP4759095B2 (en) Face tracking in camera processors
US20160071289A1 (en) Image composition device, image composition method, and recording medium
US9838616B2 (en) Image processing method and electronic apparatus
EP3602401A1 (en) Digital image auto exposure adjustment
US10375317B2 (en) Low complexity auto-exposure control for computer vision and imaging systems
JP2008526149A (en) Digital imaging exposure
CN110881108B (en) Image processing method and image processing apparatus
CN107105172B (en) Focusing method and device
WO2023030139A1 (en) Image fusion method, electronic device, and storage medium
CN106791451B (en) Photographing method of intelligent terminal
US20190394379A1 (en) Auto exposure control predictive convergence
Yang et al. Personalized exposure control using adaptive metering and reinforcement learning
CN113411498A (en) Image shooting method, mobile terminal and storage medium
KR20210077579A (en) Electronic device and operating method for generating high dynamic range image
CN110933304B (en) Method and device for determining to-be-blurred region, storage medium and terminal equipment
CN113422908B (en) Data processing method and device
CN116887053A (en) Flash lamp control method and device, electronic equipment and storage medium
CN110766631A (en) Face image modification method and device, electronic equipment and computer readable medium
CN115037883A (en) Exposure parameter adjusting method and device, storage medium 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