CN105046260A - Image pre-processing method and apparatus - Google Patents

Image pre-processing method and apparatus Download PDF

Info

Publication number
CN105046260A
CN105046260A CN201510463446.2A CN201510463446A CN105046260A CN 105046260 A CN105046260 A CN 105046260A CN 201510463446 A CN201510463446 A CN 201510463446A CN 105046260 A CN105046260 A CN 105046260A
Authority
CN
China
Prior art keywords
image
gray
pixel
border
region
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.)
Granted
Application number
CN201510463446.2A
Other languages
Chinese (zh)
Other versions
CN105046260B (en
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.)
Beijing Xiaomi Technology Co Ltd
Xiaomi Inc
Original Assignee
Xiaomi Inc
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 Xiaomi Inc filed Critical Xiaomi Inc
Priority to CN201510463446.2A priority Critical patent/CN105046260B/en
Publication of CN105046260A publication Critical patent/CN105046260A/en
Application granted granted Critical
Publication of CN105046260B publication Critical patent/CN105046260B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

The present invention relates to an image pre-processing method and apparatus, and belongs to the field of image processing. The method comprises: based on a to-be-processed image, determining a binary image of an image region where each boundary of a card is; with regard to each boundary, acquiring a plurality of line segments from the binary image of the image region where the boundary is, wherein each of the line segments is composed of a plurality of pixel points with gray values being first numerical values; and based on the line segments, pre-processing the binary image of the image region where each boundary is. According to the embodiments of the present invention, the image pre-processing method and apparatus are used for further processing the binary image of the image region where each boundary is and filtering away certain edge burrs, so as to more clearly highlight the boundaries of the card and improve the image pre-processing effect.

Description

