CN109242787A - It paints in a kind of assessment of middle and primary schools' art input method - Google Patents

It paints in a kind of assessment of middle and primary schools' art input method Download PDF

Info

Publication number
CN109242787A
CN109242787A CN201810927502.7A CN201810927502A CN109242787A CN 109242787 A CN109242787 A CN 109242787A CN 201810927502 A CN201810927502 A CN 201810927502A CN 109242787 A CN109242787 A CN 109242787A
Authority
CN
China
Prior art keywords
image
picture
algorithm
paint
point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810927502.7A
Other languages
Chinese (zh)
Inventor
刘云光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Glorious Interactive Network Technology Co Ltd
Original Assignee
Nanjing Glorious Interactive Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Glorious Interactive Network Technology Co Ltd filed Critical Nanjing Glorious Interactive Network Technology Co Ltd
Priority to CN201810927502.7A priority Critical patent/CN109242787A/en
Publication of CN109242787A publication Critical patent/CN109242787A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/60Rotation of whole images or parts thereof
    • G06T3/608Rotation of whole images or parts thereof by skew deformation, e.g. two-pass or three-pass rotation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses input methods of painting in a kind of assessment of middle and primary schools' art.This method comprises: carrying out focusing shooting to paint or obtaining picture from the storage equipment such as photograph album;Picture is subjected to digitized processing;Picture is carried out include compression, noise reduction, reinforcing pretreatment;Picture digital information is analyzed, interested graph outline is found;Intelligent cutting is carried out to drawing portion, the content except drawing section is rejected, forms newest drawing picture;Reduction treatment is done to obtained drawing picture, reaches high-quality resolution rate;Drawing picture is subjected to perspective transform correction, i.e. support arbitrary deviation angle shot;Color balance processing is carried out to picture, picture is reflective or dark space for removal, restores true student work painting effect.Typing of the present invention for paint in the assessment of middle and primary schools' art, student upload paint and accurate, efficiently automatic identification drawing area and can intelligently cut, facilitate teacher and consult and score.

Description

