Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the art described above. Therefore, a first objective of the present invention is to provide a method for adjusting a contrast of a projector, which obtains ambient brightness and a contrast of a projection image to correct a contrast parameter of the projector, so that the contrast of the projection image is correct, and the experience of a user is enhanced.
A second object of the present invention is to provide a system for adjusting the contrast of a projector.
In order to achieve the above object, an embodiment of a first aspect of the present invention provides a method for adjusting contrast of a projector, including:
acquiring the brightness value of the environment around the projector;
shooting a first projection image projected by the projector, acquiring the definition of the first projection image, and performing definition enhancement processing on the first projection image to obtain a second projection image and acquire the contrast of the second projection image when the definition is determined to be smaller than the preset definition;
acquiring a contrast parameter of the projector during projection;
and adjusting the contrast parameter according to the brightness value of the environment around the projector and the contrast of the second projection image.
Further, the acquiring the brightness value of the environment around the projector includes:
acquiring the area of the camera, and performing area division processing on the area to obtain a first area and a second area;
acquiring a brightness signal of the first area, and acquiring a first brightness value according to the brightness signal; the brightness signal is obtained by a brightness sensor which is arranged in the first area in advance;
shooting a second area image, acquiring a second brightness value of each pixel point in the second area image, respectively calculating the brightness difference value of each pixel point and adjacent pixel points thereof, and screening out the pixel points with the brightness difference value within a preset brightness difference value range as effective pixel points; screening out pixel points of which the brightness difference values are not within a preset brightness difference value range as edge pixel points; the adjacent pixel point is any pixel point within a preset distance;
inquiring a preset brightness difference value-second brightness value correction coefficient table according to the brightness difference value of the edge pixel point to obtain a brightness correction coefficient corresponding to the brightness difference value, correcting the second brightness value of the corresponding edge pixel point according to the brightness correction coefficient, and generating an image to be processed according to the corrected edge pixel point and the effective pixel point;
performing image segmentation processing on the image to be processed to obtain a plurality of sub-images to be processed, and setting brightness weight coefficients for the plurality of sub-images to be processed; the brightness weight coefficient is set according to the number of the segmented sub-images to be processed;
respectively obtaining the average brightness value of each sub-image to be processed, and carrying out weighted summation processing on the average brightness value of each sub-image to be processed based on the set brightness weight coefficient to obtain a third brightness value;
sorting the average brightness values of the sub-images to be processed, screening out a maximum average brightness value and a minimum average brightness value, calculating a ratio of the maximum average brightness value to the minimum average brightness value, and multiplying the ratio by the third brightness value to obtain a fourth brightness value;
and inputting the first brightness value and the fourth brightness value into a pre-trained environment brightness value acquisition model, and outputting the brightness value of the environment around the projector.
Further, the shooting a first projection image of the projector to obtain a definition of the first projection image, and performing definition enhancement processing on the first projection image to obtain a second projection image when it is determined that the definition is smaller than a preset definition, and obtaining a contrast of the second projection image includes:
performing discrete Fourier transform on the first projection image to obtain a Fourier amplitude map of the first projection image, obtaining a Fourier spectrum according to the Fourier amplitude map, and performing feature extraction on the Fourier spectrum to obtain a high-frequency region and a low-frequency region of the Fourier spectrum;
extracting the characteristics of the high-frequency region, and extracting the peak value of the high-frequency region;
extracting the characteristics of the low-frequency area, and extracting the average value of the low-frequency area;
calculating a difference value between the peak value and the mean value, inquiring a preset difference value-definition table according to the difference value to obtain definition corresponding to the difference value, judging whether the definition is smaller than preset definition, and performing definition enhancement processing on the first projection image to obtain a second projection image when the definition is determined to be smaller than the preset definition;
converting each pixel point in the second projection image from a primary color space to a color-brightness separation color space, and then obtaining the brightness component of each pixel point in the second projection image;
performing convolution operation on the brightness component of each pixel point and a preset horizontal gradient operator to obtain the horizontal gradient of each pixel point, and performing square operation on the horizontal gradient of each pixel point to obtain the square value of the horizontal gradient of each pixel point;
performing convolution operation on the brightness component of each pixel point and a preset vertical gradient operator to obtain the vertical gradient of each pixel point, and performing square operation on the vertical gradient of each pixel point to obtain the square value of the vertical gradient of each pixel point;
adding the horizontal gradient square value and the vertical gradient square value of each pixel point to obtain the contrast component of each pixel point, and calculating according to the contrast component of each pixel point to obtain an average contrast component;
and comparing the contrast component of each pixel with the average contrast component, screening out the pixels with the contrast components larger than the average contrast component as target pixels, and summing the contrast components of the target pixels to obtain the contrast of the second projection image.
Further, the adjusting the contrast parameter according to the brightness value of the environment around the projector and the contrast of the second projection image includes:
and inquiring a preset data table according to the brightness value of the surrounding environment of the projector and the contrast of the second projected image to obtain a corresponding contrast adjusting coefficient, and adjusting the contrast parameter according to the contrast adjusting coefficient.
Further, before obtaining the first luminance value according to the luminance signal, the method further includes:
and calculating the signal-to-noise ratio of the brightness signal, judging whether the signal-to-noise ratio is smaller than a preset signal-to-noise ratio, and performing noise reduction processing on the brightness signal when the signal-to-noise ratio is determined to be smaller than the preset signal-to-noise ratio.
Further, the calculating the signal-to-noise ratio of the luminance signal includes:
performing framing processing on the brightness signal to obtain N frames of sub-brightness signals;
calculating the noise intensity Q of the brightness signal1As shown in equation (1):
wherein, W
1The power coefficient of an effective signal in the brightness signal; k is an error coefficient of the brightness signal in the acquisition process; n is the frame number of the sub-brightness signal; c
iThe amplitude of the sub-brightness signal of the ith frame;
is N frame sub-luminanceThe average amplitude of the signal;
according to the noise intensity Q of the brightness signal1And calculating the signal-to-noise ratio gamma of the brightness signal as shown in formula (2):
wherein Q is2The intensity of the effective signal in the brightness signal; eiIs the energy of the ith frame sub-luminance signal; eJIs preset standard energy; e is a natural constant; w2Is the power coefficient of the noise in the luminance signal.
In order to achieve the above object, a second embodiment of the present invention provides a system for adjusting contrast of a projector, including:
the environment brightness value acquisition module is used for acquiring the brightness value of the environment around the projector;
the image contrast acquisition module is used for shooting a first projection image of the projector, acquiring the definition of the first projection image, and performing definition enhancement processing on the first projection image to obtain a second projection image and acquire the contrast of the second projection image when the definition is determined to be smaller than the preset definition;
the projector contrast parameter acquisition module is used for acquiring the contrast parameter of the projector during projection;
and the first control module is used for adjusting the contrast parameter according to the brightness value of the surrounding environment of the projector and the contrast of the second projection image.
Further, the environment brightness value obtaining module includes:
the area division module is used for acquiring the area where the camera is located and carrying out area division processing on the area where the camera is located to obtain a first area and a second area;
the first brightness value acquisition module is used for acquiring a brightness signal of the first area and acquiring a first brightness value according to the brightness signal; the brightness signal is obtained by a brightness sensor which is arranged in the first area in advance;
a second control module to:
shooting a second area image, acquiring a second brightness value of each pixel point in the second area image, calculating a brightness difference value of the second brightness value of each pixel point and the second brightness value of an adjacent pixel point, and screening out the pixel points with the brightness difference value within a preset brightness difference value range to serve as effective pixel points; screening out pixel points of which the brightness difference values are not within a preset brightness difference value range as edge pixel points; the adjacent pixel point is any pixel point within a preset distance;
inquiring a preset brightness difference value-second brightness value correction coefficient table according to the brightness difference value of the edge pixel point to obtain a brightness correction coefficient corresponding to the brightness difference value, respectively correcting the second brightness value of the corresponding edge pixel point according to the brightness correction coefficient, and generating an image to be processed according to the corrected edge pixel point and the effective pixel point;
performing image segmentation processing on the image to be processed to obtain a plurality of sub-images to be processed, and setting brightness weight coefficients for the plurality of sub-images to be processed; the brightness weight coefficient is set according to the number of the segmented sub-images to be processed;
respectively obtaining the average brightness value of each sub-image to be processed, and carrying out weighted summation processing on the average brightness value of each sub-image to be processed based on the set brightness weight coefficient to obtain a third brightness value;
sorting the average brightness values of the sub-images to be processed, screening out a maximum average brightness value and a minimum average brightness value, calculating a ratio of the maximum average brightness value to the minimum average brightness value, and multiplying the ratio by the third brightness value to obtain a fourth brightness value;
and inputting the first brightness value and the fourth brightness value into a pre-trained environment brightness value acquisition model, and outputting an environment brightness value.
Further, the image contrast acquisition module comprises:
a sharpness enhancement module to:
performing discrete Fourier transform on the first projection image to obtain a Fourier amplitude map of the first projection image, obtaining a Fourier spectrum according to the Fourier amplitude map, and performing feature extraction on the Fourier spectrum to obtain a high-frequency region and a low-frequency region of the Fourier spectrum;
extracting the characteristics of the high-frequency region, and extracting the peak value of the high-frequency region;
extracting the characteristics of the low-frequency area, and extracting the average value of the low-frequency area;
calculating a difference value between the peak value and the mean value, inquiring a preset difference value-definition table according to the difference value to obtain definition corresponding to the difference value, judging whether the definition is smaller than preset definition, and performing definition enhancement processing on the first projection image to obtain a second projection image when the definition is determined to be smaller than the preset definition;
a calculation module to:
converting each pixel point in the second projection image from a primary color space to a color-brightness separation color space, and then obtaining the brightness component of each pixel point in the second projection image;
performing convolution operation on the brightness component of each pixel point and a preset horizontal gradient operator to obtain the horizontal gradient of each pixel point, and performing square operation on the horizontal gradient of each pixel point to obtain the square value of the horizontal gradient of each pixel point;
performing convolution operation on the brightness component of each pixel point and a preset vertical gradient operator to obtain the vertical gradient of each pixel point, and performing square operation on the vertical gradient of each pixel point to obtain the square value of the vertical gradient of each pixel point;
adding the horizontal gradient square value and the vertical gradient square value of each pixel point to obtain the contrast component of each pixel point, and calculating according to the contrast component of each pixel point to obtain an average contrast component;
and comparing the contrast component of each pixel with the average contrast component, screening out the pixels with the contrast components larger than the average contrast component as target pixels, and summing the contrast components of the target pixels to obtain the contrast of the second projection image.
Further, the system for adjusting the contrast of the projector further comprises:
and the noise reduction module is used for calculating the signal-to-noise ratio of the brightness signal before the first brightness value acquisition module obtains the first brightness value according to the brightness signal, judging whether the signal-to-noise ratio is smaller than a preset signal-to-noise ratio or not, and performing noise reduction processing on the brightness signal when the signal-to-noise ratio is determined to be smaller than the preset signal-to-noise ratio.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and drawings.
Detailed Description
The preferred embodiments of the present invention will be described in conjunction with the accompanying drawings, and it will be understood that they are described herein for the purpose of illustration and explanation and not limitation.
A method and a system for adjusting the contrast of a projector according to an embodiment of the present invention are described with reference to fig. 1 to 3.
As shown in fig. 1, a method of adjusting the contrast of a projector includes:
s1: acquiring the brightness value of the environment around the projector;
s2: shooting a first projection image projected by the projector, acquiring the definition of the first projection image, and performing definition enhancement processing on the first projection image to obtain a second projection image and acquire the contrast of the second projection image when the definition is determined to be smaller than the preset definition;
s3: acquiring a contrast parameter of the projector during projection;
s4: and adjusting the contrast parameter according to the brightness value of the environment around the projector and the contrast of the second projection image.
The working principle of the scheme is as follows: acquiring the brightness value of the environment around the projector; shooting a first projection image projected by the projector, acquiring the definition of the first projection image, and performing definition enhancement processing on the first projection image to obtain a second projection image and acquire the contrast of the second projection image when the definition is determined to be smaller than the preset definition; acquiring a contrast parameter of the projector during projection; and adjusting the contrast parameter according to the brightness value of the environment around the projector and the contrast of the second projection image.
The beneficial effect of above-mentioned scheme: the contrast of the projected image can change along with the change of the ambient brightness, if the ambient brightness changes, the contrast parameter of the projector is not adjusted timely, so that the personnel can not see the projected image clearly, the practicability of the projector is extremely poor, the contrast through the ambient brightness and the projected image is right, the contrast parameter of the projector is adjusted in real time, the contrast of the projected image is ensured to be just right, the experience of the viewers is increased, the practicability of the device is increased, and the experience of the user is improved.
According to some embodiments of the invention, the obtaining the brightness value of the environment around the projector comprises:
acquiring the area of the camera, and performing area division processing on the area to obtain a first area and a second area;
acquiring a brightness signal of the first area, and acquiring a first brightness value according to the brightness signal; the brightness signal is obtained by a brightness sensor which is arranged in the first area in advance;
shooting a second area image, acquiring a second brightness value of each pixel point in the second area image, respectively calculating the brightness difference value of each pixel point and adjacent pixel points thereof, and screening out the pixel points with the brightness difference value within a preset brightness difference value range as effective pixel points; screening out pixel points of which the brightness difference values are not within a preset brightness difference value range as edge pixel points; the adjacent pixel point is any pixel point within a preset distance;
inquiring a preset brightness difference value-second brightness value correction coefficient table according to the brightness difference value of the edge pixel point to obtain a brightness correction coefficient corresponding to the brightness difference value, correcting the second brightness value of the corresponding edge pixel point according to the brightness correction coefficient, and generating an image to be processed according to the corrected edge pixel point and the effective pixel point;
performing image segmentation processing on the image to be processed to obtain a plurality of sub-images to be processed, and setting brightness weight coefficients for the plurality of sub-images to be processed; the brightness weight coefficient is set according to the number of the segmented sub-images to be processed;
respectively obtaining the average brightness value of each sub-image to be processed, and carrying out weighted summation processing on the average brightness value of each sub-image to be processed based on the set brightness weight coefficient to obtain a third brightness value;
sorting the average brightness values of the sub-images to be processed, screening out a maximum average brightness value and a minimum average brightness value, calculating a ratio of the maximum average brightness value to the minimum average brightness value, and multiplying the ratio by the third brightness value to obtain a fourth brightness value;
and inputting the first brightness value and the fourth brightness value into a pre-trained environment brightness value acquisition model, and outputting the brightness value of the environment around the projector.
The working principle of the scheme is as follows: acquiring the area of the camera, and performing area division processing on the area to obtain a first area and a second area; the first area and the second area are both key positions of the area where the camera is located; acquiring a brightness signal of the first area, and acquiring a first brightness value according to the brightness signal; the brightness signal is obtained by a brightness sensor which is arranged in the first area in advance; shooting a second area image, acquiring a second brightness value of each pixel point in the second area image, respectively calculating the brightness difference value of each pixel point and adjacent pixel points thereof, and screening out the pixel points with the brightness difference value within a preset brightness difference value range as effective pixel points; screening out pixel points of which the brightness difference values are not within a preset brightness difference value range as edge pixel points; the adjacent pixel point is any pixel point within a preset distance; inquiring a preset brightness difference value-second brightness value correction coefficient table according to the brightness difference value of the edge pixel point to obtain a brightness correction coefficient corresponding to the brightness difference value, correcting the second brightness value of the corresponding edge pixel point according to the brightness correction coefficient, and generating an image to be processed according to the corrected edge pixel point and the effective pixel point; performing image segmentation processing on the image to be processed to obtain a plurality of sub-images to be processed, and setting brightness weight coefficients for the plurality of sub-images to be processed; the brightness weight coefficient is set according to the number of the segmented sub-images to be processed; respectively obtaining the average brightness value of each sub-image to be processed, and carrying out weighted summation processing on the average brightness value of each sub-image to be processed based on the set brightness weight coefficient to obtain a third brightness value; sorting the average brightness values of the sub-images to be processed, screening out a maximum average brightness value and a minimum average brightness value, calculating a ratio of the maximum average brightness value to the minimum average brightness value, and multiplying the ratio by the third brightness value to obtain a fourth brightness value; and inputting the first brightness value and the fourth brightness value into a pre-trained environment brightness value acquisition model, and outputting the brightness value of the environment around the projector.
The beneficial effect of above-mentioned scheme: the brightness of the environment of the camera has a great influence on adjusting the contrast parameter of the camera, so that the accurate measurement of the brightness of the environment around the camera is very necessary, and the scheme provides a method for accurately measuring the brightness of the environment around the camera; acquiring the area of the camera, and performing area division processing on the area to obtain a first area and a second area; in some special cases, the brightness of the environment around the camera may have a huge difference, and the area division processing is performed on the area where the camera is located, so that the final detection result is more accurate; acquiring a brightness signal of the first area, and acquiring a first brightness value according to the brightness signal; the brightness signal is obtained by a brightness sensor which is arranged in the first area in advance; shooting a second area image, acquiring a second brightness value of each pixel point in the second area image, respectively calculating the brightness difference value of each pixel point and adjacent pixel points thereof, and screening out the pixel points with the brightness difference value within a preset brightness difference value range as effective pixel points; screening out pixel points of which the brightness difference values are not within a preset brightness difference value range as edge pixel points; the adjacent pixel point is any pixel point within a preset distance; inquiring a preset brightness difference value-second brightness value correction coefficient table according to the brightness difference value of the edge pixel point to obtain a brightness correction coefficient corresponding to the brightness difference value, correcting the second brightness value of the corresponding edge pixel point according to the brightness correction coefficient, and generating an image to be processed according to the corrected edge pixel point and the effective pixel point; the image to be processed is a second area image subjected to noise reduction, and the second brightness value of the edge pixel point is corrected, so that the image to be processed is clearer, and the noise in the second area image is reduced; performing image segmentation processing on the image to be processed to obtain a plurality of sub-images to be processed, and setting brightness weight coefficients for the plurality of sub-images to be processed; the brightness weight coefficient is set according to the number of the segmented sub-images to be processed; respectively obtaining the average brightness value of each sub-image to be processed, and carrying out weighted summation processing on the average brightness value of each sub-image to be processed based on the set brightness weight coefficient to obtain a third brightness value; sorting the average brightness values of the sub-images to be processed, screening out a maximum average brightness value and a minimum average brightness value, calculating a ratio of the maximum average brightness value to the minimum average brightness value, and multiplying the ratio by the third brightness value to obtain a fourth brightness value; and inputting the first brightness value and the fourth brightness value into a pre-trained environment brightness value acquisition model, and outputting the brightness value of the environment around the projector, so that the finally obtained brightness value of the environment around the projector is more accurate, and the accuracy of finally adjusting the contrast parameter of the camera is further ensured.
According to some embodiments of the present invention, the capturing a first projection image of the projector, acquiring a resolution of the first projection image, performing resolution enhancement processing on the first projection image when it is determined that the resolution is smaller than a preset resolution to obtain a second projection image, and acquiring a contrast of the second projection image, includes:
performing discrete Fourier transform on the first projection image to obtain a Fourier amplitude map of the first projection image, obtaining a Fourier spectrum according to the Fourier amplitude map, and performing feature extraction on the Fourier spectrum to obtain a high-frequency region and a low-frequency region of the Fourier spectrum;
extracting the characteristics of the high-frequency region, and extracting the peak value of the high-frequency region;
extracting the characteristics of the low-frequency area, and extracting the average value of the low-frequency area;
calculating a difference value between the peak value and the mean value, inquiring a preset difference value-definition table according to the difference value to obtain definition corresponding to the difference value, judging whether the definition is smaller than preset definition, and performing definition enhancement processing on the first projection image to obtain a second projection image when the definition is determined to be smaller than the preset definition;
converting each pixel point in the second projection image from a primary color space to a color-brightness separation color space, and then obtaining the brightness component of each pixel point in the second projection image;
performing convolution operation on the brightness component of each pixel point and a preset horizontal gradient operator to obtain the horizontal gradient of each pixel point, and performing square operation on the horizontal gradient of each pixel point to obtain the square value of the horizontal gradient of each pixel point;
performing convolution operation on the brightness component of each pixel point and a preset vertical gradient operator to obtain the vertical gradient of each pixel point, and performing square operation on the vertical gradient of each pixel point to obtain the square value of the vertical gradient of each pixel point;
adding the horizontal gradient square value and the vertical gradient square value of each pixel point to obtain the contrast component of each pixel point, and calculating according to the contrast component of each pixel point to obtain an average contrast component;
and comparing the contrast component of each pixel with the average contrast component, screening out the pixels with the contrast components larger than the average contrast component as target pixels, and summing the contrast components of the target pixels to obtain the contrast of the second projection image.
The working principle of the scheme is as follows: performing discrete Fourier transform on the first projection image to obtain a Fourier amplitude map of the first projection image, obtaining a Fourier spectrum according to the Fourier amplitude map, and performing feature extraction on the Fourier spectrum to obtain a high-frequency region and a low-frequency region of the Fourier spectrum; extracting the characteristics of the high-frequency region, and extracting the peak value of the high-frequency region; extracting the characteristics of the low-frequency area, and extracting the average value of the low-frequency area; calculating a difference value between the peak value and the mean value, inquiring a preset difference value-definition table according to the difference value to obtain definition corresponding to the difference value, judging whether the definition is smaller than preset definition, and performing definition enhancement processing on the first projection image to obtain a second projection image when the definition is determined to be smaller than the preset definition; converting each pixel point in the second projection image from a primary color space to a color-brightness separation color space, and then obtaining the brightness component of each pixel point in the second projection image; performing convolution operation on the brightness component of each pixel point and a preset horizontal gradient operator to obtain the horizontal gradient of each pixel point, and performing square operation on the horizontal gradient of each pixel point to obtain the square value of the horizontal gradient of each pixel point; performing convolution operation on the brightness component of each pixel point and a preset vertical gradient operator to obtain the vertical gradient of each pixel point, and performing square operation on the vertical gradient of each pixel point to obtain the square value of the vertical gradient of each pixel point; adding the horizontal gradient square value and the vertical gradient square value of each pixel point to obtain the contrast component of each pixel point, and calculating according to the contrast component of each pixel point to obtain an average contrast component; and comparing the contrast component of each pixel with the average contrast component, screening out the pixels with the contrast components larger than the average contrast component as target pixels, and summing the contrast components of the target pixels to obtain the contrast of the second projection image.
The method has the advantages that the contrast of the second projection image has an important effect on adjusting the contrast parameter of the camera, so that the method for accurately acquiring the contrast of the second projection image is provided; the definition of the image determines the accuracy of the contrast of the acquired image, so that firstly, the definition detection of the first projection image is necessary, the discrete Fourier transform is carried out on the first projection image to obtain a Fourier amplitude map of the first projection image, a Fourier spectrum is obtained according to the Fourier amplitude map, and the feature extraction is carried out on the Fourier spectrum to obtain a high-frequency region and a low-frequency region of the Fourier spectrum; extracting the characteristics of the high-frequency region, and extracting the peak value of the high-frequency region; extracting the characteristics of the low-frequency area, and extracting the average value of the low-frequency area; calculating a difference value between the peak value and the mean value, inquiring a preset difference value-definition table according to the difference value to obtain definition corresponding to the difference value, judging whether the definition is smaller than the preset definition or not according to higher accuracy of the definition obtained by the method, and performing definition enhancement processing on the first projection image to obtain a second projection image when the definition is determined to be smaller than the preset definition; conversely, the first projection image is used as a second projection image; converting each pixel point in the second projection image from a primary color space to a color-brightness separation color space, and then obtaining the brightness component of each pixel point in the second projection image; performing convolution operation on the brightness component of each pixel point and a preset horizontal gradient operator to obtain the horizontal gradient of each pixel point, and performing square operation on the horizontal gradient of each pixel point to obtain the square value of the horizontal gradient of each pixel point; performing convolution operation on the brightness component of each pixel point and a preset vertical gradient operator to obtain the vertical gradient of each pixel point, and performing square operation on the vertical gradient of each pixel point to obtain the square value of the vertical gradient of each pixel point; obtaining the horizontal gradient square value and the vertical gradient square value of each pixel point is an important step for calculating the contrast of the second projection image; adding the horizontal gradient square value and the vertical gradient square value of each pixel point to obtain the contrast component of each pixel point, and calculating according to the contrast component of each pixel point to obtain an average contrast component; and comparing the contrast component of each pixel with the average contrast component, screening out the pixels with the contrast components larger than the average contrast component as target pixels, summing the contrast components of the target pixels to obtain the contrast of the second projection image, wherein the contrast obtained by the calculation of the method is more accurate, and the accuracy of adjusting the contrast parameters of the camera is improved.
According to some embodiments of the invention, the adjusting the contrast parameter according to the brightness value of the environment around the projector and the contrast of the second projected image comprises:
and inquiring a preset data table according to the brightness value of the surrounding environment of the projector and the contrast of the second projected image to obtain a corresponding contrast adjusting coefficient, and adjusting the contrast parameter according to the contrast adjusting coefficient.
The working principle of the scheme is as follows: and inquiring a preset data table according to the brightness value of the surrounding environment of the projector and the contrast of the second projected image to obtain a corresponding contrast adjusting coefficient, and adjusting the contrast parameter according to the contrast adjusting coefficient.
The beneficial effect of above-mentioned scheme: the preset data table is a brightness value of the environment around the projector-contrast ratio of the second projection image-contrast ratio adjusting coefficient table, the contrast ratio adjusting coefficient is determined according to the brightness value of the environment around the projector and the contrast ratio of the second projection image, and the contrast ratio adjusting coefficient is determined according to the brightness value of the environment around the projector and the contrast ratio of the second projection image, so that the final adjusting result is more accurate.
According to some embodiments of the invention, before obtaining the first luminance value from the luminance signal, further comprising:
and calculating the signal-to-noise ratio of the brightness signal, judging whether the signal-to-noise ratio is smaller than a preset signal-to-noise ratio, and performing noise reduction processing on the brightness signal when the signal-to-noise ratio is determined to be smaller than the preset signal-to-noise ratio.
The working principle and the beneficial effects of the scheme are as follows: and calculating the signal-to-noise ratio of the brightness signal, judging whether the signal-to-noise ratio is smaller than a preset signal-to-noise ratio, and performing noise reduction processing on the brightness signal when the signal-to-noise ratio is determined to be smaller than the preset signal-to-noise ratio, so as to ensure the accuracy of the finally obtained first brightness value.
According to some embodiments of the invention, the calculating the signal-to-noise ratio of the luminance signal comprises:
performing framing processing on the brightness signal to obtain N frames of sub-brightness signals;
calculating the brightnessNoise strength Q of signal1As shown in equation (1):
wherein, W
1The power coefficient of an effective signal in the brightness signal; k is an error coefficient of the brightness signal in the acquisition process; n is the frame number of the sub-brightness signal; c
iThe amplitude of the sub-brightness signal of the ith frame;
average amplitude of N frames of sub-brightness signals;
according to the noise intensity Q of the brightness signal1And calculating the signal-to-noise ratio gamma of the brightness signal as shown in formula (2):
wherein Q is2The intensity of the effective signal in the brightness signal; eiIs the energy of the ith frame sub-luminance signal; eJIs preset standard energy; e is a natural constant; w2Is the power coefficient of the noise in the luminance signal.
The working principle and the beneficial effects of the scheme are that the luminance signal is divided into frames to obtain N sub-luminance signals, the characteristics of the luminance signal are better reflected, the calculation result is more accurate by calculating according to the N sub-luminance signals, and when the signal-to-noise ratio of the luminance signal is calculated, the calculated signal-to-noise ratio is more accurate by considering the strength of an effective signal in the luminance signal, the power coefficient of noise in the luminance signal, the power coefficient of the effective signal in the luminance signal, the average amplitude of the N frames of sub-luminance signals and other factors.
As shown in fig. 2, a system for adjusting contrast of a projector according to some embodiments of the present invention includes:
an environment brightness value obtaining module 1, configured to obtain a brightness value of an environment around the projector;
the image contrast acquisition module 2 is configured to shoot a first projection image of the projector, acquire the definition of the first projection image, and perform definition enhancement processing on the first projection image when it is determined that the definition is smaller than a preset definition, to obtain a second projection image, and acquire the contrast of the second projection image;
the projector contrast parameter acquisition module 3 is used for acquiring the contrast parameter of the projector during projection;
and the first control module 4 is used for adjusting the contrast parameter according to the brightness value of the environment around the projector and the contrast of the second projection image.
The working principle of the scheme is as follows: the environment brightness value acquisition module 1 is configured to acquire a brightness value of an environment around the projector; the image contrast acquisition module 2 is configured to shoot a first projection image of the projector, acquire the definition of the first projection image, and perform definition enhancement processing on the first projection image when it is determined that the definition is smaller than a preset definition, to obtain a second projection image, and acquire the contrast of the second projection image; the projector contrast parameter acquisition module 3 is used for acquiring the contrast parameter of the projector during projection; the first control module 4 is configured to adjust the contrast parameter according to the brightness value of the environment around the projector and the contrast of the second projection image.
The beneficial effect of above-mentioned scheme: the contrast of the projected image can change along with the change of the ambient brightness, if the ambient brightness changes, the contrast parameter of the projector is not adjusted timely, so that the personnel can not see the projected image clearly, the practicability of the projector is extremely poor, the contrast through the ambient brightness and the projected image is right, the contrast parameter of the projector is adjusted in real time, the contrast of the projected image is ensured to be just right, the experience of the viewers is increased, the practicability of the device is increased, and the experience of the user is improved.
As shown in fig. 3, according to some embodiments of the present invention, the ambient brightness value obtaining module 1 includes:
the region dividing module 5 is configured to acquire a region where the camera is located, and perform region dividing processing on the region where the camera is located to obtain a first region and a second region;
a first brightness value obtaining module 6, configured to obtain a brightness signal of the first area, and obtain a first brightness value according to the brightness signal; the brightness signal is obtained by a brightness sensor which is arranged in the first area in advance;
a second control module 7 for:
shooting a second area image, acquiring a second brightness value of each pixel point in the second area image, calculating a brightness difference value of the second brightness value of each pixel point and the second brightness value of an adjacent pixel point, and screening out the pixel points with the brightness difference value within a preset brightness difference value range to serve as effective pixel points; screening out pixel points of which the brightness difference values are not within a preset brightness difference value range as edge pixel points; the adjacent pixel point is any pixel point within a preset distance;
inquiring a preset brightness difference value-second brightness value correction coefficient table according to the brightness difference value of the edge pixel point to obtain a brightness correction coefficient corresponding to the brightness difference value, respectively correcting the second brightness value of the corresponding edge pixel point according to the brightness correction coefficient, and generating an image to be processed according to the corrected edge pixel point and the effective pixel point;
performing image segmentation processing on the image to be processed to obtain a plurality of sub-images to be processed, and setting brightness weight coefficients for the plurality of sub-images to be processed; the brightness weight coefficient is set according to the number of the segmented sub-images to be processed;
respectively obtaining the average brightness value of each sub-image to be processed, and carrying out weighted summation processing on the average brightness value of each sub-image to be processed based on the set brightness weight coefficient to obtain a third brightness value;
sorting the average brightness values of the sub-images to be processed, screening out a maximum average brightness value and a minimum average brightness value, calculating a ratio of the maximum average brightness value to the minimum average brightness value, and multiplying the ratio by the third brightness value to obtain a fourth brightness value;
and inputting the first brightness value and the fourth brightness value into a pre-trained environment brightness value acquisition model, and outputting an environment brightness value.
The working principle of the scheme is as follows: the region dividing module 5 is configured to obtain a region where the camera is located, and perform region dividing processing on the region where the camera is located to obtain a first region and a second region; the first brightness value obtaining module 6 is configured to obtain a brightness signal of the first area, and obtain a first brightness value according to the brightness signal; the brightness signal is obtained by a brightness sensor which is arranged in the first area in advance; the second control module 7 is configured to capture a second area image, obtain a second brightness value of each pixel point in the second area image, calculate a brightness difference between the second brightness value of each pixel point and the second brightness value of an adjacent pixel point, and screen out a pixel point with the brightness difference within a preset brightness difference range as an effective pixel point; screening out pixel points of which the brightness difference values are not within a preset brightness difference value range as edge pixel points; the adjacent pixel point is any pixel point within a preset distance; inquiring a preset brightness difference value-second brightness value correction coefficient table according to the brightness difference value of the edge pixel point to obtain a brightness correction coefficient corresponding to the brightness difference value, respectively correcting the second brightness value of the corresponding edge pixel point according to the brightness correction coefficient, and generating an image to be processed according to the corrected edge pixel point and the effective pixel point; performing image segmentation processing on the image to be processed to obtain a plurality of sub-images to be processed, and setting brightness weight coefficients for the plurality of sub-images to be processed; the brightness weight coefficient is set according to the number of the segmented sub-images to be processed; respectively obtaining the average brightness value of each sub-image to be processed, and carrying out weighted summation processing on the average brightness value of each sub-image to be processed based on the set brightness weight coefficient to obtain a third brightness value; sorting the average brightness values of the sub-images to be processed, screening out a maximum average brightness value and a minimum average brightness value, calculating a ratio of the maximum average brightness value to the minimum average brightness value, and multiplying the ratio by the third brightness value to obtain a fourth brightness value; and inputting the first brightness value and the fourth brightness value into a pre-trained environment brightness value acquisition model, and outputting an environment brightness value.
The beneficial effect of above-mentioned scheme: the brightness of the environment of the camera has a great influence on adjusting the contrast parameter of the camera, so that the accurate measurement of the brightness of the environment around the camera is very necessary, and the scheme provides a method for accurately measuring the brightness of the environment around the camera; the region dividing module 5 is configured to obtain a region where the camera is located, and perform region dividing processing on the region where the camera is located to obtain a first region and a second region; in some special cases, the brightness of the environment around the camera may have a huge difference, and the area division processing is performed on the area where the camera is located, so that the final detection result is more accurate; the first brightness value obtaining module 6 is configured to obtain a brightness signal of the first area, and obtain a first brightness value according to the brightness signal; the brightness signal is obtained by a brightness sensor which is arranged in the first area in advance; the second control module 7 is configured to capture a second area image, obtain a second brightness value of each pixel point in the second area image, calculate a brightness difference value between each pixel point and an adjacent pixel point, and screen out a pixel point with the brightness difference value within a preset brightness difference value range as an effective pixel point; screening out pixel points of which the brightness difference values are not within a preset brightness difference value range as edge pixel points; the adjacent pixel point is any pixel point within a preset distance; inquiring a preset brightness difference value-second brightness value correction coefficient table according to the brightness difference value of the edge pixel point to obtain a brightness correction coefficient corresponding to the brightness difference value, correcting the second brightness value of the corresponding edge pixel point according to the brightness correction coefficient, and generating an image to be processed according to the corrected edge pixel point and the effective pixel point; the image to be processed is a second area image subjected to noise reduction, and the second brightness value of the edge pixel point is corrected, so that the image to be processed is clearer, and the noise in the second area image is reduced; performing image segmentation processing on the image to be processed to obtain a plurality of sub-images to be processed, and setting brightness weight coefficients for the plurality of sub-images to be processed; the brightness weight coefficient is set according to the number of the segmented sub-images to be processed; respectively obtaining the average brightness value of each sub-image to be processed, and carrying out weighted summation processing on the average brightness value of each sub-image to be processed based on the set brightness weight coefficient to obtain a third brightness value; sorting the average brightness values of the sub-images to be processed, screening out a maximum average brightness value and a minimum average brightness value, calculating a ratio of the maximum average brightness value to the minimum average brightness value, and multiplying the ratio by the third brightness value to obtain a fourth brightness value; and inputting the first brightness value and the fourth brightness value into a pre-trained environment brightness value acquisition model, and outputting the brightness value of the environment around the projector, so that the finally obtained brightness value of the environment around the projector is more accurate, and the accuracy of finally adjusting the contrast parameter of the camera is further ensured.
According to some embodiments of the invention, the image contrast acquisition module 2 comprises:
a sharpness enhancement module to:
performing discrete Fourier transform on the first projection image to obtain a Fourier amplitude map of the first projection image, obtaining a Fourier spectrum according to the Fourier amplitude map, and performing feature extraction on the Fourier spectrum to obtain a high-frequency region and a low-frequency region of the Fourier spectrum;
extracting the characteristics of the high-frequency region, and extracting the peak value of the high-frequency region;
extracting the characteristics of the low-frequency area, and extracting the average value of the low-frequency area;
calculating a difference value between the peak value and the mean value, inquiring a preset difference value-definition table according to the difference value to obtain definition corresponding to the difference value, judging whether the definition is smaller than preset definition, and performing definition enhancement processing on the first projection image to obtain a second projection image when the definition is determined to be smaller than the preset definition;
a calculation module to:
converting each pixel point in the second projection image from a primary color space to a color-brightness separation color space, and then obtaining the brightness component of each pixel point in the second projection image;
performing convolution operation on the brightness component of each pixel point and a preset horizontal gradient operator to obtain the horizontal gradient of each pixel point, and performing square operation on the horizontal gradient of each pixel point to obtain the square value of the horizontal gradient of each pixel point;
performing convolution operation on the brightness component of each pixel point and a preset vertical gradient operator to obtain the vertical gradient of each pixel point, and performing square operation on the vertical gradient of each pixel point to obtain the square value of the vertical gradient of each pixel point;
adding the horizontal gradient square value and the vertical gradient square value of each pixel point to obtain the contrast component of each pixel point, and calculating according to the contrast component of each pixel point to obtain an average contrast component;
and comparing the contrast component of each pixel with the average contrast component, screening out the pixels with the contrast components larger than the average contrast component as target pixels, and summing the contrast components of the target pixels to obtain the contrast of the second projection image.
The working principle of the scheme is as follows: the sharpness enhancement module is used for performing discrete Fourier transform on the first projection image to obtain a Fourier amplitude map of the first projection image, obtaining a Fourier spectrum according to the Fourier amplitude map, and performing feature extraction on the Fourier spectrum to obtain a high-frequency region and a low-frequency region of the Fourier spectrum; extracting the characteristics of the high-frequency region, and extracting the peak value of the high-frequency region; extracting the characteristics of the low-frequency area, and extracting the average value of the low-frequency area; calculating a difference value between the peak value and the mean value, inquiring a preset difference value-definition table according to the difference value to obtain definition corresponding to the difference value, judging whether the definition is smaller than preset definition, and performing definition enhancement processing on the first projection image to obtain a second projection image when the definition is determined to be smaller than the preset definition; the calculation module is used for converting each pixel point in the second projection image from a primary color space to a color-brightness separation color space and then acquiring the brightness component of each pixel point in the second projection image; performing convolution operation on the brightness component of each pixel point and a preset horizontal gradient operator to obtain the horizontal gradient of each pixel point, and performing square operation on the horizontal gradient of each pixel point to obtain the square value of the horizontal gradient of each pixel point; performing convolution operation on the brightness component of each pixel point and a preset vertical gradient operator to obtain the vertical gradient of each pixel point, and performing square operation on the vertical gradient of each pixel point to obtain the square value of the vertical gradient of each pixel point; adding the horizontal gradient square value and the vertical gradient square value of each pixel point to obtain the contrast component of each pixel point, and calculating according to the contrast component of each pixel point to obtain an average contrast component; and comparing the contrast component of each pixel with the average contrast component, screening out the pixels with the contrast components larger than the average contrast component as target pixels, and summing the contrast components of the target pixels to obtain the contrast of the second projection image.
The method has the advantages that the contrast of the second projection image has an important effect on adjusting the contrast parameter of the camera, so that the method for accurately acquiring the contrast of the second projection image is provided; the definition of the image determines the accuracy of the contrast of the acquired image, so that it is necessary to perform definition detection on the first projection image, the definition enhancement module is used for performing discrete fourier transform on the first projection image to obtain a fourier amplitude map of the first projection image, obtaining a fourier spectrum according to the fourier amplitude map, and performing feature extraction on the fourier spectrum to obtain a high-frequency region and a low-frequency region of the fourier spectrum; extracting the characteristics of the high-frequency region, and extracting the peak value of the high-frequency region; extracting the characteristics of the low-frequency area, and extracting the average value of the low-frequency area; calculating a difference value between the peak value and the mean value, inquiring a preset difference value-definition table according to the difference value to obtain definition corresponding to the difference value, judging whether the definition is smaller than the preset definition or not according to higher accuracy of the definition obtained by the method, and performing definition enhancement processing on the first projection image to obtain a second projection image when the definition is determined to be smaller than the preset definition; conversely, the first projection image is used as a second projection image; the calculation module is used for converting each pixel point in the second projection image from a primary color space to a color-brightness separation color space and then acquiring the brightness component of each pixel point in the second projection image; performing convolution operation on the brightness component of each pixel point and a preset horizontal gradient operator to obtain the horizontal gradient of each pixel point, and performing square operation on the horizontal gradient of each pixel point to obtain the square value of the horizontal gradient of each pixel point; performing convolution operation on the brightness component of each pixel point and a preset vertical gradient operator to obtain the vertical gradient of each pixel point, and performing square operation on the vertical gradient of each pixel point to obtain the square value of the vertical gradient of each pixel point; obtaining the horizontal gradient square value and the vertical gradient square value of each pixel point is an important step for calculating the contrast of the second projection image; adding the horizontal gradient square value and the vertical gradient square value of each pixel point to obtain the contrast component of each pixel point, and calculating according to the contrast component of each pixel point to obtain an average contrast component; and comparing the contrast component of each pixel with the average contrast component, screening out the pixels with the contrast components larger than the average contrast component as target pixels, summing the contrast components of the target pixels to obtain the contrast of the second projection image, wherein the contrast obtained by the calculation of the method is more accurate, and the accuracy of adjusting the contrast parameters of the camera is improved.
According to some embodiments of the invention, the system for adjusting the contrast of the projector further comprises:
and the noise reduction module is configured to calculate a signal-to-noise ratio of the luminance signal before the first luminance value obtaining module 6 obtains the first luminance value according to the luminance signal, determine whether the signal-to-noise ratio is smaller than a preset signal-to-noise ratio, and perform noise reduction processing on the luminance signal when it is determined that the signal-to-noise ratio is smaller than the preset signal-to-noise ratio.
The working principle of the scheme is as follows: the noise reduction module is used for calculating the signal-to-noise ratio of the brightness signal, judging whether the signal-to-noise ratio is smaller than a preset signal-to-noise ratio or not, and carrying out noise reduction processing on the brightness signal when the signal-to-noise ratio is determined to be smaller than the preset signal-to-noise ratio, so that the accuracy of the finally obtained first brightness value is ensured.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.