Image pre-processing method and device
Technical field
The disclosure relates to image processing field, particularly relates to a kind of image pre-processing method and device.
Background technology
Along with the fast development of technology, there is more and more terminal with image processing function, and when carrying out image procossing by these terminals, most important application identifies the card in image, this card can be credit card, phonecard, game card etc.But by the image that obtains of shooting card, usually not only comprise card, further comprises some backgrounds, therefore, in order to the card in recognition image, often need to carry out pre-service to this image, to determine the border of card, therefore, a kind of image pre-processing method is needed badly.
Summary of the invention
For overcoming Problems existing in correlation technique, the disclosure provides a kind of image pre-processing method and device.
According to the first aspect of disclosure embodiment, provide a kind of image pre-processing method, described method comprises:
Based on pending image, determine the bianry image of each place, border image-region of card;
For each border described, from the bianry image of place, described border image-region, obtain many line segments, the pixel that described many line segments are the first numerical value by multiple gray-scale value is respectively formed;
Based on described many line segments, pre-service is carried out to the bianry image of place, described border image-region.
In conjunction with first aspect, in the first possible implementation of above-mentioned first aspect, described based on pending image, determine the bianry image of each place, border image-region of card, comprising:
Described pending image is converted to gray-scale map;
From described gray-scale map, determine the image-region at each place, border of described card;
For each border described, based on described border institute pixel in the image area, the image-region at place, described border is carried out self-adaption binaryzation process, obtain the bianry image of place, described border image-region.
In conjunction with the first possible implementation of first aspect, in the implementation that the second of above-mentioned first aspect is possible, described based on described border institute pixel in the image area, the image-region at place, described border is carried out self-adaption binaryzation process, obtain the bianry image of place, described border image-region, comprising:
For described border institute each pixel in the image area, obtain described pixel neighborhood of a point;
Based on the gray-scale value of pixel in described neighborhood, determine the first gray threshold;
When the gray-scale value of described pixel is more than or equal to described first gray threshold, the gray-scale value of described pixel is set to the first numerical value;
When the gray-scale value of described pixel is less than described first gray threshold, the gray-scale value of described pixel is set to second value.
In conjunction with the implementation that the second of first aspect is possible, in the third possible implementation of above-mentioned first aspect, after the described pixel neighborhood of a point of described acquisition, also comprise:
Determine the first ratio and the second ratio, described first ratio is the ratio of pixel number shared by total number that in described neighborhood, gray-scale value is greater than the second gray threshold, described second ratio is the ratio of pixel number shared by described total number that in described neighborhood, gray-scale value is less than the 3rd gray threshold, and described total number is the number of all pixels in described neighborhood;
When described first ratio and described second ratio are all less than proportion threshold value, perform the described gray-scale value based on pixel in described neighborhood, determine the step of the first gray threshold.
In conjunction with the third possible implementation of first aspect, in the 4th kind of possible implementation of above-mentioned first aspect, described determine the first ratio and the second ratio after, also comprise:
When described first ratio is more than or equal to described proportion threshold value, the gray-scale value of described pixel is set to described first numerical value;
When described second ratio is more than or equal to described proportion threshold value, the gray-scale value of described pixel is set to described second value.
In conjunction with first aspect, in the 5th kind of possible implementation of above-mentioned first aspect, described from the bianry image of place, described border image-region, obtain many line segments, comprising:
The long limit judging the bianry image of place, described border image-region whether with horizontal direction parallel;
When the long limit of the bianry image of place, described border image-region and horizontal direction not parallel time, the bianry image of place, described border image-region is rotated, makes long limit and the horizontal direction parallel of the bianry image of place, described border image-region;
From the often row pixel that postrotational bianry image comprises, obtain the pixel that the multiple gray-scale value of continuous print is described first numerical value respectively;
The line segment that the multiple pixels obtained respectively from described often row pixel are formed is defined as described many line segments.
In conjunction with first aspect, in the 6th kind of possible implementation of above-mentioned first aspect, described based on described many line segments, pre-service is carried out to the bianry image of place, described border image-region, comprising:
For bar line segment every in described many line segments, determine the angle between described line segment and horizontal direction;
When described angle is less than or equal to specified angle threshold value, determine the line segment length of described line segment;
When described line segment length is less than designated length threshold value, the gray-scale value of the multiple pixels forming described line segment is set to second value.
In conjunction with the 6th kind of possible implementation of first aspect, in the 7th kind of possible implementation of above-mentioned first aspect, described when described line segment length is less than designated length threshold value, after the gray-scale value of the multiple pixels forming described line segment is set to second value, also comprise:
From the bianry image of place, described border image-region, determine multiple image connectivity territory, the connected region that the pixel that described image connectivity territory is described first numerical value by gray-scale value is formed;
For each image connectivity territory in described multiple image connectivity territory, determine the statistical parameter in described image connectivity territory, described statistical parameter is area or width;
When described statistical parameter is more than or equal to the first parameter threshold, or when described statistical parameter is less than or equal to the second parameter threshold, the gray-scale value of pixel in described image connectivity territory is set to described second value, and described first parameter threshold is greater than described second parameter threshold.
In conjunction with the 6th kind of possible implementation of first aspect, in the 8th kind of possible implementation of above-mentioned first aspect, described method also comprises:
When described angle is greater than described specified angle threshold value, display reminding information, obtains described pending image again to point out user.
According to the second aspect of disclosure embodiment, provide a kind of image preprocess apparatus, described device comprises:
Determination module, for based on pending image, determines the bianry image of each place, border image-region of card;
Acquisition module, for for each border described, from the bianry image of place, described border image-region, obtain many line segments, the pixel that described many line segments are the first numerical value by multiple gray-scale value is respectively formed;
Pretreatment module, for based on described many line segments, carries out pre-service to the bianry image of place, described border image-region.
In conjunction with second aspect, in the first possible implementation of above-mentioned second aspect, described determination module comprises:
Converting unit, for being converted to gray-scale map by described pending image;
First determining unit, for from described gray-scale map, determines the image-region at each place, border of described card;
Binary conversion treatment unit, for for each border described, based on described border institute pixel in the image area, carries out self-adaption binaryzation process, obtains the bianry image of place, described border image-region by the image-region at place, described border.
In conjunction with the first possible implementation of second aspect, in the implementation that the second of above-mentioned second aspect is possible, described binary conversion treatment unit comprises:
Obtain subelement, for for described border institute each pixel in the image area, obtain described pixel neighborhood of a point;
First determines subelement, for the gray-scale value based on pixel in described neighborhood, determines the first gray threshold;
First arranges subelement, for when the gray-scale value of described pixel is more than or equal to described first gray threshold, the gray-scale value of described pixel is set to the first numerical value;
Second arranges subelement, for when the gray-scale value of described pixel is less than described first gray threshold, the gray-scale value of described pixel is set to second value.
In conjunction with the implementation that the second of second aspect is possible, in the third possible implementation of above-mentioned second aspect, described binary conversion treatment unit also comprises:
Second determines subelement, for determining the first ratio and the second ratio, described first ratio is the ratio of pixel number shared by total number that in described neighborhood, gray-scale value is greater than the second gray threshold, described second ratio is the ratio of pixel number shared by described total number that in described neighborhood, gray-scale value is less than the 3rd gray threshold, and described total number is the number of all pixels in described neighborhood;
Perform subelement, for when described first ratio and described second ratio are all less than proportion threshold value, perform the described gray-scale value based on pixel in described neighborhood, determine the step of the first gray threshold.
In conjunction with the third possible implementation of second aspect, in the 4th kind of possible implementation of above-mentioned second aspect, described binary conversion treatment unit also comprises:
3rd arranges subelement, for when described first ratio is more than or equal to described proportion threshold value, the gray-scale value of described pixel is set to described first numerical value;
4th arranges subelement, for when described second ratio is more than or equal to described proportion threshold value, the gray-scale value of described pixel is set to described second value.
In conjunction with second aspect, in the 5th kind of possible implementation of above-mentioned second aspect, described acquisition module comprises:
Judging unit, for judge the bianry image of place, described border image-region long limit whether with horizontal direction parallel;
Rotary unit, for the long limit of the bianry image when place, described border image-region and horizontal direction not parallel time, the bianry image of place, described border image-region is rotated, makes long limit and the horizontal direction parallel of the bianry image of place, described border image-region;
Acquiring unit, in the often row pixel that comprises from postrotational bianry image, obtains the pixel that the multiple gray-scale value of continuous print is described first numerical value respectively;
Second determining unit, is defined as described many line segments for the line segment formed by the multiple pixels obtained respectively from described often row pixel.
In conjunction with second aspect, in the 6th kind of possible implementation of above-mentioned second aspect, described pretreatment module comprises:
3rd determining unit, for for bar line segment every in described many line segments, determines the angle between described line segment and horizontal direction;
4th determining unit, for when described angle is less than or equal to specified angle threshold value, determines the line segment length of described line segment;
First setting unit, for when described line segment length is less than designated length threshold value, is set to second value by the gray-scale value of the multiple pixels forming described line segment.
In conjunction with the 6th kind of possible implementation of second aspect, in the 7th kind of possible implementation of above-mentioned second aspect, described pretreatment module also comprises:
5th determining unit, in the bianry image from place, described border image-region, determines multiple image connectivity territory, the connected region that the pixel that described image connectivity territory is described first numerical value by gray-scale value is formed;
6th determining unit, for for each image connectivity territory in described multiple image connectivity territory, determine the statistical parameter in described image connectivity territory, described statistical parameter is area or width;
Second setting unit, for being more than or equal to the first parameter threshold when described statistical parameter, or when described statistical parameter is less than or equal to the second parameter threshold, the gray-scale value of pixel in described image connectivity territory is set to described second value, and described first parameter threshold is greater than described second parameter threshold.
In conjunction with the 6th kind of possible implementation of second aspect, in the 8th kind of possible implementation of above-mentioned second aspect, described device also comprises:
Display module, for when described angle is greater than described specified angle threshold value, display reminding information, obtains described pending image again to point out user.
According to the third aspect of disclosure embodiment, provide a kind of image preprocess apparatus, described device comprises:
Processor;
For the storer of storage of processor executable instruction;
Wherein, described processor is configured to:
Based on pending image, determine the bianry image of each place, border image-region of card;
For each border described, from the bianry image of place, described border image-region, obtain many line segments, the pixel that described many line segments are the first numerical value by multiple gray-scale value is respectively formed;
Based on described many line segments, pre-service is carried out to the bianry image of place, described border image-region.
The technical scheme that embodiment of the present disclosure provides can comprise following beneficial effect: in the disclosed embodiments, based on pending image, determine the bianry image of each place, border image-region of card, because in the bianry image determined, the gray-scale value of pixel is the first numerical value or second value, and from the bianry image of each place, border image-region, many the line segments that the pixel that to obtain by multiple gray-scale value be respectively the first numerical value is formed, by these many line segments, can process further the bianry image of each place, border image-region, thus some burrs on edges on each border of filtering card, highlight the border of card more clearly, improve the effect of Image semantic classification.
Should be understood that, it is only exemplary and explanatory that above general description and details hereinafter describe, and can not limit the disclosure.
Accompanying drawing explanation
Accompanying drawing to be herein merged in instructions and to form the part of this instructions, shows embodiment according to the invention, and is used from instructions one and explains principle of the present invention.
Fig. 1 is the process flow diagram of a kind of image pre-processing method according to an exemplary embodiment.
Fig. 2 is the process flow diagram of the another kind of image pre-processing method according to an exemplary embodiment.
Fig. 3 is each place, border image-region schematic diagram of a kind of card according to an exemplary embodiment.
Fig. 4 is a kind of pixel neighborhood of a point schematic diagram according to an exemplary embodiment.
Fig. 5 is the schematic diagram of a kind of bianry image according to an exemplary embodiment.
Fig. 6 is the schematic diagram of a kind of pretreated bianry image according to an exemplary embodiment.
Fig. 7 is a kind of image preprocess apparatus block diagram according to an exemplary embodiment.
Fig. 8 is the block diagram of a kind of determination module according to an exemplary embodiment.
Fig. 9 is the block diagram of a kind of binary conversion treatment unit according to an exemplary embodiment.
Figure 10 is the block diagram of the another kind of binary conversion treatment unit according to an exemplary embodiment.
Figure 11 is the block diagram of another the binary conversion treatment unit according to an exemplary embodiment.
Figure 12 is the block diagram of a kind of acquisition module according to an exemplary embodiment.
Figure 13 is the block diagram of a kind of pretreatment module according to an exemplary embodiment.
Figure 14 is the block diagram of the another kind of pretreatment module according to an exemplary embodiment.
Figure 15 is the block diagram of a kind of image preprocess apparatus according to an exemplary embodiment.
Embodiment
Here will be described exemplary embodiment in detail, its sample table shows in the accompanying drawings.When description below relates to accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawing represents same or analogous key element.Embodiment described in following exemplary embodiment does not represent all embodiments consistent with the present invention.On the contrary, they only with as in appended claims describe in detail, the example of apparatus and method that aspects more of the present invention are consistent.
Fig. 1 is the process flow diagram of a kind of image pre-processing method according to an exemplary embodiment, and as shown in Figure 1, this image pre-processing method is used for, in terminal, comprising the following steps.
In a step 101, based on pending image, determine the bianry image of each place, border image-region of card.
In a step 102, for each border of this card, from the bianry image of this place, border image-region, obtain many line segments, the pixel that these many line segments are the first numerical value by multiple gray-scale value is respectively formed.
In step 103, based on these many line segments, pre-service is carried out to the bianry image of this place, border image-region.
In the disclosed embodiments, based on pending image, determine the bianry image of each place, border image-region of card, because in the bianry image determined, the gray-scale value of pixel is the first numerical value or second value, and from the bianry image of each place, border image-region, many the line segments that the pixel that to obtain by multiple gray-scale value be respectively the first numerical value is formed, by these many line segments, can process further the bianry image of each place, border image-region, thus some burrs on edges on each border of filtering card, highlight the border of card more clearly, improve the effect of Image semantic classification.
In another embodiment of the present disclosure, based on pending image, determine the bianry image of each place, border image-region of card, comprising:
Pending image is converted to gray-scale map;
From this gray-scale map, determine the image-region at each place, border of this card;
For each border of this card, based on this border institute pixel in the image area, the image-region at this place, border is carried out self-adaption binaryzation process, obtain the bianry image of this place, border image-region.
In another embodiment of the present disclosure, based on this border institute pixel in the image area, the image-region at this place, border is carried out self-adaption binaryzation process, obtains the bianry image of this place, border image-region, comprising:
For this border institute each pixel in the image area, obtain this pixel neighborhood of a point;
Based on the gray-scale value of pixel in this neighborhood, determine the first gray threshold;
When the gray-scale value of this pixel is more than or equal to the first gray threshold, the gray-scale value of this pixel is set to the first numerical value;
When the gray-scale value of this pixel is less than the first gray threshold, the gray-scale value of this pixel is set to second value.
In another embodiment of the present disclosure, after obtaining this pixel neighborhood of a point, also comprise:
Determine the first ratio and the second ratio, first ratio is the ratio of pixel number shared by total number that in this neighborhood, gray-scale value is greater than the second gray threshold, second ratio is the ratio of pixel number shared by total number that in this neighborhood, gray-scale value is less than the 3rd gray threshold, and this total number is the number of all pixels in this neighborhood;
When the first ratio and the second ratio are all less than proportion threshold value, perform the gray-scale value based on pixel in this neighborhood, determine the step of the first gray threshold.
In another embodiment of the present disclosure, after determining the first ratio and the second ratio, also comprise:
When the first ratio is more than or equal to this proportion threshold value, the gray-scale value of this pixel is set to the first numerical value;
When the second ratio is more than or equal to this proportion threshold value, the gray-scale value of this pixel is set to second value.
In another embodiment of the present disclosure, from the bianry image of this place, border image-region, obtain many line segments, comprising:
The long limit judging the bianry image of this place, border image-region whether with horizontal direction parallel;
When the long limit of the bianry image of this place, border image-region and horizontal direction not parallel time, the bianry image of this place, border image-region is rotated, makes long limit and the horizontal direction parallel of the bianry image of this place, border image-region;
From the often row pixel that postrotational bianry image comprises, obtain the pixel that the multiple gray-scale value of continuous print is the first numerical value respectively;
The line segment that the multiple pixels obtained respectively from every row pixel are formed is defined as this many line segments.
In another embodiment of the present disclosure, based on these many line segments, pre-service is carried out to the bianry image of this place, border image-region, comprising:
For bar line segment every in these many line segments, determine the angle between this line segment and horizontal direction;
When this angle is less than or equal to specified angle threshold value, determine the line segment length of this line segment;
When this line segment length is less than designated length threshold value, the gray-scale value of the multiple pixels forming this line segment is set to second value.
In another embodiment of the present disclosure, when this line segment length is less than designated length threshold value, after the gray-scale value of the multiple pixels forming this line segment is set to second value, also comprise:
From the bianry image of this place, border image-region, determine multiple image connectivity territory, the connected region that the pixel that image connectivity territory is the first numerical value by gray-scale value is formed;
For image connectivity territory each in the plurality of image connectivity territory, determine the statistical parameter in this image connectivity territory, this statistical parameter is area or width;
When this statistical parameter is more than or equal to the first parameter threshold, or when this statistical parameter is less than or equal to the second parameter threshold, the gray-scale value of pixel in this image connectivity territory is set to second value, and the first parameter threshold is greater than the second parameter threshold.
In another embodiment of the present disclosure, the method also comprises:
When this angle is greater than this specified angle threshold value, display reminding information, obtains pending image again to point out user.
Above-mentioned all alternatives, all can form embodiment of the present disclosure according to combining arbitrarily, disclosure embodiment repeats no longer one by one to this.
Fig. 2 is the process flow diagram of a kind of image pre-processing method according to an exemplary embodiment.See Fig. 2, the method comprises the following steps.
In step 201, pending image is converted to gray-scale map, from this gray-scale map, determines the image-region at each place, border of card.
Because the most important application of image procossing identifies the card in image, and the identification of card is mainly in order to each border of identification card, and in order to the recognition accuracy that improves card and recognition efficiency, after obtaining pending image by shooting card, pending image can be converted to gray-scale map by this terminal, and from this gray-scale map, determine the image-region at each place, border of this card.
And this terminal is from this gray-scale map, determine that the operation of each place, border image-region of this card can be: this terminal obtains regional extent corresponding to each border of this card, based on the regional extent obtained, from this gray-scale map, determine the image-region at each place, border of this card.
Wherein, the regional extent that each border of this card is corresponding can be arranged in advance, and regional extent corresponding to each border of this card is the regional extent of each border at a distance of each edge of pending image of this card, such as, for the coboundary of this card, regional extent corresponding to this coboundary can be and pending image coboundary at a distance of the regional extent of 0 ~ 5cm, or, and the regional extent of 1/4th picture traverses between pending image coboundary, or, and the regional extent etc. of 1/4th image areas between pending image coboundary, disclosure embodiment is not specifically limited this.In addition, the regional extent that each border of this card is corresponding can be equal, also can be unequal, and disclosure embodiment is not specifically limited equally to this.
Such as, regional extent corresponding to each border of this card is the regional extent of each border 0 ~ 5cm of pending image with this, as shown in Figure 3, based on the scope that the coboundary of this card is corresponding, from the coboundary of this gray-scale map, obtain the image-region A of 0 ~ 5cm, the length of image-region A is equal with length of upper edge, the image-region A of acquisition is defined as the image-region at the place, coboundary of this card; In like manner, based on the scope that the lower boundary of this card is corresponding, from the lower limb of this gray-scale map, obtain the image-region B of 0 ~ 5cm, the length of image-region B is equal with lower limb length, the image-region B of acquisition is defined as the image-region at the lower boundary place of this card; In like manner, based on the scope that the left margin of this card is corresponding, from the left hand edge of this gray-scale map, obtain the image-region C of 0 ~ 5cm, the length of image-region C is equal with the length of left hand edge, the image-region C of acquisition is defined as the image-region at the left margin place of this card; In like manner, based on the scope that the right margin of this card is corresponding, from the right hand edge of this gray-scale map, obtain the image-region D of 0 ~ 5cm, the length of image-region D is equal with the length of right hand edge, the image-region D of acquisition is defined as the image-region at the right margin place of this card.
It should be noted that, the method pending image being converted to gray-scale map can with reference to correlation technique, and disclosure embodiment does not elaborate this.
In addition, when this terminal determines the image-region at each place, border of card in this gray-scale map, this terminal can also to divide the multiple image-regions obtained from prior to target image, the image-region at each place, border of choice cards, is defined as the image-region at each place, border of card in this gray-scale map by gray-scale map corresponding for the image-region of selection.
In step 202., for each border of this card, based on this border institute pixel in the image area, the image-region at this place, border is carried out self-adaption binaryzation process, obtain the bianry image of this place, border image-region.
In order to improve the efficiency of binary conversion treatment, and promote the effect of binary conversion treatment, in the disclosed embodiments, this terminal can carry out self-adaption binaryzation process to the image-region at each place, border of this card, and for each border of this card, this terminal carries out the operation of self-adaption binaryzation process to the image-region at this place, border can be for: for this border institute each pixel in the image area, obtain this pixel neighborhood of a point; Based on the gray-scale value of pixel in this neighborhood, determine the first gray threshold; When the gray-scale value of this pixel is more than or equal to the first gray threshold, the gray-scale value of this pixel is set to the first numerical value; When the gray-scale value of this pixel is less than the first gray threshold, the gray-scale value of this pixel is set to second value.
Wherein, the shape of neighborhood of pixel points can be rectangle, circle, ellipse etc., and disclosure embodiment is not specifically limited this.And when the shape of neighborhood of pixel points is rectangle, the operation that this terminal obtains this pixel neighborhood of a point can be: using this pixel as center, from this border institute in the image area, obtain the rectangular area of presetting long limit and default minor face, this rectangular area is defined as this pixel neighborhood of a point.When the shape of neighborhood of pixel points is circular, the operation that this terminal obtains pixel neighborhood of a point can be: this terminal using this pixel as the center of circle, from this border institute in the image area, obtain the border circular areas of pre-set radius, this border circular areas is defined as this pixel neighborhood of a point.And when the shape of neighborhood of pixel points is oval, the operation that this terminal obtains pixel neighborhood of a point can be: using this pixel as center, from this border institute in the image area, obtain the elliptical region presetting major axis radius and default minor axis radius, this elliptical region is defined as this pixel neighborhood of a point.Certainly, the shape of this neighborhood of pixel points can also be other shapes, and disclosure embodiment will not enumerate at this.
It should be noted that, preset long limit, default minor face, pre-set radius, default major axis radius and default minor axis radius all can pre-set, and default long limit, default minor face, pre-set radius, default major axis radius and default minor axis radius not only can adopt length to describe, the quantity of pixel can also be adopted describe, such as, for default major diameter, this presets long limit can be not only 0.5cm, can also be 5 pixels, disclosure embodiment be not specifically limited this.
Such as, the shape of neighborhood of pixel points is rectangle, and default long limit and default minor face adopt the quantity of pixel to describe, if, presetting long limit is 5 pixels, and default minor face is 5 pixels, therefore, for this card coboundary pixel a in the image area, as shown in Figure 4, this terminal using pixel a as center, from image-region A, obtain the rectangular area of presetting long limit and default minor face, this rectangular area is defined as the neighborhood of this pixel a.
Wherein, this terminal, based on the gray-scale value of pixel in this neighborhood, when determining the first gray threshold, can be determined the mean value of all pixel gray-scale values in this neighborhood, this mean value is defined as the first gray threshold.In addition, this mean value can also be multiplied with designated ratio by this terminal, and product is defined as the first gray threshold.Certainly, this terminal can also determine the first gray threshold by additive method, such as, by being greater than the weighted average method being less than the gray-scale value of the 3rd gray threshold in the gray-scale value of the second gray threshold and this neighborhood in this neighborhood, disclosure embodiment will not enumerate this.
Further, after this terminal obtains this pixel neighborhood of a point, this terminal can also determine the first ratio and the second ratio, first ratio is the ratio of pixel number shared by total number that in this neighborhood, gray-scale value is greater than the second gray threshold, in this neighborhood of second ratio, gray-scale value is less than the ratio of pixel number shared by described total number of the 3rd gray threshold, and this total number is the number of all pixels in this neighborhood; When the first ratio and the second ratio are all less than proportion threshold value, this terminal can perform the above-mentioned gray-scale value based on pixel in neighborhood, determines the step of the first gray threshold.
And when the first ratio is more than or equal to proportion threshold value, the gray-scale value of this pixel can be set to the first numerical value by this terminal; When the second ratio is more than or equal to proportion threshold value, the gray-scale value of this pixel is set to second value.
Wherein, this terminal determines that the operation of the first ratio and the second ratio can be: this terminal obtains the gray-scale value of the pixel that this neighborhood comprises, based on the gray-scale value obtained, determine that gray-scale value is greater than the pixel number of the second gray threshold, and determine that gray-scale value is less than the pixel number of the 3rd gray threshold, gray-scale value is greater than the pixel number of the second gray threshold divided by this total number, obtain the first ratio, and pixel number gray-scale value being less than the 3rd gray threshold is divided by this total number, obtains the second ratio.
It should be noted that, first numerical value and second value can be arranged in advance, and the first numerical value is greater than second value, such as, the first numerical value can be 255,254,253 etc., second value can be 0,1,2 etc., and in order to improve the recognition accuracy on each border of card further, and promoting the effect of Image semantic classification, the first numerical value can be 255, second value can be 0, and disclosure embodiment is not specifically limited this.
In addition, the second gray threshold, the 3rd gray threshold and proportion threshold value also can be arranged in advance, and the second gray threshold is greater than the 3rd gray threshold, such as, the second gray threshold is the 200, three gray threshold is 30, proportion threshold value is 0.8, and disclosure embodiment is not specifically limited equally to this.
Based on above-mentioned example, when this terminal is from image-region A, after determining the neighborhood of pixel a, this terminal determines that the number of all pixels in this neighborhood is 25, that is to say, total number is 25.If the second gray threshold is the 200, three gray threshold is 30, proportion threshold value is the 0.8, first numerical value is 255, and second value is 0, this terminal, from this neighborhood, determines that the pixel number that gray-scale value is greater than 200 is 22, determines that the pixel number that gray-scale value is less than 30 is 3, by 22 divided by 25, first ratio that obtains is 0.88, by 3 divided by 25, second ratio that obtains is 0.12, this terminal determines that the first ratio is greater than proportion threshold value, and now, the gray-scale value of this pixel is set to 255 by this terminal.After based on the method image-region A being carried out self-adaption binaryzation process, bianry image as shown in Figure 5 can be obtained, wherein, in Fig. 5, adopt striped lattice to replace black.
In step 203, for each border of this card, from the bianry image of this place, border image-region, obtain many line segments, the pixel that these many line segments are the first numerical value by multiple gray-scale value is respectively formed.
Because each border of card is basic parallel with the long limit of each place, border image-region, therefore, for the ease of in the bianry image from this place, border image-region, obtain many line segments, the long limit that this terminal can judge the bianry image of this place, border image-region whether with horizontal direction parallel; When the long limit of the bianry image of this place, border image-region and horizontal direction not parallel time, the bianry image of this place, border image-region is rotated, makes long limit and the horizontal direction parallel of the bianry image of this place, border image-region; From the often row pixel that postrotational bianry image comprises, obtain the pixel that the multiple gray-scale value of continuous print is the first numerical value respectively; The line segment that the multiple pixels obtained respectively from every row pixel are formed is defined as this many line segments.
It should be noted that, in the disclosed embodiments, this terminal not only can by the method for above-mentioned self-adaption binaryzation process, binary conversion treatment is carried out to each place, border image-region, certainly, in practical application, this terminal can also by other method, binary conversion treatment is carried out to each place, border image-region, such as, this terminal can by this each border the gray-scale value of pixel and the 4th gray threshold compare in the image area, when the gray-scale value of pixel is greater than the 4th gray threshold, the gray-scale value of this pixel is set to the first numerical value, when the gray-scale value of pixel is less than the 4th gray threshold, the gray-scale value of this pixel is set to second value.
Wherein, this binary conversion treatment needs acquisition gray-scale value to be greater than the pixel of the 4th gray threshold, and be less than the pixel of the 4th gray threshold, therefore, this terminal can adopt wave filter to obtain, this wave filter can be sobel (Sobel) wave filter, and disclosure embodiment is not specifically limited this.In addition, the 4th gray threshold can be arranged in advance, and disclosure embodiment is not specifically limited equally to this.
In step 204, based on these many line segments, pre-service is carried out to the bianry image of this place, border image-region.
In order to improve the accuracy of card recognition, this terminal can based on these many line segments, pre-service is carried out to the bianry image of this place, border image-region, and based on these many line segments, carrying out pretreated operation to the bianry image of this place, border image-region can be: for bar line segment every in these many line segments, determine the angle between this line segment and horizontal direction; When this angle is less than or equal to specified angle threshold value, determine the line segment length of this line segment; When this line segment length is less than designated length threshold value, the gray-scale value of the multiple pixels forming this line segment is set to second value.
Further, when this angle is greater than specified angle threshold value, display reminding information, obtains pending image again to point out user.In addition, when this line segment length is more than or equal to designated length threshold value, retains the multiple pixels forming this line segment, that is to say, the gray-scale value maintaining the multiple pixels forming this line segment is that the first numerical value is constant.
Such as, obtain many line segments in the bianry image shown in Fig. 5, if, these many line segments are respectively line segment 1, line segment 2, line segment 3 ... line segment n, determine that these many line segments are respectively at the angle between horizontal direction, and and then determine that line segment 1, line segment 2, line segment 4, line segment 5, line segment 7, line segment 12, line segment 15, line segment 21, line segment 25, line segment 28, line segment 30, line segment 35 and the angle of line segment 44 respectively and between horizontal direction are less than or equal to specified angle threshold value.Afterwards, this terminal determination line segment 1, line segment 2, line segment 4, line segment 5, line segment 7, line segment 12, line segment 15, line segment 21, line segment 25, line segment 28, line segment 30, the line segment length of line segment 35 and line segment 44 is respectively 10cm, 12cm, 3cm, 5cm, 2.5cm, 15cm, 14cm, 11cm, 12.2cm, 1cm, 7cm, 10cm, 4.5cm, if designated length threshold value is 10cm, this terminal determination line segment 4, line segment 5, line segment 7, line segment 28, the line segment length of line segment 33 and line segment 44 is less than designated length threshold value 10cm, therefore, this terminal will form line segment 4, line segment 5, line segment 7, line segment 28, the gray-scale value of multiple pixels of line segment 33 and line segment 44 is set to 0, obtain image as shown in Figure 6.
In order to further carry out pre-service to the bianry image of this place, border image-region, when this line segment length is less than designated length threshold value, after the gray-scale value of the multiple pixels forming this line segment is set to second value, also comprise: from the bianry image of this place, border image-region, determine multiple image connectivity territory, the connected region that the pixel that this image connectivity territory is the first numerical value by gray-scale value is formed; For image connectivity territory each in the plurality of image connectivity territory, determine the statistical parameter in this image connectivity territory, this statistical parameter is area or width; When this statistical parameter is more than or equal to the first parameter threshold, or when this statistical parameter is less than or equal to the second parameter threshold, the gray-scale value of pixel in this image connectivity territory is set to second value, and the first parameter threshold is greater than the second parameter threshold.
Further, when this statistical parameter is less than the first parameter threshold and is greater than the second parameter threshold, the gray-scale value maintaining pixel in this image connectivity territory is that the first numerical value is constant.
It should be noted that, the first parameter threshold and the second parameter threshold can be arranged in advance, and when the statistical parameter in image connectivity territory is different, the first parameter threshold and the second parameter threshold also can be different, and disclosure embodiment is not specifically limited this.In addition, specified angle threshold value and designated length threshold value also can be arranged in advance, and such as, specified angle threshold value can be 5 degree, and designated length threshold value can be 80% of the long limit of image, and disclosure embodiment is not specifically limited equally to this.
In the disclosed embodiments, based on each border institute pixel in the image area of card, respectively the image-region at each place, border is carried out self-adaption binaryzation process, obtain the bianry image of each place, border image-region, and need the pixel gray-scale value considered in each neighborhood of pixel points due to self-adaption binaryzation process, this improves the accuracy rate of binary conversion treatment, and then improve the effect of binary conversion treatment.In addition, because in the bianry image determined, the gray-scale value of pixel is the first numerical value or second value, and from the bianry image of each place, border image-region, many the line segments that the pixel that to obtain by multiple gray-scale value be respectively the first numerical value is formed, by these many line segments, can process further the bianry image of each place, border image-region, thus some burrs on edges on each border of filtering card, highlight the border of card more clearly, improve the effect of Image semantic classification.
Fig. 7 is a kind of image preprocess apparatus block diagram according to an exemplary embodiment.With reference to Fig. 7, this device comprises determination module 701, acquisition module 702 and pretreatment module 703.
Determination module 701, for based on pending image, determines the bianry image of each place, border image-region of card;
Acquisition module 702, for each border for this card, from the bianry image of this place, border image-region, obtain many line segments, the pixel that these many line segments are the first numerical value by multiple gray-scale value is respectively formed;
Pretreatment module 703, for based on these many line segments, carries out pre-service to the bianry image of this place, border image-region.
See Fig. 8, determination module 701 comprises:
Converting unit 7011, for being converted to gray-scale map by pending image;
First determining unit 7012, for from this gray-scale map, determines the image-region at each place, border of this card;
Binary conversion treatment unit 7013, for each border for this card, based on this border institute pixel in the image area, carries out self-adaption binaryzation process, obtains the bianry image of this place, border image-region by the image-region at this place, border.
See Fig. 9, binary conversion treatment unit 7013 comprises:
Obtain subelement 70131, for for this border institute each pixel in the image area, obtain this pixel neighborhood of a point;
First determines subelement 70132, for the gray-scale value based on pixel in this neighborhood, determines the first gray threshold;
First arranges subelement 70133, for when the gray-scale value of this pixel is more than or equal to the first gray threshold, the gray-scale value of this pixel is set to the first numerical value;
Second arranges subelement 70134, for when the gray-scale value of this pixel is less than the first gray threshold, the gray-scale value of this pixel is set to second value.
See Figure 10, binary conversion treatment unit 7013 also comprises:
Second determines subelement 70135, for determining the first ratio and the second ratio, first ratio is the ratio of pixel number shared by total number that in this neighborhood, gray-scale value is greater than the second gray threshold, second ratio is the ratio of pixel number shared by total number that in this neighborhood, gray-scale value is less than the 3rd gray threshold, and total number is the number of all pixels in this neighborhood;
Perform subelement 70136, for when the first ratio and the second ratio are all less than proportion threshold value, perform the gray-scale value based on pixel in this neighborhood, determine the step of the first gray threshold.
See Figure 11, binary conversion treatment unit 7013 also comprises:
3rd arranges subelement 70137, for when the first ratio is more than or equal to proportion threshold value, the gray-scale value of this pixel is set to the first numerical value;
4th arranges subelement 70138, for when the second ratio is more than or equal to proportion threshold value, the gray-scale value of this pixel is set to second value.
See Figure 12, acquisition module 702 comprises:
Judging unit 7021, for judge the bianry image of this place, border image-region long limit whether with horizontal direction parallel;
Rotary unit 7022, for the long limit of the bianry image when this place, border image-region and horizontal direction not parallel time, the bianry image of this place, border image-region is rotated, makes long limit and the horizontal direction parallel of the bianry image of this place, border image-region;
Acquiring unit 7023, in the often row pixel that comprises from postrotational bianry image, obtains the pixel that the multiple gray-scale value of continuous print is described first numerical value respectively;
Second determining unit 7024, is defined as this many line segments for the line segment formed by the multiple pixels obtained respectively from every row pixel.
See Figure 13, pretreatment module 703 comprises:
3rd determining unit 7031, for for bar line segment every in these many line segments, determines the angle between this line segment and horizontal direction;
4th determining unit 7032, for when this angle is less than or equal to specified angle threshold value, determines the line segment length of this line segment;
First setting unit 7033, for when this line segment length is less than designated length threshold value, is set to second value by the gray-scale value of the multiple pixels forming this line segment.
See Figure 14, pretreatment module 703 also comprises:
5th determining unit 7034, in the bianry image from this place, border image-region, determines multiple image connectivity territory, the connected region that the pixel that the plurality of image connectivity territory is the first numerical value by gray-scale value is respectively formed;
6th determining unit 7035, for for image connectivity territory each in the plurality of image connectivity territory, determine the statistical parameter in this image connectivity territory, this statistical parameter is area or width;
Second setting unit 7036, for being more than or equal to the first parameter threshold when this statistical parameter, or when this statistical parameter is less than or equal to the second parameter threshold, the gray-scale value of pixel in this image connectivity territory is set to this second value, and this first parameter threshold is greater than the second parameter threshold.
In the disclosed embodiments, based on pending image, determine the bianry image of each place, border image-region of card, because in the bianry image determined, the gray-scale value of pixel is the first numerical value or second value, and from the bianry image of each place, border image-region, many the line segments that the pixel that to obtain by multiple gray-scale value be respectively the first numerical value is formed, by these many line segments, can process further the bianry image of each place, border image-region, thus some burrs on edges on each border of filtering card, highlight the border of card more clearly, improve the effect of Image semantic classification.
About the device in above-described embodiment, wherein the concrete mode of modules executable operations has been described in detail in about the embodiment of the method, will not elaborate explanation herein.
Figure 15 is the block diagram of a kind of device 1500 for image procossing according to an exemplary embodiment.Such as, device 1500 can be mobile phone, computing machine, digital broadcast terminal, messaging devices, game console, tablet device, Medical Devices, body-building equipment, personal digital assistant etc.
With reference to Figure 15, device 1500 can comprise following one or more assembly: processing components 1502, storer 1504, power supply module 1506, multimedia groupware 1508, audio-frequency assembly 1510, the interface 1512 of I/O (I/O), sensor module 1514, and communications component 1516.
The integrated operation of the usual control device 1500 of processing components 1502, such as with display, call, data communication, camera operation and record operate the operation be associated.Treatment element 1502 can comprise one or more processor 1520 to perform instruction, to complete all or part of step of above-mentioned method.In addition, processing components 1502 can comprise one or more module, and what be convenient between processing components 1502 and other assemblies is mutual.Such as, processing element 1502 can comprise multi-media module, mutual with what facilitate between multimedia groupware 1508 and processing components 1502.
Storer 1504 is configured to store various types of data to be supported in the operation of equipment 1500.The example of these data comprises for any application program of operation on device 1500 or the instruction of method, contact data, telephone book data, message, picture, video etc.Storer 1504 can be realized by the volatibility of any type or non-volatile memory device or their combination, as static RAM (SRAM), Electrically Erasable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory EPROM (EPROM), programmable read only memory (PROM), ROM (read-only memory) (ROM), magnetic store, flash memory, disk or CD.
The various assemblies that electric power assembly 1506 is device 1500 provide electric power.Electric power assembly 1506 can comprise power-supply management system, one or more power supply, and other and the assembly generating, manage and distribute electric power for device 1500 and be associated.
Multimedia groupware 1508 is included in the screen providing an output interface between described device 1500 and user.In certain embodiments, screen can comprise liquid crystal display (LCD) and touch panel (TP).If screen comprises touch panel, screen may be implemented as touch-screen, to receive the input signal from user.Touch panel comprises one or more touch sensor with the gesture on sensing touch, slip and touch panel.Described touch sensor can the border of not only sensing touch or sliding action, but also detects the duration relevant to described touch or slide and pressure.In certain embodiments, multimedia groupware 1508 comprises a front-facing camera and/or post-positioned pick-up head.When equipment 1500 is in operator scheme, during as screening-mode or video mode, front-facing camera and/or post-positioned pick-up head can receive outside multi-medium data.Each front-facing camera and post-positioned pick-up head can be fixing optical lens systems or have focal length and optical zoom ability.
Audio-frequency assembly 1510 is configured to export and/or input audio signal.Such as, audio-frequency assembly 1510 comprises a microphone (MIC), and when device 1500 is in operator scheme, during as call model, logging mode and speech recognition mode, microphone is configured to receive external audio signal.The sound signal received can be stored in storer 1504 further or be sent via communications component 1516.In certain embodiments, audio-frequency assembly 1510 also comprises a loudspeaker, for output audio signal.
I/O interface 1512 is for providing interface between processing components 1502 and peripheral interface module, and above-mentioned peripheral interface module can be keyboard, some striking wheel, button etc.These buttons can include but not limited to: home button, volume button, start button and locking press button.
Sensor module 1514 comprises one or more sensor, for providing the state estimation of various aspects for device 1500.Such as, sensor module 1514 can detect the opening/closing state of equipment 1500, the relative positioning of assembly, such as described assembly is display and the keypad of device 1500, the position of all right pick-up unit 1500 of sensor module 1514 or device 1500 assemblies changes, the presence or absence that user contacts with device 1500, the temperature variation of device 1500 orientation or acceleration/deceleration and device 1500.Sensor module 1514 can comprise proximity transducer, be configured to without any physical contact time detect near the existence of object.Sensor module 1514 can also comprise optical sensor, as CMOS or ccd image sensor, for using in imaging applications.In certain embodiments, this sensor module 1514 can also comprise acceleration transducer, gyro sensor, Magnetic Sensor, pressure transducer or temperature sensor.
Communications component 1516 is configured to the communication being convenient to wired or wireless mode between device 1500 and other equipment.Device 1500 can access the wireless network based on communication standard, as WiFi, 2G or 3G, or their combination.In one exemplary embodiment, communication component 1516 receives from the broadcast singal of external broadcasting management system or broadcast related information via broadcast channel.In one exemplary embodiment, described communication component 1516 also comprises near-field communication (NFC) module, to promote junction service.Such as, can based on radio-frequency (RF) identification (RFID) technology in NFC module, Infrared Data Association (IrDA) technology, ultra broadband (UWB) technology, bluetooth (BT) technology and other technologies realize.
In the exemplary embodiment, device 1500 can be realized, for performing said method by one or more application specific integrated circuit (ASIC), digital signal processor (DSP), digital signal processing appts (DSPD), programmable logic device (PLD) (PLD), field programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic components.
In the exemplary embodiment, additionally provide a kind of non-transitory computer-readable recording medium comprising instruction, such as, comprise the storer 1504 of instruction, above-mentioned instruction can perform said method by the processor 1520 of device 1500.Such as, described non-transitory computer-readable recording medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk and optical data storage devices etc.
A kind of non-transitory computer-readable recording medium, when the instruction in described storage medium is performed by the processor of mobile terminal, make mobile terminal can perform a kind of image pre-processing method, described method comprises:
Based on pending image, determine the bianry image of each place, border image-region of card;
For each border of this card, from the bianry image of this place, border image-region, obtain many line segments, the pixel that these many line segments are the first numerical value by multiple gray-scale value is respectively formed;
Based on these many line segments, pre-service is carried out to the bianry image of this place, border image-region.
In another embodiment of the present disclosure, based on pending image, determine the bianry image of each place, border image-region of card, comprising:
Pending image is converted to gray-scale map;
From this gray-scale map, determine the image-region at each place, border of this card;
For each border of this card, based on this border institute pixel in the image area, the image-region at this place, border is carried out self-adaption binaryzation process, obtain the bianry image of this place, border image-region.
In another embodiment of the present disclosure, based on this border institute pixel in the image area, the image-region at this place, border is carried out self-adaption binaryzation process, obtains the bianry image of this place, border image-region, comprising:
For this border institute each pixel in the image area, obtain this pixel neighborhood of a point;
Based on the gray-scale value of pixel in this neighborhood, determine the first gray threshold;
When the gray-scale value of this pixel is more than or equal to the first gray threshold, the gray-scale value of this pixel is set to the first numerical value;
When the gray-scale value of this pixel is less than the first gray threshold, the gray-scale value of this pixel is set to second value.
In another embodiment of the present disclosure, after obtaining this pixel neighborhood of a point, also comprise:
Determine the first ratio and the second ratio, first ratio is the ratio of pixel number shared by total number that in this neighborhood, gray-scale value is greater than the second gray threshold, second ratio is the ratio of pixel number shared by total number that in this neighborhood, gray-scale value is less than the 3rd gray threshold, and this total number is the number of all pixels in this neighborhood;
When the first ratio and the second ratio are all less than proportion threshold value, perform the gray-scale value based on pixel in this neighborhood, determine the step of the first gray threshold.
In another embodiment of the present disclosure, after determining the first ratio and the second ratio, also comprise:
When the first ratio is more than or equal to this proportion threshold value, the gray-scale value of this pixel is set to the first numerical value;
When the second ratio is more than or equal to this proportion threshold value, the gray-scale value of this pixel is set to second value.
In another embodiment of the present disclosure, from the bianry image of this place, border image-region, obtain many line segments, comprising:
The long limit judging the bianry image of this place, border image-region whether with horizontal direction parallel;
When the long limit of the bianry image of this place, border image-region and horizontal direction not parallel time, the bianry image of this place, border image-region is rotated, makes long limit and the horizontal direction parallel of the bianry image of this place, border image-region;
From the often row pixel that postrotational bianry image comprises, obtain the pixel that the multiple gray-scale value of continuous print is the first numerical value respectively;
The line segment that the multiple pixels obtained respectively from every row pixel are formed is defined as this many line segments.
In another embodiment of the present disclosure, based on these many line segments, pre-service is carried out to the bianry image of this place, border image-region, comprising:
For bar line segment every in these many line segments, determine the angle between this line segment and horizontal direction;
When this angle is less than or equal to specified angle threshold value, determine the line segment length of this line segment;
When this line segment length is less than designated length threshold value, the gray-scale value of the multiple pixels forming this line segment is set to second value.
In another embodiment of the present disclosure, when this line segment length is less than designated length threshold value, after the gray-scale value of the multiple pixels forming this line segment is set to second value, also comprise:
From the bianry image of this place, border image-region, determine multiple image connectivity territory, the connected region that the pixel that image connectivity territory is the first numerical value by gray-scale value is formed;
For image connectivity territory each in the plurality of image connectivity territory, determine the statistical parameter in this image connectivity territory, this statistical parameter is area or width;
When this statistical parameter is more than or equal to the first parameter threshold, or when this statistical parameter is less than or equal to the second parameter threshold, the gray-scale value of pixel in this image connectivity territory is set to second value, and the first parameter threshold is greater than the second parameter threshold.
In another embodiment of the present disclosure, the method also comprises:
When this angle is greater than this specified angle threshold value, display reminding information, obtains pending image again to point out user.
In the disclosed embodiments, based on pending image, determine the bianry image of each place, border image-region of card, because in the bianry image determined, the gray-scale value of pixel is the first numerical value or second value, and from the bianry image of each place, border image-region, many the line segments that the pixel that to obtain by multiple gray-scale value be respectively the first numerical value is formed, by these many line segments, can process further the bianry image of each place, border image-region, thus some burrs on edges on each border of filtering card, highlight the border of card more clearly, improve the effect of Image semantic classification.
Those skilled in the art, at consideration instructions and after putting into practice invention disclosed herein, will easily expect other embodiment of the present invention.The application is intended to contain any modification of the present invention, purposes or adaptations, and these modification, purposes or adaptations are followed general principle of the present invention and comprised the undocumented common practise in the art of the disclosure or conventional techniques means.Instructions and embodiment are only regarded as exemplary, and true scope of the present invention and spirit are pointed out by claim below.
Should be understood that, the present invention is not limited to precision architecture described above and illustrated in the accompanying drawings, and can carry out various amendment and change not departing from its scope.Scope of the present invention is only limited by appended claim.