It paints in a kind of assessment of middle and primary schools' art input method
Technical field
The present invention relates to artificial intelligence/pattern recognition technique field, record of painting in especially a kind of middle and primary schools' art assessment Enter method.
Background technique
In middle and primary schools' art assessment in the past, drawing assessment is all that the papery drawing works that art teacher submits student are collected Storage, then unified score, the defect done so are that similar file store is needed to store works, very inconvenient, Er Qiexue Life is unable to remote visiting system works.If network can be uploaded to paint, and be supplied to the fine arts by image capture device Teacher consults and scoring, it will facilitates student's submission and the collection management of teacher.But the drawing that image capture device obtains Works, inevitably exist angular deviation, background difference, it is of different sizes a series of problems, such as, how to realize to paint in image Partial intelligence is cut out and angle correct, is problem urgently to be resolved.
Patent 1 (CN201310746613) discloses a kind of image direction antidote and system, and this method passes through multiple Rotating image, rotation carries out Text region every time, how much judges whether angle is rectified according to the text of identification, and the method relies on In the precision of identification technology, and largely, rotation calculation amount is huge, and angular error is larger, and there are low efficiencys, poor accuracy Problem.
Patent 2 (CN201210461924) discloses a kind of cutting method of card scan image, and this method is related to picture The separation of foreground and background first determines whether the background type of card scan image, is selected according to different background types different Cutting logical process, to be syncopated as multiple card scan subgraphs.Obvious the method can only distinguish hue difference away from biggish black and white Color background, practical scene restriction are larger.
Summary of the invention
The purpose of the present invention is to provide input methods of painting in a kind of efficient, accurate middle and primary schools' art assessment.
The technical solution for realizing the aim of the invention is as follows: input method of painting in a kind of assessment of middle and primary schools' art, including Following steps:
Step 1, paint is taken pictures with photographing device, or obtains the image of paint from storage equipment;
Step 2, the image of paint is pre-processed, including compression of images, noise reduction, reinforcing, it then will pretreatment Image afterwards is converted to grayscale image;
Step 3, contours extract is carried out to obtained grayscale image, is then corroded using dilate expansion algorithm, is obtained The black and white profile diagram of profile connection;
Step 4, it is rejected using edge of the matrix kernel to black and white profile diagram, retains the image in target zone, so All closed contours are found afterwards and calculate the area of the minimum circumscribed rectangle of each closed contour, select the maximum closure wheel of area Exterior feature is considered as the region of paint, and largest contours are extracted;
Step 5, the straight line in largest contours is extracted with Hough Line Algorithm, judges that straight line is similar by the polar coordinates of straight line Degree, finds four straight lines that can surround largest contours area;
Step 6, the intersection point for calculating four straight lines rejects the intersection point of infinity with Distance Judgment, then carries out as follows Judgement: if remaining intersection point number is not equal to 4, recognition failures return step 1;Otherwise the area that antinode surrounds makes a decision: If area is less than setting value minArea, recognition failures return step 1;Otherwise, 4 intersection points are exported, obtain cutting profile diagram, Enter step 7;
Step 7, the image of original paint is done with cutting profile diagram and is mapped, using affine transform algorithm, to cutting Image original image vegetarian refreshments in profile diagram is cooked perspective transform correction, is carried out illumination balance to the picture after perspective transform correction, is obtained To the paint identified.
Further, the image of paint described in step 1, meets the following conditions: paint all in coverage, And reflective area accounts for the ratio of total image area lower than 40%.
Further, the image of paint is pre-processed described in step 2, wherein compression of images resolution dimensions are 300px。
Further, the image of paint is pre-processed described in step 2, wherein image noise reduction is dropped using openCV It makes an uproar algorithm, formula is using 2 dimension Gaussian functions:
Wherein, x and y respectively represents the abscissa and ordinate of image, G0(x, y) indicate noise reduction after obtain at (x, y) The smoothed out value of the pixel of position, ux,uyRespectively indicate the mean value of x, y, σxyRespectively indicate the standard deviation of x, y-axis.
Further, the image of paint is pre-processed described in step 2, wherein image intensification uses MeanShift Filter filtering algorithm, is iterated convolution algorithm to image array, constantly removes background and prospect, finally It is specific as follows to the image that can distinguish front and back scape:
The offset mean value for taking current point forms new place, mean shift formula after offset are as follows:
Image all pixels point is converted to one group of data, is arranged since first pixel in the upper left corner, x indicates xth A pixel;ShIndicate that the point centered on x, radius are the higher-dimension ball region of h;K indicates to be included in ShThe number put in range;xiTable Show and is included in ShPoint in range;M (x) indicates other pixels x in x-th of pixel, radius h enclosing regioniOffset Mean value;
MeanShift Filter is executed in the spatial domain that radius is sp for each pixel (X, Y) of input picture Filtering algorithm:
(x,y):X-sp≤x≤X+sp,Y-sp≤y≤Y+sp,||(R,G,B)-(r,g,b)||≤sr
The color value of pixel (X, Y) is (R, G, B), and the color value of its spatial neighborhood point (x, y) is (r, g, b), such as The color distance of fruit dot (x, y) to (X, Y) are less than or equal to sr, then meet condition;
The mean space coordinate (X ', Y ') and average color vector (R', G', B') for meeting condition point are acquired, and it Input as next iteration;
It then moves on, until the mobile number for reaching set then terminates, the color value use for initially entering position The color value of final iteration replaces.
Further, pair obtained grayscale image described in step 3 carries out contours extract, then using dilate expansion algorithm into Row corrosion obtains the black and white profile diagram of profile connection, specific as follows:
Contours extract is carried out to obtained grayscale image using canny operator:
Using Gaussian filter convolution noise reduction, the Gaussian kernel K of size=5 is as follows:
The difference G of grayscale image A both horizontally and vertically is calculated using edge difference operatorxAnd Gy:
Calculate gradient-norm and direction:
Gray scale map contour is extracted, using dilate expansion algorithm, 8 pixel numerical value of pixel and surrounding are pitched Multiplication amplifies edge pixel, obtains the black and white profile diagram of profile connection.
Further, the image in reservation target zone described in step 4 refers to that retaining screen center region accounts for the gross area Image in 45%~100% range.
It further, further include to image outline with ROI algorithm beyond screen after step 4 extracts largest contours The step of part is rejected.
Further, the straight line in largest contours is extracted with Hough Line Algorithm described in step 5, passes through the polar coordinates of straight line Judge straight line similarity, finds four straight lines that can surround largest contours area, specific as follows:
Hough Line Algorithm polar coordinates take straight line formula as follows:
A fixed point O, referred to as pole are taken in the plane;Go out carry out the coffin upon burial a ray Ox, referred to as polar axis from O;A fixed list is taken again Bit length is, it is specified that angle takes counter clockwise direction to be positive;
The position of any point P determines there is ordinal number pair with the length r of line segment OP and the angle, θ from Ox to OP in plane (r, θ) is known as the polar coordinates of P point, is denoted as P (r, θ);R is the polar diameter of P point, and θ is the polar angle of P point.
All straight lines are subjected to angle calcu-lation by polar coordinates formula in pairs, and included angle is saved;By angle The group that degree is less than setting value is filtered, and is then filtered the identical combined iteration of included angle, is only retained unique group of angle, It filters out 5~7 groups of straight lines and carries out secondary operation, by deletion of the angle except screen, then the straight line by distance less than setting value It deletes, if gained straight line is not equal to 4, indicates that otherwise, 4 straight lines of gained are exactly to constitute profile without constituting effective contour Four sides.
Further, affine transform algorithm is used described in step 7, and the image original image vegetarian refreshments cut in profile diagram is cooked It is corrected depending on transformation, perspective transform is specific as follows:
It is displaced, scaled by three-dimensional matrice, the conversion of angle:
Wherein, w is spread vector, and u, v are original image coordinates, and correspondence obtains transformed Picture Coordinate x, y, in which:
X=x' '/w'
Y=y' '/w'
Transformation matrix4 parts can be split as,Indicate linear transformation, [a31 a32] use In translation, [a13 a23]TGenerate perspective transform;
Transformation for mula rewrites as follows:
Final pixel location matrix [x ', y ', w '] it is known that formula above is substituted into, the pixel after obtaining perspective transform correction X, y-coordinate.
Compared with prior art, the present invention its remarkable advantage are as follows: (1) according to Principle of Affine Transformation, by four wheels of figure Mapping transformation is done on exterior feature point and four vertex of screen, and error tends to be zero, when also saving a large amount of operation using matrix calculating Between, efficiency is especially high;(2) contexts separation uses meanShift Filter filtering algorithm, not to front and back scenery tune gap Sensitivity can handle the figure ground separation of tone relatively;(3) automatic identification cutting can help student to upload whenever and wherever possible Works, and do not have to consider that shooting angle, system can intelligently cut interested region, student is easy to operate, is applied to medium and small In art of learning a craft or trade assessment, teacher is facilitated to consult and score.
Detailed description of the invention
Fig. 1 is the flow chart for the input method painted in middle and primary schools' art of the present invention assessment.
Fig. 2 be the embodiment of the present invention in take pictures gained paint original graph.
Fig. 3 is that the picture shot in the embodiment of the present invention is converted to digital information figure.
Fig. 4 is to obscure treatment effect figure after taking pictures in the embodiment of the present invention.
Fig. 5 is meanShiftFilter filtering algorithm treated effect picture in the embodiment of the present invention.
Fig. 6 is that canny algorithm process obtains picture outline effect figure in the embodiment of the present invention.
Fig. 7 is the effect picture obtained after expansion process in the embodiment of the present invention.
Fig. 8 is to retain the effect picture after graph outline in the embodiment of the present invention.
Fig. 9 is the effect picture that the unrelated figure of surrounding is rejected in the embodiment of the present invention.
Figure 10 is the effect picture after extracting the straight line information in figure in the embodiment of the present invention.
Figure 11 is that the focus of four straight lines in figure is identified figure in the embodiment of the present invention.
Figure 12 is perspective transform schematic diagram in the embodiment of the present invention.
Figure 13 is the effect picture in the embodiment of the present invention after practical perspective transform.
Specific embodiment
In conjunction with Fig. 1, input method of painting in middle and primary schools' art assessment of the present invention, comprising the following steps:
Step 1, paint is taken pictures with photographing device, or obtains the image of paint from storage equipment;
Further, the image of the paint, meets the following conditions: paint all in coverage, and Reflective area accounts for the ratio of total image area lower than 40%.
Step 2, the image of paint is pre-processed, including compression of images, noise reduction, reinforcing, it then will pretreatment Image afterwards is converted to grayscale image;
Further, described to pre-process the image of paint, wherein compression of images resolution dimensions are 300px。
Further, described to pre-process the image of paint, wherein image noise reduction is calculated using openCV noise reduction Method, formula is using 2 dimension Gaussian functions:
Wherein, x and y respectively represents the abscissa and ordinate of image, G0(x, y) indicate noise reduction after obtain at (x, y) The smoothed out value of the pixel of position, ux,uyRespectively indicate the mean value of x, y, σxyRespectively indicate the standard deviation of x, y-axis.
Further, described to pre-process the image of paint, wherein image intensification uses meanShift Filter filtering algorithm is iterated convolution algorithm to image array, constantly removes background and prospect, finally obtains before capable of distinguishing The image of background, specific as follows:
The offset mean value for taking current point forms new place, mean shift formula after offset are as follows:
Image all pixels point is converted to one group of data, is arranged since first pixel in the upper left corner, x indicates xth A pixel;ShIndicate that the point centered on x, radius are the higher-dimension ball region of h;K indicates to be included in ShThe number put in range;xiTable Show and is included in ShPoint in range;M (x) indicates other pixels x in x-th of pixel, radius h enclosing regioniOffset Mean value;
MeanShift Filter is executed in the spatial domain that radius is sp for each pixel (X, Y) of input picture Filtering algorithm:
(x,y):X-sp≤x≤X+sp,Y-sp≤y≤Y+sp,||(R,G,B)-(r,g,b)||≤sr
The color value of pixel (X, Y) is (R, G, B), and the color value of its spatial neighborhood point (x, y) is (r, g, b), such as The color distance of fruit dot (x, y) to (X, Y) are less than or equal to sr, then meet condition;
The mean space coordinate (X ', Y ') and average color vector (R', G', B') for meeting condition point are acquired, and it Input as next iteration;
It then moves on, until the mobile number for reaching set then terminates, the color value use for initially entering position The color value of final iteration replaces.
Step 3, contours extract is carried out to obtained grayscale image, is then corroded using dilate expansion algorithm, is obtained The black and white profile diagram of profile connection, specific as follows:
Contours extract is carried out to obtained grayscale image using canny operator:
Using Gaussian filter convolution noise reduction, the Gaussian kernel K of size=5 is as follows:
The difference G of grayscale image A both horizontally and vertically is calculated using edge difference operatorxAnd Gy:
Calculate gradient-norm and direction:
Gray scale map contour is extracted, using dilate expansion algorithm, 8 pixel numerical value of pixel and surrounding are pitched Multiplication amplifies edge pixel, obtains the black and white profile diagram of profile connection.
Step 4, it is rejected using edge of the matrix kernel to black and white profile diagram, retains the image in target zone, so All closed contours are found afterwards and calculate the area of the minimum circumscribed rectangle of each closed contour, select the maximum closure wheel of area Exterior feature is considered as the region of paint, and largest contours are extracted;
Further, the image retained in target zone refers to that retaining screen center region accounts for the gross area 45% Image in~100% range.
It further, further include being made to image outline beyond screen portions of ROI algorithm after largest contours being extracted The step of rejecting.
Step 5, the straight line in largest contours is extracted with Hough Line Algorithm, judges that straight line is similar by the polar coordinates of straight line Degree, finds four straight lines that can surround largest contours area, specific as follows:
Hough Line Algorithm polar coordinates take straight line formula as follows:
A fixed point O, referred to as pole are taken in the plane;Go out carry out the coffin upon burial a ray Ox, referred to as polar axis from O;A fixed list is taken again Bit length is, it is specified that angle takes counter clockwise direction to be positive;
The position of any point P determines there is ordinal number pair with the length r of line segment OP and the angle, θ from Ox to OP in plane (r, θ) is known as the polar coordinates of P point, is denoted as P (r, θ);R is the polar diameter of P point, and θ is the polar angle of P point.
All straight lines are subjected to angle calcu-lation by polar coordinates formula in pairs, and included angle is saved;By angle The group that degree is less than setting value is filtered, and is then filtered the identical combined iteration of included angle, is only retained unique group of angle, It filters out 5~7 groups of straight lines and carries out secondary operation, by deletion of the angle except screen, then the straight line by distance less than setting value It deletes, if gained straight line is not equal to 4, indicates that otherwise, 4 straight lines of gained are exactly to constitute profile without constituting effective contour Four sides.
Step 6, the intersection point for calculating four straight lines rejects the intersection point of infinity with Distance Judgment, then carries out as follows Judgement: if remaining intersection point number is not equal to 4, recognition failures return step 1;Otherwise the area that antinode surrounds makes a decision: If area is less than setting value minArea, recognition failures return step 1;Otherwise, 4 intersection points are exported, obtain cutting profile diagram, Enter step 7;
Step 7, the image of original paint is done with cutting profile diagram and is mapped, using affine transform algorithm, to cutting Image original image vegetarian refreshments in profile diagram is cooked perspective transform correction, is carried out illumination balance to the picture after perspective transform correction, is obtained To the paint identified;
Further, described to use affine transform algorithm, perspective is done to the image original image vegetarian refreshments cut in profile diagram and is become Correction is changed, perspective transform is specific as follows:
It is displaced, scaled by three-dimensional matrice, the conversion of angle:
Wherein, w is spread vector, and u, v are original image coordinates, and correspondence obtains transformed Picture Coordinate x, y, in which:
X=x' '/w'
Y=y' '/w'
Transformation matrix4 parts can be split as,Indicate linear transformation, [a31 a32] use In translation, [a13 a23]TGenerate perspective transform;
Transformation for mula rewrites as follows:
Final pixel location matrix [x ', y ', w '] it is known that formula above is substituted into, the pixel after obtaining perspective transform correction X, y-coordinate.
With reference to the accompanying drawing and specific embodiment is described in further details technical solution of the present invention.
Embodiment 1
The present embodiment has used technical field more authoritative openCV vision library as the basis of exploitation, and can Cross-platform processing figure enables the process of graphics process to operate in the mobile phone or pc computer end of ios/android system, this Treatment process and all algorithms being related to all should be the present invention by protection scope, not distinguish hardware difference.
In conjunction with Fig. 1, input method of painting in the assessment of the present embodiment middle and primary schools art, the specific steps are as follows:
A. students in middle and primary schools' paint is taken pictures with the photographing device with video camera, taking pictures, it is larger to allow angle to have Deviation can also be stored in equipment from photograph album etc. and be imported, while to guarantee paint all in coverage and without big face Product is reflective (reflective area allows 0~40%), treatment effect such as Fig. 2.
B. the figure taken pictures is subjected to digitization with the library openCV algorithm, because openCV storing data is with matrix Form stores (such as Fig. 3), such as the picture of shooting is 3264 × 2448 resolution ratio, then the data volume calculated be one 3264 × The matrix of 2448 port numbers (rgba) dimension, this data volume deals with exception slowly, so the first step is to carry out figure Compression, compression resolution dimensions are in 300px or so, and processing graph data in this way is very quick, the disadvantage is that sacrificing many precision Value, automatic cutting picture when, have some errors, and for Balance Treatment speed and effect, the ratio of compression is adjustable (be compressed in 300px is the setting balanced by the comparison largely tested in mobile device to parameter, on the mobile apparatus firmly In the case where part equipment half, can guarantee processing speed within 2 seconds, while guarantee processing after effect error it is smaller), Ke Yidong State modifies tupe.
C. image will receive illumination and the influence of environment after taking pictures, while hardware device also can be right during taking pictures Image has the consume in quality, and what is showed is exactly that noise is had on image, so second step openCV noise reduction algorithm pair Compressed figure carries out basic noise reduction.
Using 2 dimension Gaussian functions on algorithm:
Wherein, x and y respectively represents the abscissa and ordinate of image, G0(x, y) indicate noise reduction after obtain at (x, y) The smoothed out value of the pixel of position, ux,uyRespectively indicate the mean value of x, y, σxyRespectively indicate the standard deviation of x, y-axis;Processing effect Fruit is as shown in Figure 4.
D. the subtle interference element of figure is effectively filtered after noise reduction, at this time our images to be separated and background, It prepares for subsequent cutting, meanShiftFilter filtering algorithm (low-pass filtering that edge retains) is used herein, to figure Shape matrix is iterated convolution algorithm, constantly removes background and prospect, the figure of front and back scape can obviously be distinguished by finally obtaining human eye.
Algorithm principle: taking the offset mean value of current point, form new place after offset, then move on, until meeting Certain condition (in order to save performance, generally with this algorithm scanning times between 8~12 times) terminates, and deviates mean value formula:
Image all pixels point is converted to one group of data, is arranged since first pixel in the upper left corner, x indicates xth A pixel;ShIndicate that the point centered on x, radius are the higher-dimension ball region of h;K indicates to be included in ShThe number put in range;xiTable Show and is included in ShPoint in range;M (x) indicates other pixels x in x-th of pixel, radius h enclosing regioniOffset Mean value;
MeanShift Filter is executed in the spatial domain that radius is sp for each pixel (X, Y) of input picture Filtering algorithm:
(x,y):X-sp≤x≤X+sp,Y-sp≤y≤Y+sp,||(R,G,B)-(r,g,b)||≤sr
The color value of pixel (X, Y) is (R, G, B), and the color value of its spatial neighborhood point (x, y) is (r, g, b), such as The color distance of fruit dot (x, y) to (X, Y) are less than or equal to sr, then meet condition;
Finally we acquire the mean space coordinate (X ', Y ') for meeting condition point and average color vector (R', G', B'), and using them as the input of next iteration;
It then moves on, until the mobile number (8~12 times) for reaching set then terminates, initially entering position Color value is replaced with the color value of final iteration.Treatment effect is as shown in Figure 5.
E. with cvColor by graphics at grayscale image, facilitate post-processing figure, filter out excess pixel information (figure As each pixel there are tetra- numerical value of rgba, the three primary colors for constituting pixel are represented, gray proces exactly remove color value, only protect It stays octet length to save pixel data, saves later period calculation amount).
F. contours extract is done to figure with canny operator, at this time all profiles in figure, which can compare, clearly indicates In figure after the treatment.
Using Gaussian filter convolution noise reduction, here is the Gaussian kernel of size=5
Gaussian kernel carries out multiplying to each pixel in figure, and the biggish number of image pixel intermediate value is reduced, will Especially small numerical value increases, and now screens out noise data.
The difference G of grayscale image A both horizontally and vertically is calculated using edge difference operatorxAnd Gy:
The edge of image can be pointed in different directions, therefore classics Canny algorithm is counted respectively with four gradient operators Calculate horizontal, vertical and diagonal gradient.But four direction usually is calculated separately without four gradient operators.Often Edge difference operator (such as Rober, Prewitt, Sobel) calculates difference Gx and Gy both horizontally and vertically.Thus Gradient-norm and direction can be calculated as follows:
Gradient angle, θ range from radian-π to π, then it is approximate arrive four direction, respectively represent level, it is vertical and two A diagonal (0 °, 45 °, 90 °, 135 °).It can be divided with π/8 ± i (i=1,3,5,7), fall in the gradient in each region A particular value is given at angle, represents one of four direction.
Gradient magnitude and direction formula is calculated:
Wherein, G represents the final pixel point final result that gradient calculates in the horizontal and vertical directions, and θ represents convolution meter The direction of calculation can identify contour edge and reinforcement in figure by mathematical algorithm above.Treatment effect is as shown in Figure 6.
G. for all outline closes area of profile (facilitate calculate) allowed in figure, we are calculated using dilate expansion Method erodes figure, and the profile of such figure relatively levels off to closure.
Using corrosion opening operation method, 8 pixel numerical value of pixel and surrounding are subjected to multiplication cross operation, by edge pixel " amplification " makes image outline " connection ", as shown in Figure 7.
H. we have obtained the black and white profile diagram of figure at present, but the profile of all elements can all be shown in shooting process In the graphic.This stage is rejected (convolution operation of matrix) using edge of the matrix kernel to former pattern matrix, is retained (present invention assumes that pupil drawing region is with centre of figure point position, area is greater than figure in a certain range of screen center region Image planes product 45%~100%) figure (it is considered that the focus for the drawing taken pictures should be in center range of screen).
I. all closed contours are found using openCV/findContours lookup gray scale map contour algorithm and used ApproxPolyDP calculates the area that contour area algorithm calculates the minimum circumscribed rectangle of profile, will be in image by iterative algorithm All contour areas calculate and compare, find the maximum profile of area, be considered as drawing area, and largest contours are extracted Out.
Profile calculates maximum area formula:
AreaBoundN=widthN*heightN
WidthN is the width of figure maximum rectangular profile, and heightN is the height of figure maximum rectangular profile, AreaBoundN is the area of this rectangle.
Max (AreaBound1, AreaBound2 ... ..., AreaBoundN)
Above-mentioned is program pseudo-code, indicates for the contoured area of institute to be maximized, treatment effect is as shown in Figure 8.
J. graph outline is rejected with ROI algorithm beyond screen portions, guarantees that the picture drawing area of shooting permits in this way Perhaps sub-fraction beyond screen also can intelligent recognition come out.Treatment effect is as shown in Figure 9.
K. the straight line in profile is found out and (there may be up to a hundred) with Hough Line Algorithm, pass through the polar coordinates to straight line Judge straight line similarity, find four straight lines that can surround largest contours area, basic principle is that all straight lines are passed through pole Coordinate formula carries out the calculating of angle two-by-two, and included angle is saved, and the combination of two of these angle very littles is filtered (almost parallel), retells the close group Iterative filtering of angle, only retains the substantially unique group of angle, can filter out at least 5 in this way It to 6 groups of straight lines, retells this 5,6 groups of straight lines and carries out secondary operation, (profile can not be in screen by deletion of the angle except screen Outside), then by apart from close straight line deletion, if straight line is less than 4 after filtering, illustrate without constituting effective contour, otherwise, this Four straight lines are exactly four sides for constituting profile.
Hough Line Algorithm polar coordinates take straight line formula:
Polar coordinate system (polar coordinates) refers to the coordinate system being planar made of pole, polar axis and polar diameter. A fixed point O, referred to as pole are taken in the plane.Go out carry out the coffin upon burial a ray Ox, referred to as polar axis from O.A fixed unit length is taken again, is led to Normal predetermined angular, which takes, to be counterclockwise positive.In this way, in plane any point P position with the length r of line segment OP and from Ox to The angle, θ of OP determines have ordinal number to be known as the polar coordinates of P point to (r, θ), is denoted as P (r, θ);R is the polar diameter of P point, and θ is P point Polar angle.Treatment effect is as shown in Figure 10.
L. the intersection point of four straight lines is taken out into (usually there are 6 intersection points), two rejected outside screen with Distance Judgment are infinite Remote intersection point, remaining 4 intersection points are then four angles of composition profile, meanwhile, the rectangular area surrounded to four angles makes a decision, such as (one minimal face product value of design, mentioning interest region above should entirely scheme by fruit intersection point number>4 or area<minArea More than half of piece size, it is 0.5* picture size that minArea, which is arranged, in half, and intersection point number, which is greater than 4, can just surround a rectangle, Otherwise effective profile cannot be constituted), then judge recognition failures, otherwise exports four intersection points.Treatment effect is as shown in figure 11.
M. there are four intersection points, with affine transform algorithm to four intersection points and the screen upper left corner, the lower left corner, the lower right corner, the right side Do perspective transform correction in upper angle.The original image taken pictures is done with compressed picture before transformation and is mapped, by original high-resolution The picture pixels point of rate is done perspective and is calculated, and finally obtains a high-resolution automatic cutting picture and corrects.
In conjunction with Figure 12, perspective transform principle:
It is displaced, scaled by three-dimensional matrice, the conversion of angle
Wherein, w is spread vector, and u, v are original image coordinates, and correspondence obtains transformed Picture Coordinate x, y, in which:
X=x'/w'
Y=y'/w'
Transformation matrix4 parts can be split as,Indicate linear transformation, [a31 a32] use In translation, [a13 a23]TGenerate perspective transform;
Transformation for mula rewrites as follows:
Because transformed figure is to maintain ratio, and fills mobile phone screen, so figure final pixel position square Battle array ([x ', y ', w ']) determine very well, substitute into formula above, pixel x, y-coordinate after obtaining perspective transform correction rectify figure Just.Treatment effect is as shown in figure 13.
N. final step does illumination balance to picture, with openCV filtering method by picture bloom part and darkness Region is filtered, and picture each section region details can clearly be shown.
The method that the present invention uses automatic identification to cut can help student to upload works whenever and wherever possible, and not have to examine Consider shooting angle, intelligence cuts interested region, and student is easy to operate, and it is convenient that teacher collects works.In addition, this system later period It can be applied to examination scene, with capture apparatus such as scanner or high photographing instruments, the exam information of student and works identified And typing, teacher only need in computer unified marking, do not need to do other with picture handling implement manually professional Modification, application prospect are extensive.

Claims (10)

1. input method of painting in a kind of middle and primary schools' art assessment, which comprises the following steps:
Step 1, paint is taken pictures with photographing device, or obtains the image of paint from storage equipment;
Step 2, the image of paint is pre-processed, including compression of images, noise reduction, reinforcing, it then will be pretreated Image is converted to grayscale image;
Step 3, contours extract is carried out to obtained grayscale image, is then corroded using dilate expansion algorithm, obtains profile The black and white profile diagram of connection;
Step 4, it is rejected using edge of the matrix kernel to black and white profile diagram, retains the image in target zone, then look for To all closed contours and calculate each closed contour minimum circumscribed rectangle area, select area maximum closed contour view For the region of paint, and largest contours are extracted;
Step 5, the straight line in largest contours is extracted with Hough Line Algorithm, judges straight line similarity by the polar coordinates of straight line, Find four straight lines that can surround largest contours area;
Step 6, the intersection point for calculating four straight lines is rejected the intersection point of infinity with Distance Judgment, is then made the following judgment: If remaining intersection point number is not equal to 4, recognition failures return step 1;Otherwise the area that antinode surrounds makes a decision: if area Less than setting value minArea, then recognition failures return step 1;Otherwise, 4 intersection points are exported, obtain cutting profile diagram, into step Rapid 7;
Step 7, the image of original paint is done with cutting profile diagram and is mapped, using affine transform algorithm, to cutting profile Image original image vegetarian refreshments in figure is cooked perspective transform correction, is carried out illumination balance to the picture after perspective transform correction, is known Not Chu paint.
2. input method of painting in middle and primary schools' art assessment according to claim 1, which is characterized in that drawn described in step 1 The image of paintings product, meets the following conditions: paint is all in coverage, and reflective area accounts for the ratio of total image area Example is lower than 40%.
3. input method of painting in middle and primary schools' art assessment according to claim 1 or 2, which is characterized in that described in step 2 The image of paint is pre-processed, wherein compression of images resolution dimensions are 300px.
4. input method of painting in middle and primary schools' art assessment according to claim 1 or 2, which is characterized in that described in step 2 The image of paint is pre-processed, wherein image noise reduction uses openCV noise reduction algorithm, and formula is using 2 dimension Gaussian functions Number:
Wherein, x and y respectively represents the abscissa and ordinate of image, G0(x, y) indicate to obtain after noise reduction in the position (x, y) The smoothed out value of pixel, ux,uyRespectively indicate the mean value of x, y, σxyRespectively indicate the standard deviation of x, y-axis.
5. input method of painting in middle and primary schools' art assessment according to claim 4, which is characterized in that will described in step 2 The image of paint is pre-processed, and wherein image intensification uses meanShift Filter filtering algorithm, to image array It is iterated convolution algorithm, constantly removes background and prospect, finally obtains the image that can distinguish front and back scape, specific as follows:
The offset mean value for taking current point forms new place, mean shift formula after offset are as follows:
Image all pixels point is converted to one group of data, is arranged since first pixel in the upper left corner, x indicates x-th of picture Element;ShIndicate that the point centered on x, radius are the higher-dimension ball region of h;K indicates to be included in ShThe number put in range;xiIndicate packet It is contained in ShPoint in range;M (x) indicates other pixels x in x-th of pixel, radius h enclosing regioniOffset it is equal Value;
MeanShift Filter filtering is executed in the spatial domain that radius is sp for each pixel (X, Y) of input picture Algorithm:
(x,y):X-sp≤x≤X+sp,Y-sp≤y≤Y+sp,||(R,G,B)-(r,g,b)||≤sr
The color value of pixel (X, Y) is (R, G, B), and the color value of its spatial neighborhood point (x, y) is (r, g, b), such as fruit dot The color distance of (x, y) to (X, Y) is less than or equal to sr, then meets condition;
The mean space coordinate (X ', Y ') and average color vector (R', G', B') for meeting condition point are acquired, and they are made For the input of next iteration;
It then moves on, the mobile number set by reaching then terminates, and the color value for initially entering position is used final The color value of iteration replaces.
6. input method of painting in middle and primary schools' art assessment according to claim 4, which is characterized in that right described in step 3 Obtained grayscale image carries out contours extract, is then corroded using dilate expansion algorithm, and the black and white wheel of profile connection is obtained Exterior feature figure, specific as follows:
Contours extract is carried out to obtained grayscale image using canny operator:
Using Gaussian filter convolution noise reduction, the Gaussian kernel K of size=5 is as follows:
The difference G of grayscale image A both horizontally and vertically is calculated using edge difference operatorxAnd Gy:
Calculate gradient-norm and direction:
Gray scale map contour is extracted, using dilate expansion algorithm, 8 pixel numerical value of pixel and surrounding are subjected to multiplication cross fortune It calculates, edge pixel is amplified, obtain the black and white profile diagram of profile connection.
7. input method of according to claim 1, painting in the assessment of middle and primary schools' art described in 2,5 or 6, which is characterized in that step 4 Image in the reservation target zone refers to and retains the figure that screen center region accounts in 45%~100% range of the gross area Picture.
8. input method of according to claim 1, painting in the assessment of middle and primary schools' art described in 2,5 or 6, which is characterized in that step 4 After largest contours are extracted, further include the steps that rejecting image outline beyond screen portions with ROI algorithm.
9. input method of according to claim 1, painting in the assessment of middle and primary schools' art described in 2,5 or 6, which is characterized in that step 5 The straight line extracted in largest contours with Hough Line Algorithm, judges straight line similarity by the polar coordinates of straight line, finds energy Four straight lines of largest contours area are surrounded, specific as follows:
Hough Line Algorithm polar coordinates take straight line formula as follows:
A fixed point O, referred to as pole are taken in the plane;Go out carry out the coffin upon burial a ray Ox, referred to as polar axis from O;Take a fixed unit long again Degree is, it is specified that angle takes counter clockwise direction to be positive;
The position of any point P is determined with the length r of line segment OP and the angle, θ from Ox to OP in plane, has ordinal number to (r, θ) The polar coordinates of P point are known as, P (r, θ) is denoted as;R is the polar diameter of P point, and θ is the polar angle of P point;
All straight lines are subjected to angle calcu-lation by polar coordinates formula in pairs, and included angle is saved;Angle is small It is filtered in the group of setting value, then filters the identical combined iteration of included angle, only retain unique group of angle, screening 5~7 groups of straight lines carry out secondary operation out, delete by deletion of the angle except screen, then by the straight line that distance is less than setting value, If gained straight line is not equal to 4, indicate that otherwise, 4 straight lines of gained are exactly four for constituting profile without constituting effective contour Side.
10. input method of according to claim 1, painting in the assessment of middle and primary schools' art described in 2,5 or 6, which is characterized in that step 7 is described using affine transform algorithm, does perspective transform correction, perspective transform tool to the image original image vegetarian refreshments cut in profile diagram Body is as follows:
It is displaced, scaled by three-dimensional matrice, the conversion of angle:
Wherein, w is spread vector, and u, v are original image coordinates, and correspondence obtains transformed Picture Coordinate x, y, in which:
X=x'/w'
Y=y'/w'
Transformation matrix4 parts can be split as,Indicate linear transformation, [a31 a32] for putting down It moves, [a13 a23]TGenerate perspective transform;
Transformation for mula rewrites as follows:
Final pixel location matrix [x ', y ', w '] it is known that substituting into formula above, pixel x, y after obtaining perspective transform correction is sat Mark.
CN201810927502.7A 2018-08-15 2018-08-15 It paints in a kind of assessment of middle and primary schools' art input method Pending CN109242787A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810927502.7A CN109242787A (en) 2018-08-15 2018-08-15 It paints in a kind of assessment of middle and primary schools' art input method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810927502.7A CN109242787A (en) 2018-08-15 2018-08-15 It paints in a kind of assessment of middle and primary schools' art input method

Publications (1)

Publication Number Publication Date
CN109242787A true CN109242787A (en) 2019-01-18

Family

ID=65070692

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810927502.7A Pending CN109242787A (en) 2018-08-15 2018-08-15 It paints in a kind of assessment of middle and primary schools' art input method

Country Status (1)

Country Link
CN (1) CN109242787A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109725792A (en) * 2019-02-25 2019-05-07 广东智媒云图科技股份有限公司 A kind of drawing method based on question and answer interaction
CN109981987A (en) * 2019-04-01 2019-07-05 上海卓繁信息技术股份有限公司 A kind of unattended government affairs handle the high photographing instrument and its image processing method of system
WO2020192212A1 (en) * 2019-03-25 2020-10-01 上海幻电信息科技有限公司 Picture processing method, picture set processing method, computer device, and storage medium
CN112507914A (en) * 2020-12-15 2021-03-16 江苏国光信息产业股份有限公司 OCR (optical character recognition) method and recognition system based on bankbook and bill characters
CN113793394A (en) * 2021-08-18 2021-12-14 北京艺旗网络科技有限公司 Method and device for analyzing art and teaching works
CN114878572A (en) * 2022-07-07 2022-08-09 常州市建筑科学研究院集团股份有限公司 Method and equipment for rapidly detecting bonding area ratio of heat-insulating material and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108305291A (en) * 2018-01-08 2018-07-20 武汉大学 Utilize the monocular vision positioning and orientation method of the wall advertisement comprising positioning Quick Response Code
CN108345881A (en) * 2018-02-01 2018-07-31 福州大学 A kind of document quality detection method based on computer vision

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108305291A (en) * 2018-01-08 2018-07-20 武汉大学 Utilize the monocular vision positioning and orientation method of the wall advertisement comprising positioning Quick Response Code
CN108345881A (en) * 2018-02-01 2018-07-31 福州大学 A kind of document quality detection method based on computer vision

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
梁佳楠等: ""基于图像处理的位置坐标获取方法应用"", 《自动化与信息工程》 *
罗四维等: "《计算机视觉检测逆问题导论》", 31 March 2017, 北京交通大学出版社 *
罗庆生等: "《智能作战机器人》", 30 November 2013, 北京理工大学出版社 *
陆超等: ""智能限高杆提醒系统设计"", 《电子元器件与信息技术》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109725792A (en) * 2019-02-25 2019-05-07 广东智媒云图科技股份有限公司 A kind of drawing method based on question and answer interaction
CN109725792B (en) * 2019-02-25 2020-10-16 广东智媒云图科技股份有限公司 Question-answer interaction-based drawing method
WO2020192212A1 (en) * 2019-03-25 2020-10-01 上海幻电信息科技有限公司 Picture processing method, picture set processing method, computer device, and storage medium
US12045946B2 (en) 2019-03-25 2024-07-23 Shanghai Hode Information Technology Co., Ltd. Rotating and cropping images for various forms of media including animation, comics, film, or television
CN109981987A (en) * 2019-04-01 2019-07-05 上海卓繁信息技术股份有限公司 A kind of unattended government affairs handle the high photographing instrument and its image processing method of system
CN112507914A (en) * 2020-12-15 2021-03-16 江苏国光信息产业股份有限公司 OCR (optical character recognition) method and recognition system based on bankbook and bill characters
CN113793394A (en) * 2021-08-18 2021-12-14 北京艺旗网络科技有限公司 Method and device for analyzing art and teaching works
CN114878572A (en) * 2022-07-07 2022-08-09 常州市建筑科学研究院集团股份有限公司 Method and equipment for rapidly detecting bonding area ratio of heat-insulating material and storage medium

Similar Documents

Publication Publication Date Title
CN109242787A (en) It paints in a kind of assessment of middle and primary schools&#39; art input method
RU2680765C1 (en) Automated determination and cutting of non-singular contour of a picture on an image
CN110363116B (en) Irregular human face correction method, system and medium based on GLD-GAN
JP4868530B2 (en) Image recognition device
CN109948566B (en) Double-flow face anti-fraud detection method based on weight fusion and feature selection
CN110473221B (en) Automatic target object scanning system and method
CN113012234B (en) High-precision camera calibration method based on plane transformation
CN108564092A (en) Sunflower disease recognition method based on SIFT feature extraction algorithm
CN111259891B (en) Method, device, equipment and medium for identifying identity card in natural scene
WO2022179549A1 (en) Calibration method and apparatus, computer device, and storage medium
CN115908774B (en) Quality detection method and device for deformed materials based on machine vision
CN112488207A (en) High-similarity part visual identification method and system based on simulation image
CN111861866A (en) Panoramic reconstruction method for substation equipment inspection image
CN110827375B (en) Infrared image true color coloring method and system based on low-light-level image
CN113506275B (en) Urban image processing method based on panorama
CN116342519A (en) Image processing method based on machine learning
CN116740135A (en) Infrared dim target tracking method and device, electronic equipment and storage medium
CN111553927A (en) Checkerboard corner detection method, checkerboard corner detection system, computer device and storage medium
CN117496019B (en) Image animation processing method and system for driving static image
CN110440792A (en) Navigation information extracting method based on small feature loss degree of irregularity
CN106997583A (en) A kind of underwater robot adaptive image enhancement and feature extracting method
CN109359652A (en) A method of the fast automatic extraction rectangular scanning part from digital photograph
CN111667429A (en) Target positioning and correcting method for inspection robot
CN116228864A (en) Chest ring target bullet hole ring number reading method based on visual detection
CN116071323A (en) Rain intensity measuring method based on camera parameter normalization

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190118