Summary of the invention
Problem to be solved by this invention is to provide a kind of method and apparatus that quick and precisely calculates the area of this class irregular figure of automobile window glass defrosting-defogging profile diagram, the method and apparatus of described area is not only applicable to this irregular figure of automobile window glass defrosting-defogging profile diagram, but also is applicable to all irregular figures that other can collect image.
In order to solve the problems of the technologies described above, the invention provides a kind of method that irregular figure area calculates, it is characterized in that, comprise the following steps:
Gather the image of irregular figure, obtain the first image;
Gather an image with reference to figure, obtain the second image, wherein said area S with reference to figure is known, and described the first image is identical with the acquisition condition of described the second image;
Described the first image and described the second image are compared, according to the described area A of calculating described irregular figure with reference to the area S of figure.
Gathering described image with reference to figure, after obtaining the step of described the second image, further comprising the steps of:
Calculate the pixel N of described the first image
1
Calculate the pixel N of described the second image
2
The concrete mode of calculating the area A of described irregular figure according to described area S with reference to figure is:
Pixel N with described the first image
1Pixel N with described the second image
2Compare, and according to the pixel N of described the first image
1Pixel N with described the second image
2Between proportionate relationship and utilize with formula according to described area S with reference to figure
Calculate the area A of described irregular figure.
Described acquisition condition is identical to be comprised: gather environmental facies with, sampling instrument is identical, gathers the identical and/or described irregular figure of distance and describedly is placed in same plane with reference to figure.
Preferably, described profile with reference to figure is that circle, triangle, rectangle are wherein a kind of.
The device that a kind of irregular figure area calculates is characterized in that, comprising:
The first image capture module for the image that gathers irregular figure, obtains the first image;
The second image capture module is used for gathering an image with reference to figure, obtains the second image, and wherein said area S with reference to figure is known, and described the first image is identical with the acquisition condition of described the second image;
The area computing module is used for described the first image and described the second image are compared, according to the described area A of calculating described irregular figure with reference to the area S of figure.
Also comprise at the second image capture module:
The first pixel computing module is for the pixel N that calculates described the first image
1
The second pixel computing module is for the pixel N that calculates described the second image
2
The embodiment of described area computing module is:
Pixel N with described the first image
1Pixel N with described the second image
2Compare, and according to the pixel N of described the first image
1Pixel N with described the second image
2Between proportionate relationship and utilize with formula according to described area S with reference to figure
Calculate the area A of described irregular figure.
The invention has the beneficial effects as follows:
The method and apparatus that irregular figure area provided by the present invention calculates all is suitable for any irregular figure, and in the process of the area that calculates irregular figure, not only convenient and swift, and comparison of computational results is accurate.
Embodiment
For computing method and the device of clear statement irregular figure area provided by the present invention, the present invention is described in detail below in conjunction with accompanying drawing, and embodiments of the invention are take the area that calculates automobile window glass defrosting-defogging profile diagram as example.
A kind of method that irregular figure area calculates is characterized in that, comprises the following steps:
Gather the image of irregular figure, obtain the first image;
Gather an image with reference to figure, obtain the second image, wherein said area S with reference to figure is known, and described the first image is identical with the acquisition condition of described the second image;
Described the first image and described the second image are compared, according to the described area A of calculating described irregular figure with reference to the area S of figure.
The core concept of the method that above-mentioned irregular figure area calculates be with described irregular figure and an area S known with reference to figure under identical condition simultaneously shape be converted into the bitmap images that can supply computer program to read in, and calculate the both quantity of shared pixel, according to the proportionate relationship of the shared quantity of pixel both and calculate the area A of described irregular figure according to the area S of reference figure.
The below is described described method with concrete embodiment
Take the area that calculates this irregular figure of Defroster device for vehicle demist profile diagram as example, Fig. 1 is the process flow diagram of the method for the area that calculates Defroster device for vehicle demist profile diagram, with reference to Fig. 1, said method comprising the steps of:
Step 101, beginning.
Step 102 gathers the image of described this irregular figure of automobile window glass defrosting-defogging profile diagram, obtains the first image.
Wherein, before the image that gathers described this irregular figure of automobile window glass defrosting-defogging profile diagram, the method for obtaining described automobile window glass defrosting-defogging profile diagram is as follows:
At first be to choose a transparent clean smooth plastic plate;
Next is described plastic plate to be covered the outside surface of automobile window glass, has the defrosting-defogging profile diagram on described automobile window glass.
At last under on described plastic plate, described defrosting-defogging profile diagram being described.
So just obtained this irregular figure of automobile window glass defrosting-defogging profile diagram, described the first image is the image of automobile window glass defrosting-defogging profile diagram, and the area of described this irregular figure of automobile window glass defrosting-defogging profile diagram is designated as A.
Step 103 gathers this image with reference to figure of standard panel, obtains the second image.Wherein, the area of described standard panel is designated as S, and S is known.
In order to calculate the area S of described standard panel with conventional way, the profile of described standard panel can be wherein a kind of for circle, triangle, rectangle.
Wherein, in the process that gathers described the first image and described the second image, acquisition condition is identical, described acquisition condition is identical to be referred to: described plastic plate with automobile window glass defrosting-defogging profile diagram and described standard panel are placed in equivalent environment, use same sampling instrument, sampling instrument equates and/or plastic plate and standard panel is placed on same plane with the distance between the standard panel with sampling instrument with the distance between plastic plate, gathering simultaneously.
Described sampling instrument mainly refers to a digital camera and annex thereof, digital camera requires performance good, the photo of taking is clear, and want to carry out wide-long shot, also this digital camera to be placed on a support in shooting, can vibration-generating in the process of guaranteeing to take, thus can not affect shooting quality;
Step 104 is calculated the pixel N of described the first image
1
Step 105 is calculated the pixel N of described the second image
2
Step 106 is with described the first pixel N
1With described the second pixel N
2Compare, and according to described the first pixel N
1With described the second pixel N
2Between proportionate relationship, and utilize according to described area S with reference to figure the area A of calculating described irregular figure with formula (1).
Formula (1) is as follows:
Wherein, the principle of formula (1) is: in the situation that the image acquisition condition is identical, the shared area of the pixel of equal number equates.
Be exactly specifically: under identical acquisition condition, the pixel of supposing a certain image is 1 unit, shared real area is S, when the pixel of another image is 2 units so, shared area is exactly 2 times of S, when the pixel of another image was 3 units, shared area was exactly 3 times of S, by that analogy.So in formula (1), N
2Compare N
1Be with reference to the multiple relation between the area A of the area S of figure and irregular figure.
Step 107 finishes.
Here it is pointed out that the method for calculating irregular figure area in the embodiment of the present invention is not limited to above-mentioned formula (1), other any methods identical with formula (1) principle all should be thought thought category of the present invention.
The above-mentioned method of utilizing this area S with reference to figure of described standard panel to calculate the area A of described this irregular figure of automobile window glass defrosting-defogging profile diagram, not only be applicable to this irregular figure of automobile window glass defrosting-defogging profile diagram, and other any irregular figures all are suitable for, and computation process is convenient and swift, and result of calculation is accurate.
The device that the present invention also provides a kind of irregular figure area to calculate, take this irregular figure of automobile window glass defrosting-defogging profile diagram as example, Fig. 2 is the pie graph of the device of the present embodiment to described irregular figure equally, with reference to Fig. 2, described device comprises:
The first image capture module 1, described the first image capture module 1 is used for gathering the image of described this irregular figure of automobile window glass defrosting-defogging profile diagram, obtains the first image.
Wherein, before the image that gathers described this irregular figure of automobile window glass defrosting-defogging profile diagram, the method for obtaining described automobile window glass defrosting-defogging profile diagram is as follows:
At first be to choose a transparent clean smooth plastic plate;
Next is described plastic plate to be covered the outside surface of automobile window glass, has the defrosting-defogging profile diagram on described automobile window glass.
At last under on described plastic plate, described defrosting-defogging profile diagram being described.
So just obtained this irregular figure of automobile window glass defrosting-defogging profile diagram, described the first image is the image of automobile window glass defrosting-defogging profile diagram, and the area of described this irregular figure of automobile window glass defrosting-defogging profile diagram is designated as A.
The second image capture module 2, described the second image capture module 2 is used for gathering an image with reference to figure, obtains the second image.Wherein, the area of described standard panel is designated as S, and area S is known.
In order to calculate the area S of described standard panel with conventional way, the profile of described standard panel can be wherein a kind of for circle, triangle, rectangle.
Wherein, in the process that gathers described the first image and described the second image, acquisition condition is identical, described acquisition condition is identical to be referred to: described plastic plate with automobile window glass defrosting-defogging profile diagram and described standard panel are placed in equivalent environment, use same sampling instrument, sampling instrument equates and/or plastic plate and standard panel is placed on same plane with the distance between the standard panel with sampling instrument with the distance between plastic plate, gathering simultaneously.
Described sampling instrument mainly refers to a digital camera and annex thereof, digital camera requires performance good, the photo of taking is clear, and want to carry out wide-long shot, also this digital camera to be placed on a support in shooting, can vibration-generating in the process of guaranteeing to take, thus can not affect shooting quality.
The first pixel computing module 3, described the first pixel computing module 4 is used for calculating the pixel of described the first image, obtains the first pixel N
1
The second pixel computing module 4, the second pixel computing modules 5 are used for calculating the pixel of described the second image, obtain the second pixel N
2
Area computing module 5, described area computing module 5 is used for according to described the first pixel N
1With described the second pixel N
2Between proportionate relationship, and according to described area A with reference to figure, the formula that the method for utilizing the present invention to calculate the area of irregular figure is used (1) calculates the area S of described irregular figure
X
Wherein, the principle of formula (1) is identical with the principle in method, repeats no more here.
When adopting said apparatus to calculate area as this irregular figure of automobile window glass defrosting-defogging profile diagram, be not only applicable to automobile window glass defrosting-defogging profile diagram, and other any irregular figures that can collect image all are suitable for, and computation process is convenient and swift, and result of calculation is accurate.
The above is only the preferred embodiment of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.