Claims (19)

1. an image pre-processing method, is characterized in that, described method comprises:
Based on pending image, determine the bianry image of each place, border image-region of card;
For each border described, from the bianry image of place, described border image-region, obtain many line segments, the pixel that described many line segments are the first numerical value by multiple gray-scale value is respectively formed;
Based on described many line segments, pre-service is carried out to the bianry image of place, described border image-region.
2. the method for claim 1, is characterized in that, described based on pending image, determines the bianry image of each place, border image-region of card, comprising:
Described pending image is converted to gray-scale map;
From described gray-scale map, determine the image-region at each place, border of described card;
For each border described, based on described border institute pixel in the image area, the image-region at place, described border is carried out self-adaption binaryzation process, obtain the bianry image of place, described border image-region.
3. method as claimed in claim 2, is characterized in that, described based on described border institute pixel in the image area, the image-region at place, described border is carried out self-adaption binaryzation process, obtains the bianry image of place, described border image-region, comprising:
For described border institute each pixel in the image area, obtain described pixel neighborhood of a point;
Based on the gray-scale value of pixel in described neighborhood, determine the first gray threshold;
When the gray-scale value of described pixel is more than or equal to described first gray threshold, the gray-scale value of described pixel is set to the first numerical value;
When the gray-scale value of described pixel is less than described first gray threshold, the gray-scale value of described pixel is set to second value.
4. method as claimed in claim 3, is characterized in that, after the described pixel neighborhood of a point of described acquisition, also comprise:
Determine the first ratio and the second ratio, described first ratio is the ratio of pixel number shared by total number that in described neighborhood, gray-scale value is greater than the second gray threshold, described second ratio is the ratio of pixel number shared by described total number that in described neighborhood, gray-scale value is less than the 3rd gray threshold, and described total number is the number of all pixels in described neighborhood;
When described first ratio and described second ratio are all less than proportion threshold value, perform the described gray-scale value based on pixel in described neighborhood, determine the step of the first gray threshold.
5. method as claimed in claim 4, is characterized in that, described determine the first ratio and the second ratio after, also comprise:
When described first ratio is more than or equal to described proportion threshold value, the gray-scale value of described pixel is set to described first numerical value;
When described second ratio is more than or equal to described proportion threshold value, the gray-scale value of described pixel is set to described second value.
6. the method for claim 1, is characterized in that, described from the bianry image of place, described border image-region, obtains many line segments, comprising:
The long limit judging the bianry image of place, described border image-region whether with horizontal direction parallel;
When the long limit of the bianry image of place, described border image-region and horizontal direction not parallel time, the bianry image of place, described border image-region is rotated, makes long limit and the horizontal direction parallel of the bianry image of place, described border image-region;
From the often row pixel that postrotational bianry image comprises, obtain the pixel that the multiple gray-scale value of continuous print is described first numerical value respectively;
The line segment that the multiple pixels obtained respectively from described often row pixel are formed is defined as described many line segments.
7. the method for claim 1, is characterized in that, described based on described many line segments, carries out pre-service, comprising the bianry image of place, described border image-region:
For bar line segment every in described many line segments, determine the angle between described line segment and horizontal direction;
When described angle is less than or equal to specified angle threshold value, determine the line segment length of described line segment;
When described line segment length is less than designated length threshold value, the gray-scale value of the multiple pixels forming described line segment is set to second value.
8. method as claimed in claim 7, is characterized in that, described when described line segment length is less than designated length threshold value, after the gray-scale value of the multiple pixels forming described line segment is set to second value, also comprises:
From the bianry image of place, described border image-region, determine multiple image connectivity territory, the connected region that the pixel that described image connectivity territory is described first numerical value by gray-scale value is formed;
For each image connectivity territory in described multiple image connectivity territory, determine the statistical parameter in described image connectivity territory, described statistical parameter is area or width;
When described statistical parameter is more than or equal to the first parameter threshold, or when described statistical parameter is less than or equal to the second parameter threshold, the gray-scale value of pixel in described image connectivity territory is set to described second value, and described first parameter threshold is greater than described second parameter threshold.
9. method as claimed in claim 7, it is characterized in that, described method also comprises:
When described angle is greater than described specified angle threshold value, display reminding information, obtains described pending image again to point out user.
10. an image preprocess apparatus, is characterized in that, described device comprises:
Determination module, for based on pending image, determines the bianry image of each place, border image-region of card;
Acquisition module, for for each border described, from the bianry image of place, described border image-region, obtain many line segments, the pixel that described many line segments are the first numerical value by multiple gray-scale value is respectively formed;
Pretreatment module, for based on described many line segments, carries out pre-service to the bianry image of place, described border image-region.
11. devices as claimed in claim 10, it is characterized in that, described determination module comprises:
Converting unit, for being converted to gray-scale map by described pending image;
First determining unit, for from described gray-scale map, determines the image-region at each place, border of described card;
Binary conversion treatment unit, for for each border described, based on described border institute pixel in the image area, carries out self-adaption binaryzation process, obtains the bianry image of place, described border image-region by the image-region at place, described border.
12. devices as claimed in claim 11, it is characterized in that, described binary conversion treatment unit comprises:
Obtain subelement, for for described border institute each pixel in the image area, obtain described pixel neighborhood of a point;
First determines subelement, for the gray-scale value based on pixel in described neighborhood, determines the first gray threshold;
First arranges subelement, for when the gray-scale value of described pixel is more than or equal to described first gray threshold, the gray-scale value of described pixel is set to the first numerical value;
Second arranges subelement, for when the gray-scale value of described pixel is less than described first gray threshold, the gray-scale value of described pixel is set to second value.
13. devices as claimed in claim 12, it is characterized in that, described binary conversion treatment unit also comprises:
Second determines subelement, for determining the first ratio and the second ratio, described first ratio is the ratio of pixel number shared by total number that in described neighborhood, gray-scale value is greater than the second gray threshold, described second ratio is the ratio of pixel number shared by described total number that in described neighborhood, gray-scale value is less than the 3rd gray threshold, and described total number is the number of all pixels in described neighborhood;
Perform subelement, for when described first ratio and described second ratio are all less than proportion threshold value, perform the described gray-scale value based on pixel in described neighborhood, determine the step of the first gray threshold.
14. devices as claimed in claim 13, it is characterized in that, described binary conversion treatment unit also comprises:
3rd arranges subelement, for when described first ratio is more than or equal to described proportion threshold value, the gray-scale value of described pixel is set to described first numerical value;
4th arranges subelement, for when described second ratio is more than or equal to described proportion threshold value, the gray-scale value of described pixel is set to described second value.
15. devices as claimed in claim 10, it is characterized in that, described acquisition module comprises:
Judging unit, for judge the bianry image of place, described border image-region long limit whether with horizontal direction parallel;
Rotary unit, for the long limit of the bianry image when place, described border image-region and horizontal direction not parallel time, the bianry image of place, described border image-region is rotated, makes long limit and the horizontal direction parallel of the bianry image of place, described border image-region;
Acquiring unit, in the often row pixel that comprises from postrotational bianry image, obtains the pixel that the multiple gray-scale value of continuous print is described first numerical value respectively;
Second determining unit, is defined as described many line segments for the line segment formed by the multiple pixels obtained respectively from described often row pixel.
16. devices as claimed in claim 10, it is characterized in that, described pretreatment module comprises:
3rd determining unit, for for bar line segment every in described many line segments, determines the angle between described line segment and horizontal direction;
4th determining unit, for when described angle is less than or equal to specified angle threshold value, determines the line segment length of described line segment;
First setting unit, for when described line segment length is less than designated length threshold value, is set to second value by the gray-scale value of the multiple pixels forming described line segment.
17. devices as claimed in claim 16, it is characterized in that, described pretreatment module also comprises:
5th determining unit, in the bianry image from place, described border image-region, determines multiple image connectivity territory, the connected region that the pixel that described image connectivity territory is described first numerical value by gray-scale value is formed;
6th determining unit, for for each image connectivity territory in described multiple image connectivity territory, determine the statistical parameter in described image connectivity territory, described statistical parameter is area or width;
Second setting unit, for being more than or equal to the first parameter threshold when described statistical parameter, or when described statistical parameter is less than or equal to the second parameter threshold, the gray-scale value of pixel in described image connectivity territory is set to described second value, and described first parameter threshold is greater than described second parameter threshold.
18. devices as claimed in claim 16, it is characterized in that, described device also comprises:
Display module, for when described angle is greater than described specified angle threshold value, display reminding information, obtains described pending image again to point out user.
19. 1 kinds of image preprocess apparatus, is characterized in that, described device comprises:
Processor;
For the storer of storage of processor executable instruction;
Wherein, described processor is configured to:
Based on pending image, determine the bianry image of each place, border image-region of card;
For each border described, from the bianry image of place, described border image-region, obtain many line segments, the pixel that described many line segments are the first numerical value by multiple gray-scale value is respectively formed;
Based on described many line segments, pre-service is carried out to the bianry image of place, described border image-region.
CN201510463446.2A 2015-07-31 2015-07-31 Image pre-processing method and device Active CN105046260B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510463446.2A CN105046260B (en) 2015-07-31 2015-07-31 Image pre-processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510463446.2A CN105046260B (en) 2015-07-31 2015-07-31 Image pre-processing method and device

