Summary of the invention
The purpose of the embodiment of the invention is to provide a kind of detection method of resolution of photographic device, is intended to solve prior art and can't obtains the problem of testing result accurately when detection resolution.
The embodiment of the invention is achieved in that a kind of detection method of resolution of photographic device, and described detection method may further comprise the steps:
The line that receives user's input is chosen information to graph card image detection zone, according to described line information is chosen in graph card image detection zone and is determined the coordinate of the line of surveyed area to begin column;
Line by line scan line to pixel column, and calculate the contrast of current scan line;
Whether judge current scan line contrast less than standard value,, and calculate the contrast of next scan line if the overgauge value continues next line of scanning to pixel column;
If current scan line contrast less than standard value, is made as critical row with current scan line, and determine the coordinate of current scan line;
Determine the coordinate of surveyed area line to end line, and in conjunction with begin column coordinate and critical row-coordinate calculating resolution.
Another purpose of the embodiment of the invention is to provide a kind of resolution of photographic device detection system, and described detection system comprises:
Surveyed area is chosen information receiving unit, the line that is used to receive user's input is chosen information to graph card image detection zone, described relative graph card image detection zone is chosen information and is comprised whole line to the zone and the information in part pure color zone, or be included in two lines to the partial line that intercepts between the scale to area information;
Line is used to resolve described surveyed area and chooses the information that information receiving unit receives, and the line of definite surveyed area is to the coordinate of begin column the begin column determining unit;
Line is triggered the begin column determining unit by described line critical capable determining unit, and the line that is used to line by line scan is to pixel column, and the line of definite surveyed area is to the coordinate of critical row;
Line is triggered critical capable determining unit by described line the end line determining unit, is used for determining the coordinate of surveyed area line to end line; And
The resolution computing unit, the coordinate that is used for the end line that the coordinate of the critical row that the coordinate of the begin column the begin column determining unit determined according to described line, described line determine critical capable determining unit and described line determine the end line determining unit carries out the calculating of resolution.In the embodiment of the invention, according to the coordinate of the figure card graphic center line of successively determining to take to the begin column in zone, critical row, end line, and then calculate resolution, can detect the resolution of camera head in the portable terminal exactly, thereby avoid because the error that subjective factor or estimation bring.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer,, the present invention is further elaborated below in conjunction with drawings and Examples.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
In the embodiment of the invention, determine that at first surveyed area also calculates the contrast of outlet to pixel column, the pixel column contrast during less than the standard value set, is gone out resolution by this pixel column in the coordinate Calculation of surveyed area when scanning line.
Fig. 2 shows the realization flow of the detection method of the resolution of photographic device that the embodiment of the invention provides, and details are as follows:
In step S201, the surveyed area that receives user's input is chosen information, chooses information according to described surveyed area and determines the coordinate of the line of surveyed area to begin column.
In the embodiment of the invention, with ISO12233 or ISO T05 standard graph card is example, the figure card graphic that camera head is taken can be the BMP image, line is called the pure color zone to extra-regional zone, between starting position that line is right and the end position mark a plurality of tools scale value at regular intervals is arranged, in the present embodiment respectively with Value
StartAnd Value
EndThe scale of expression starting position and end position.
The surveyed area of user's input is chosen information, comprise the information of whole line to zone and part pure color zone, this moment with the line that scans to the coordinate of first row in zone as the coordinate of line to begin column, described coordinate is perpendicular to the coordinate of line to the reference axis of begin column, represents with LineStart; Also can be included in two lines to the partial line that intercepts between the scale to area information, as shown in Figure 3, the coordinate that directly go the partial line that scans to start with to the coordinate of the initial row in zone this moment, described coordinate is perpendicular to the coordinate of line to the reference axis of begin column, represents with LineStart equally.
In step S202, the line of lining by line scan is to pixel column, and calculates the contrast of current scan line.
At first choose a pure color zone outside to the zone, reach the purpose of setting figure card graphic relevant parameter, need obtain two parameters from this pure color zone: the mean flow rate of pixel in picture noise σ and the pure color zone by analysis to this pure color zone in line
Wherein noise σ is by mean flow rate
Variance obtain, concrete grammar is as follows:
Supposing that the pure color peak width of choosing is x, highly is y, and starting point is (x
s, y
s), (i, brightness j) is: Y more arbitrarily in this zone
I, j=0.299*R
I, j+ 0.587*G
I, j+ 0.114*B
I, jIts R, G, B are respectively red, green, blue three looks pairing value under the rgb format, be to be understood that, said method is fit to the image of extended formatting equally, can be directly replace with the value of its corresponding color lump such as the brightness of the picture of RAW form, the brightness of the picture of yuv format can use its Y component to replace.
The mean flow rate of the pure color area pixel of choosing
Be respectively for noise σ:
Further by mean flow rate
With the threshold value G that calculates pure color regional luminance gradient for noise σ
Th:
Threshold value G
ThBe used for analysis chart card graphic pure color zone and line brightness gradual change situation to the zone, have only when the brightness variation greater than threshold value G
ThThe time, think that just pure color zone and the line on the image can be recognized the boundary transition in zone, the calculating of threshold value also can guarantee to get rid of interference of noise in the identification border.
To being that example illustrates, the line of can also detection level when should be appreciated that concrete enforcement placing or otherwise placing is right, only need carry out simple coordinate transform and get final product with the line of vertical placement for following content.
Scanning need in the current scan line need to determine the line the judged zone to pixel during to pixel column when the front, for the line of vertical placement for, promptly need the scope of definite current scan line center line to pixel coordinate.Utilize threshold value G in the present embodiment
ThFind out of zone and the removing of current scan line center line, at first find the right left side of the capable center line of current pixel to begin the border, set Y both sides
NestRepresent the brightness of any afterwards of current scanning element point, Y
PreRepresent the brightness of the last pixel of current scanning element point, set PixelStart=0, PixelEnd=0, wherein PixelStart and PixelEnd represent initial pixel and the abscissa that stops pixel in the current scan line respectively; Initialization Y
NestFor abscissa in the current scan line is x
0The brightness of+2 pixel, Y
PreFor abscissa is x
0The brightness of pixel, begin then abscissa in the delegation from x
0+ 1 to x
1-1 point is made incremental scan, for abscissa in the current scan line at x
0+ 1 to x
1Pixel in-1 scope, calculating its brightness step is Y
Grads=Y
Nest-Y
Pre, compare gradient difference and threshold value G then
Th, if
〉=G
Th, PixelStart=x then, expression brightness is in pure color zone and line to the coordinate of the pixel of the boundary in zone, is designated as the original position of current scan line center line to pixel.Find after the PixelStart initialization Y
NestFor abscissa is x
1The brightness of-2 pixel, Y
PreFor abscissa is x
1The brightness of pixel, then to abscissa in the current scan line from x
1-1 to x
0The scanning of successively decreasing of+1 pixel is if same
〉=G
ThPixelEnd=x then, expression brightness is in pure color zone and line to the coordinate of the pixel of the boundary in zone, is designated as the final position of current scan line center line to pixel, and the part between PixelStart and PixelEnd is exactly that current scan line center line is to pixel place coordinate range like this.
Be to be understood that, above content is calculated with pixel brightness at interval during the pixel brightness step in calculating current scan line, also can finally obtain current scan line center line to pixel place coordinate range by the brightness step that calculates neighbor pixel when specifically implementing.
After confirming PixelStart and PixelEnd, then begin the line in this coordinate range is judged the definition of pixel.Suppose for the line of vertical placement for, the ordinate of current scan line is Y, by to the zone (PixelStart, Y-1), (PixelEnd, Y+1) definition that current scan line is right is judged to the analysis of pixel brightness in interior lines, at first need calculate this regional mean flow rate Y, the calculating principle is same as above, repeats no more.The right definition of current scan line is calculated by following formula:
Wherein, Y
Mean_whiteBe the average brightness of interior all brightness values in zone greater than the pixel of Y, Y
Mean_blackBe the average brightness of interior all brightness values in zone less than the pixel of Y.And
Then be meant the average brightness value in pure color zone, 255 represent the maximum brightness value in the color space.The reason of two row up and down that following formula is chosen current scan line is the luminance errors that may cause for fear of single file partial pixel point, part is used for the brightness contrast degree of the monochrome pixels point in the zoning before the multiplication sign, because when line when overstocked, it will be to show a slice grey that camera is noted image, so the contrast degree is high more, show that then black and white line is to also just being shown camera energy clear " resolution " this zone by clear identification; And the fraction after the multiplication sign is mainly used in the error amount that causes because of image brightness is revised, because when image brightness reduces, the denominator variation of the preceding fraction of multiplication sign is less, and the molecule decrease is bigger, and then reduced value will reduce, so need do suitable correction.
In step S203, judge that whether current scan line contrast is less than standard value.
In the embodiment of the invention, preestablish the accurate value of a contrast scale, the pixel in zone can be returned step S202 and continue the scanning next line by clear identification if current scan line contrast, is represented current scan line center line greater than this standard value; If current scan line contrast less than this standard value, represents that current scan line center line can not clearly be recognized the pixel in zone, then carry out next step S204.
In step S204, current scan line is made as critical row, and determines the coordinate of current scan line.
If current scan line center line can not clearly be recognized the pixel in zone, then represent to begin later line all can not clearly be recognized to pixel column from current line, the critical row of current behavior, coordinate is designated as LineResult, and described coordinate is perpendicular to the coordinate of line to the reference axis of critical row.
In step S205, determine the coordinate of surveyed area line to end line, and in conjunction with begin column coordinate and critical row-coordinate calculating resolution.
If the surveyed area chosen for two lines of intercepting to the partial line between the scale to the zone, then with the partial line that scans to the coordinate of the termination row in zone as the coordinate of line to the surveyed area end line, described coordinate is perpendicular to the coordinate of line to the reference axis of end line, is designated as LineEnd.
If the surveyed area of choosing comprises that whole line is to zone and part pure color zone; then with line to the coordinate of regional final position as the coordinate of line to the surveyed area end line; described coordinate is perpendicular to the coordinate of line to the reference axis of end line; be designated as LineEnd; consider online will finish the zone time; the brightness value of the data line that scans should be unable to have bigger variation; judge the end position of line by PixelStart and PixelEnd value in the embodiment of the invention to the zone; when two values of PixelStart and PixelEnd occur unusual or when great changes have taken place, promptly occur PixelStart>PixelEnd or Δ (PixelStart with respect to the value of lastrow
Pre-PixelStart
This), then can judge this behavior footline, obtain LineEnd.
The formula of calculating resolution is:
(Value
End-Value
Start) * (LineResult-LineStart)/(LineEnd-LineStart), it is same as above that wherein the meaning of each parameter reaches definite principle of choosing under the situation in the difference of surveyed area, Value
StartAnd Value
EndRepresent the scale reading of surveyed area line respectively, have the graph card mark to obtain begin column and end line.
In the embodiment of the invention, still it is right to can not find the line that can recognize after surveyed area is finished a frame scan, then think do not have in the selected surveyed area can clear identification line right, reason may select wrong or regional interior lines too high to dense degree for the surveyed area zone, LineStart is changed to 0, and expression can't be judged; In the time of should adopting said method to determine LineEnd together, reason may be selected wrong for the surveyed area zone.
Those having ordinary skill in the art will appreciate that, all or part of step in realization the foregoing description method can instruct relevant hardware to finish by program, this program can be stored in the computer read/write memory medium, as ROM/RAM, disk, CD etc.
Fig. 4 shows the structural principle of the resolution of photographic device detection system that the embodiment of the invention provides, and for convenience of description, only shows the part relevant with the embodiment of the invention.
First
threshold computing unit 41 is used to calculate the brightness step threshold value in pure color zone, wherein, the pure color zone is chosen the pure color zone of
information receiving module 411 reception user inputs and is chosen information, mean flow
rate computing module 412 is resolved the pure color zone and is chosen the information that
information receiving module 411 receives, and calculates the mean flow rate of pixel in this pure color zone
Noise calculation module 413 draws picture noise σ according to the result of calculation of mean flow
rate computing module 412, and brightness step
threshold calculation module 414 draws the threshold value G of this pure color regional luminance gradient according to the result of calculation of mean flow
rate computing module 412 and
noise calculation module 413
Th, the operation principle of above-mentioned each module is as indicated above, is no longer given unnecessary details herein.
Surveyed area is chosen the surveyed area that information receiving unit 42 is used to receive user's input and is chosen information, this surveyed area is chosen information can comprise the information of whole line to zone and part pure color zone, also can only comprise two lines to the partial line that intercepts between the scale to area information, line is chosen the information that information receiving unit 42 receives to begin column determining unit 43 resolved detection zones, when this surveyed area is chosen information and can be comprised whole line to the zone and the information in part pure color zone, line to begin column determining unit 43 with its center line to the zone first the row coordinate as the coordinate of line to begin column, when this surveyed area is chosen information and is only comprised that the partial line that intercepts between two lines are to scale is to area information, the coordinates that line is directly gone the partial line that scans to the coordinate of the initial row in zone to start with to begin column determining unit 43.
Line is determined after the coordinate of begin column to begin column determining unit 43, trigger line critical capable determining unit 44 is carried out determining of critical row-coordinate, at first scan line is used for determining that to pixel coordinate determination module 441 current scan line needs the line the judged zone to pixel, and it utilizes the threshold value G of the pure color regional luminance gradient that first threshold computing unit 41 calculates
ThFind out zone and the removing of current scan line center line to both sides, concrete principle is no longer given unnecessary details with above described herein.Scan line is retouched the judged result of line to pixel coordinate determination module 441 to pixel contrast computing module 442 bases, current scan line center line is carried out brightness analysis to calculate outlet to pixel contrast to pixel, and concrete analysis and calculating principle are with above described.Scan line contrast judge module 443 is built-in with predefined contrast standard value, when scan line to the result of calculation of pixel contrast computing module 442 during greater than this standard value, represent that current scan line center line can be by clear identification to the pixel in zone, triggering is retouched line pixel coordinate determination module 441 is continued to determine line that the needs of next scan line the judge zone to pixel, when scan line to the result of calculation of pixel contrast computing module 442 during less than this standard value, represent that current scan line center line can not clearly be recognized the pixel in zone, trigger line is determined current scan line to critical row-coordinate determination module 444 coordinate.
Line is determined after the coordinate of critical row to critical capable determining unit 44, trigger line end line determining unit 45 is carried out determining of end line coordinate, when this surveyed area is chosen information and is only comprised that the partial line that intercepts between two lines are to scale is to area information, line to end line determining unit 45 with the partial line that scans to the coordinate of the termination row in zone as the coordinate of line to the surveyed area end line; When this surveyed area is chosen information and can be comprised whole line to the zone and the information in part pure color zone, when line comprises whole line to zone and the information in part pure color zone with line to the district to end line determining unit 45, line to end line determining unit 45 with line to the coordinate of regional final position as the coordinate of line to the surveyed area end line, judge that principle with above described, specifically repeats no more.
The coordinate of the end line that the coordinate of the critical row that the coordinate of the begin column that resolution computing unit 46 is determined begin column determining unit 43 according to line, line are determined critical capable determining unit 44 and line are determined end line determining unit 45, carry out the calculating of resolution, concrete principle repeats no more with above described herein.
Each unit (module) of above-mentioned resolution of photographic device detection system can be the unit of software unit, hardware cell or software and hardware combining, the software unit part can be stored in the computer read/write memory medium, as ROM/RAM, disk, CD etc.
In the embodiment of the invention, according to the coordinate of the figure card graphic center line of successively determining to take to the begin column in zone, critical row, end line, and then calculate resolution, can detect the resolution of camera head in the portable terminal exactly, thereby avoid because the error that subjective factor or estimation bring.
The above only is preferred embodiment of the present invention, not in order to restriction the present invention, all any modifications of being done within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.