Publications (2)

Publication Number Publication Date
CN105046260A true CN105046260A (en) 2015-11-11
CN105046260B CN105046260B (en) 2019-01-04

Family

ID=54452789

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510463446.2A Active CN105046260B (en) 2015-07-31 2015-07-31 Image pre-processing method and device

Country Status (1)

Country Link
CN (1) CN105046260B (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107111882A (en) * 2016-03-22 2017-08-29 广东虚拟现实科技有限公司 Striped set lookup method, device and system
CN107223265A (en) * 2016-03-22 2017-09-29 广东虚拟现实科技有限公司 Striped set lookup method, device and system
CN107767538A (en) * 2017-11-07 2018-03-06 深圳怡化电脑股份有限公司 Gather method, apparatus, ATM and the storage medium of bank note CIS images
CN108918348A (en) * 2018-08-03 2018-11-30 中国科学院力学研究所 Gas liquid film movement speed acquisition methods in a kind of micron capillary tube passage
CN109146970A (en) * 2018-08-03 2019-01-04 中国科学院力学研究所 The contact angle acquisition methods of gas-liquid two-phase dynamic displacement image in micron capillary column
CN109525882A (en) * 2018-11-30 2019-03-26 中国联合网络通信集团有限公司 A kind of synchronous broadcast method, bridging device and sink device
CN110505459A (en) * 2019-08-16 2019-11-26 域鑫科技(惠州)有限公司 Suitable for the image color correction method of endoscope, device and storage medium
CN110872861A (en) * 2018-08-31 2020-03-10 魔水科技(北京)有限公司 Intelligent water spraying rod, intelligent toilet lid and flushing system integrated with visual function
CN111986173A (en) * 2020-08-18 2020-11-24 创新奇智(合肥)科技有限公司 Method and device for acquiring straight-segment graph

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101957995A (en) * 2010-10-14 2011-01-26 华中科技大学 Method for detecting and extracting correlation pixels in image and application thereof
CN103489254B (en) * 2012-06-11 2017-04-12 深圳信息职业技术学院 Lottery recognition method and lottery recognition system
CN103400150B (en) * 2013-08-14 2017-07-07 浙江大学 A kind of method and device that road edge identification is carried out based on mobile platform
CN104504684B (en) * 2014-12-03 2017-05-24 小米科技有限责任公司 Edge extraction method and device

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107111882A (en) * 2016-03-22 2017-08-29 广东虚拟现实科技有限公司 Striped set lookup method, device and system
WO2017161495A1 (en) * 2016-03-22 2017-09-28 广东虚拟现实科技有限公司 Stripe-set search method, device, and system
CN107223265A (en) * 2016-03-22 2017-09-29 广东虚拟现实科技有限公司 Striped set lookup method, device and system
US10915750B2 (en) 2016-03-22 2021-02-09 Guangdong Virtual Reality Technology Co., Ltd. Method and device for searching stripe set
CN107223265B (en) * 2016-03-22 2020-11-27 广东虚拟现实科技有限公司 Stripe set searching method, device and system
CN107767538A (en) * 2017-11-07 2018-03-06 深圳怡化电脑股份有限公司 Gather method, apparatus, ATM and the storage medium of bank note CIS images
CN108918348B (en) * 2018-08-03 2020-01-17 中国科学院力学研究所 Method for acquiring moving speed of gas-liquid phase interface in micron capillary channel
CN109146970B (en) * 2018-08-03 2019-12-03 中国科学院力学研究所 The contact angle acquisition methods of gas-liquid two-phase dynamic displacement image in micron capillary column
CN109146970A (en) * 2018-08-03 2019-01-04 中国科学院力学研究所 The contact angle acquisition methods of gas-liquid two-phase dynamic displacement image in micron capillary column
CN108918348A (en) * 2018-08-03 2018-11-30 中国科学院力学研究所 Gas liquid film movement speed acquisition methods in a kind of micron capillary tube passage
CN110872861A (en) * 2018-08-31 2020-03-10 魔水科技(北京)有限公司 Intelligent water spraying rod, intelligent toilet lid and flushing system integrated with visual function
CN109525882A (en) * 2018-11-30 2019-03-26 中国联合网络通信集团有限公司 A kind of synchronous broadcast method, bridging device and sink device
CN109525882B (en) * 2018-11-30 2021-08-31 中国联合网络通信集团有限公司 Synchronous playing method, bridging equipment and sink equipment
CN110505459A (en) * 2019-08-16 2019-11-26 域鑫科技(惠州)有限公司 Suitable for the image color correction method of endoscope, device and storage medium
CN111986173A (en) * 2020-08-18 2020-11-24 创新奇智(合肥)科技有限公司 Method and device for acquiring straight-segment graph

Also Published As

Publication number Publication date
CN105046260B (en) 2019-01-04

Similar Documents

Publication Publication Date Title
CN105069786A (en) Straight line detection method and straight line detection device
CN105046260A (en) Image pre-processing method and apparatus
CN105528606A (en) Region identification method and device
CN105528600A (en) Region identification method and device
CN105139415A (en) Foreground and background segmentation method and apparatus of image, and terminal
CN105528602A (en) Region identification method and device
CN105095881A (en) Method, apparatus and terminal for face identification
CN105426818A (en) Area extraction method and device
CN105488511A (en) Image identification method and device
CN104504684A (en) Edge extraction method and device
CN105046231A (en) Face detection method and device
CN104850852A (en) Feature vector calculation method and device
CN105139378A (en) Card boundary detection method and apparatus
CN104238912A (en) Application control method and application control device
CN104899610A (en) Picture classification method and device
CN105404382A (en) Power saving mode setting method and apparatus
CN104731688A (en) Method and device for prompting reading schedule
CN104574299A (en) Face picture processing method and device
CN105205494A (en) Similar picture identification method and device
CN104484871A (en) Method and device for extracting edges
CN104361558A (en) Image processing method, device and equipment
CN106598429A (en) Method and device for adjusting window of mobile terminal
CN105095860A (en) Method and device for character segmentation
CN104517271A (en) Image processing method and device
CN105975961A (en) Human face recognition method, device and terminal

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant