CN113298812A - Image segmentation method, device, system, electronic equipment and readable storage medium - Google Patents

Image segmentation method, device, system, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN113298812A
CN113298812A CN202110435795.9A CN202110435795A CN113298812A CN 113298812 A CN113298812 A CN 113298812A CN 202110435795 A CN202110435795 A CN 202110435795A CN 113298812 A CN113298812 A CN 113298812A
Authority
CN
China
Prior art keywords
image
line
foreground
image data
lines
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
CN202110435795.9A
Other languages
Chinese (zh)
Other versions
CN113298812B (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.)
China Electronic Product Reliability and Environmental Testing Research Institute
Original Assignee
China Electronic Product Reliability and Environmental Testing Research Institute
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 China Electronic Product Reliability and Environmental Testing Research Institute filed Critical China Electronic Product Reliability and Environmental Testing Research Institute
Priority to CN202110435795.9A priority Critical patent/CN113298812B/en
Publication of CN113298812A publication Critical patent/CN113298812A/en
Application granted granted Critical
Publication of CN113298812B publication Critical patent/CN113298812B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge 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/30Subject of image; Context of image processing
    • G06T2207/30242Counting objects in image

Abstract

The application relates to the technical field of image processing, and particularly discloses an image segmentation method, an image segmentation device, an image segmentation system, electronic equipment and a readable storage medium, wherein the method comprises the following steps: acquiring image data of the paper flow line by line, wherein each line of image data comprises a plurality of pixels; acquiring a gray-scale value of each pixel in each line of image data; and determining a plurality of groups of adjacent image starting lines and image ending lines according to the gray-scale values of the pixels, and separately storing the image data between each group of adjacent image starting lines and image ending lines. A photoelectric sensor is not needed, the simplicity of paper stream cutting is improved, the storage of useless images is avoided, the waste of storage space is avoided, and meanwhile, the cutting and storage efficiency is also improved.

Description

Image segmentation method, device, system, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image segmentation method, an image segmentation apparatus, an image segmentation system, an electronic device, and a readable storage medium.
Background
In real life, there are many industrial applications like continuous multiple paper collection and scanning, such as automatic counting and identification of paper money, automatic counting and identification of bills, automatic continuous scanning and preservation of multiple paper, etc., in which a linear image sensor is often required to perform image sampling, storage, transmission and processing on multiple paper moving continuously. This relates to how a plurality of images obtained by consecutive scanning are divided, stored separately, processed separately, and the like.
The photoelectric sensor and the image sensor are used in cooperation to realize cutting and sheet separation storage of paper flow, wherein if the distance between the photoelectric sensor and the image sensor is too far, the image boundary state cannot be directly reflected, so the photoelectric sensor and the image sensor need to be arranged relatively close to each other, the photoelectric sensor often needs to be provided with a transmitting device and a receiving device on the front side and the back side of a target object, an external mounting support is needed, the size of the whole device is increased undoubtedly, the cost is increased, and the use scene of the image sensor is limited.
Disclosure of Invention
Based on this, it is necessary to provide an image segmentation method, an image segmentation device, an image segmentation system, an electronic device and a readable storage medium for solving the problem that the cutting and sheet storage processes of a paper stream have a large dependence on a photosensor.
An image segmentation method for segmenting a stream of paper sheets by sheet, the image segmentation method comprising:
acquiring image data of the paper flow line by line, wherein each line of image data comprises a plurality of pixels;
acquiring a gray-scale value of each pixel in each line of image data;
and determining a plurality of groups of adjacent image starting lines and image ending lines according to the gray-scale values of the pixels, and separately storing the image data between each group of adjacent image starting lines and image ending lines.
In one embodiment, the step of obtaining the gray-scale value of each pixel in each line of image data includes:
and performing analog-to-digital conversion on the analog quantity of each pixel in each line of image data to obtain the gray-scale value of each pixel.
In one embodiment, the step of determining a plurality of sets of adjacent image start lines and image end lines according to the gray-scale values of the pixels, and separately storing the image data between each set of adjacent image start lines and image end lines comprises:
comparing the gray-scale value of each pixel of the image data of the same row with a preset threshold one by one, if the comparison result meets a preset condition, accumulating the foreground counts, further determining the foreground counts accumulated in the row, and repeating the steps to determine the foreground counts accumulated in each row;
when the foreground count accumulated in the front row changes from 0 to non-0 to the foreground count accumulated in the rear row, identifying the initial row of the image of the rear row;
and calling a new storage unit, storing image data of each line behind the initial line of the image in the new storage unit, identifying an image ending line of a following line when the foreground counting in the forward line changes to the foreground counting in the following line from 0 to 0, and stopping storing the image data behind the image ending line in the storage unit.
In one embodiment, in the step of comparing the gray-scale values of the pixels in the same row of image data with the preset threshold one by one, if the comparison result meets the preset condition, the foreground count is accumulated,
when the image data is a reflection-type image, if the gray-scale value of the pixel is greater than the preset threshold value, the foreground count is accumulated;
and when the image data is a transmission type image, if the gray-scale value of the pixel is smaller than the preset threshold value, accumulating the foreground count.
In one embodiment, in the step of identifying the starting line of the following line image when the foreground count accumulated in the preceding line changes from 0 to non-0 to the foreground count accumulated in the following line,
if the foreground count accumulated in the front row changes from 0 to non-0 to the foreground count accumulated in the rear row, judging whether the foreground counts of the n rows behind the rear row are all non-0;
and if the foreground counts of the n lines after the next line are all not 0, determining that the image of the next line is the initial line of the image.
In one embodiment, when the foreground count of the preceding row changes to the foreground count of the following row by a value other than 0 to 0, the step of identifying the image ending row of the following row,
if the foreground count accumulated in the front row changes from 0 to 0, judging whether the foreground counts of the n rows behind the back row are all 0;
and if the foreground counts of the n lines after the next line are all 0, determining that the image of the next line is an end line.
An image splitting apparatus for splitting a sheet stream by sheets, the image splitting apparatus comprising:
the acquisition module is used for acquiring image data of the paper flow line by line, and each line of image data comprises a plurality of pixels;
the acquisition module is used for acquiring the gray-scale value of each pixel in each line of image data;
and the determining module is used for determining a plurality of groups of adjacent image starting lines and image ending lines according to the gray-scale value of each pixel, and storing the image data between each group of adjacent image starting lines and image ending lines separately.
An image segmentation system is used for performing sheet-by-sheet segmentation on a paper flow and comprises an image sensor, an analog-to-digital converter, a control chip and a plurality of storage units;
the image sensor is used for acquiring the image data of the paper flow line by line, and each line of image data comprises a plurality of pixels;
the analog-to-digital converter is connected with the image sensor and is used for acquiring the gray-scale value of each pixel in each line of image data;
the control chip is connected with the analog-to-digital converter and used for determining a plurality of groups of adjacent image starting lines and image ending lines according to the gray-scale value of each pixel and correspondingly storing image data between each group of adjacent image starting lines and each group of adjacent image ending lines in each storage unit respectively.
An electronic device comprising a memory storing a computer program and a processor implementing the image segmentation method as described above when the processor executes the computer program.
A computer readable storage medium having stored therein computer instructions which, when executed by a processor, implement the image segmentation method as described above.
The image segmentation method comprises the steps of firstly collecting image data of a paper flow line by line, wherein each line of image data comprises a plurality of pixels, then obtaining the gray-scale value of each pixel in each line of image data, then determining a plurality of groups of adjacent image starting lines and image ending lines according to the gray-scale value of each pixel, and independently storing the image data between each group of adjacent image starting lines and each group of adjacent image ending lines. Therefore, the transmission position of paper does not need to be sensed through an external photoelectric sensor, only image data of a paper stream need to be acquired line by line, adjacent image starting lines and image ending lines are determined according to the gray-scale value of each line of pixels, the image data between the adjacent image starting lines and the adjacent image ending lines are used as an independent image, the independent image is cut and stored in an independent storage unit, a plurality of groups of adjacent image starting lines and image ending lines can be determined according to the independent image, then the independent images are cut, each image is independently stored in each storage unit, and cutting and separate storage of the paper stream are achieved. In the mode, a photoelectric sensor is not required to be arranged, the simplicity and convenience of paper stream cutting are improved, the storage of useless images is avoided, the waste of storage space is avoided, and the cutting and storage efficiency is improved.
Drawings
Fig. 1 is a flowchart of an image segmentation method according to an embodiment of the present application;
FIG. 2 is a timing chart of output data of an image sensor in an image segmentation method according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of the conveyance of a sheet stream;
fig. 4 is a flowchart of step S600 in an image segmentation method according to an embodiment of the present application;
fig. 5 is a diagram illustrating a change of foreground counts in each row when a moving direction of a sheet is perpendicular to a long side of an image sensor in an image segmentation method according to an embodiment of the present disclosure;
fig. 6 is a diagram illustrating a change of foreground counts in each row when a moving direction of a sheet of paper is not perpendicular to a long side of an image sensor in an image segmentation method according to an embodiment of the present disclosure;
fig. 7 is a diagram illustrating the effect of split storage in an image segmentation method according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an image segmentation system according to a third embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present application.
Detailed Description
To facilitate an understanding of the invention, the invention will now be described more fully with reference to the accompanying drawings. Preferred embodiments of the present invention are shown in the drawings. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; they may be directly connected or indirectly connected through intervening media, or they may be connected internally or in any other suitable relationship, unless expressly stated otherwise. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
The terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
As described in the background, in industrial applications, there are many scenarios like continuous multiple paper collection and scanning, such as automatic counting and recognition of banknotes, automatic counting and recognition of bills, automatic continuous scanning and preservation of multiple papers, and the like. In the above applications, it is often necessary to use a linear image sensor to sample, store, transport and process images of a plurality of continuously moving sheets, wherein the image processing method involves dividing, storing and processing the images obtained by the continuous scanning.
In the conventional method, a photoelectric switch is generally used as a sensor to sense whether a sheet is present thereon, and if so, the state "1" is presented, otherwise, the state "0" is presented. In consideration of the size of paper, two photoelectric sensors are generally arranged side by side, the state of the two photoelectric sensors is subjected to the combined logical operation of AND or OR, the passing condition of the paper is judged, and then the image stream is divided according to the state of the sensors, so that the separate storage and identification are realized.
However, there are several drawbacks when using photosensors to assist in achieving segmentation and storing of image streams in separate sheets. Firstly, the distance between the photoelectric sensor and the image sensor is not suitable for too far, because the paper may rotate or translate in the transmission process, if the distance between the photoelectric sensor and the image sensor is too far, the state of the photoelectric sensor cannot directly reflect the image boundary state of the image flow, and the arrangement of the image sensor is limited; secondly, the cost and the volume are increased, especially for a perspective photoelectric sensor, the transmitting device and the receiving device are required to be respectively installed on the front side and the back side of a target object, an external support is required to be installed, and the use scene of the image sensor is greatly limited.
From the above, the arrangement of the photosensors brings about great limitations in the segmentation and storage of the image stream. In order to solve the problem, embodiments of the present application provide an image segmentation method, an image segmentation apparatus, an image segmentation system, an electronic device, and a computer-readable storage medium.
Example one
The present embodiment provides an image segmentation method for segmenting a sheet stream on a sheet-by-sheet basis. Referring to fig. 1, the image segmentation method includes the steps of:
s200, acquiring image data of the paper flow line by line, wherein each line of image data comprises a plurality of pixels;
s400, acquiring a gray-scale value of each pixel in each line of image data;
step S600, determining a plurality of groups of adjacent image starting lines and image ending lines according to the gray-scale value of each pixel, and separately storing the image data between each group of adjacent image starting lines and image ending lines.
According to the image segmentation method, the transmission position of the paper is not required to be sensed through an external photoelectric sensor, only image data of the paper flow is acquired line by line, the adjacent image starting line and the image ending line are determined according to the gray-scale value of each line of pixels, the image data between the adjacent image starting line and the adjacent image ending line is used as an independent image, the independent image is cut and stored in an independent storage unit, a plurality of groups of adjacent image starting lines and image ending lines can be determined according to the independent image starting line and the image ending line, then the independent images are cut, each image is independently stored in each storage unit, and cutting and separate storage of the paper flow are achieved. In the mode, a photoelectric sensor is not required to be arranged, the simplicity and convenience of paper stream cutting are improved, the storage of useless images is avoided, the waste of storage space is avoided, and the cutting and storage efficiency is improved.
In step S200, image data of the paper stream may be acquired line by an image sensor such as a linear CCD (Charge coupled Device) or a CIS (contact image sensor). The image data of the paper stream is output in a row unit, for example, an image sensor with a clock of 16Mhz and a lateral resolution of 1534, the image data of each row can be output simultaneously in three segments, so that the output time of one row of pixels can be shortened, the longitudinal resolution of linear scanning can be improved, 640 clocks are required for each row of output, and in the continuous acquisition mode, the image data is output at a frequency of 25k rows/second, and 1534 pixels are output for each row.
The image data of each line acquired by the image sensor can be divided into three sections and output simultaneously, and the number of pixels corresponding to the effective scanning width of the image sensor is not necessarily a multiple of 3, so that the number of pixels in the three sections is not necessarily equal, and in engineering application, the data can be acquired according to the inherent output characteristics of the image sensor and the pixels can be adjusted to be spliced into a complete line of images.
As shown in fig. 2, when outputting one row of pixels, the first segment SIG1 outputs 574 pixels in total, the second segment SIG2 outputs 574 pixels in total, and the third segment SIG3 outputs 432 pixels in total. Outputting pixels in a row needs 640 clocks, firstly, an image starting position of each row can be identified by adopting edge identification logic, namely, the state of an SI signal can be read in each clock beat, if the SI signal in the current clock beat is low and the SI signal in the last clock beat is high, a falling edge is identified, and the position corresponding to the falling edge is taken as the image starting position of the row; then, 64 idle clocks are waited after the image starting position, and in the 64 idle clocks, the charge of a photosensitive device of the image sensor is accumulated and converted into voltage; in 432 clocks after 64 idle clocks, an image effective window signal keeps a pull-up state, namely, 432 pixels are simultaneously output in three segments; for the next 144 clocks, the first segment and the second segment continue to output 144 pixels; and after the transmission of the pixels in one row is finished, pulling down the effective window signal of the image until the image data of the next row arrives, and repeating the steps.
In practical application, referring to fig. 3, a plurality of separated paper sheets such as paper money or bills may be placed on the conveyor belt in advance, the conveyor belt conveys a paper sheet stream under the driving of the synchronizing wheel, and the image sensor is responsible for acquiring image data of the paper sheet stream passing through the image sensor line by line.
In one embodiment, step S400, acquiring the gray-scale values of the pixels in the image data of each line, includes:
step S410, performing analog-to-digital conversion on the analog quantity of each pixel in each line of image data to obtain a gray-scale value of each pixel.
Specifically, the analog quantity of each pixel in each line of image data may be converted into a digital quantity by an ADC analog-to-digital converter, resulting in a gray-scale value of each pixel. The working clock of the ADC is more than 3 times of the working clock of the image sensor, and in one working clock of one image sensor, the ADC performs analog-to-digital conversion on three pixels simultaneously output by the image sensor through the three working clocks to obtain gray-scale values of the three pixels, so that analog-to-digital conversion on three segments of simultaneously output pixels can be simultaneously completed under the working clock of the image sensor.
And in the effective window of the image, when each ADC working clock is at a rising edge, performing analog-to-digital conversion, and when each ADC working clock is at a falling edge, reading a conversion result.
In one embodiment, referring to fig. 4, step S600, namely, the step of determining a plurality of sets of adjacent image start lines and image end lines according to the gray-scale values of the pixels, and separately storing the image data between each set of adjacent image start lines and image end lines, comprises the steps of:
and step S610, comparing the gray-scale value of each pixel of the image data of the same row with a preset threshold one by one, if the comparison result meets the preset condition, accumulating the foreground counts, further determining the foreground counts obtained by accumulating the row, and so on, and determining the foreground counts obtained by accumulating each row.
After the gray-scale values of the pixels in each line of image data are obtained, the gray-scale values of the pixels in the same line can be compared with a preset threshold value one by one, if the comparison result meets the preset condition, the foreground counts are accumulated, and when the comparison of the gray-scale values of the pixels in the same line is finished, the foreground counts obtained by the line in the final accumulation mode are determined. Each row corresponds to a foreground count representing the comparison result of the gray-scale values of the pixels in the row. The foreground count for each row may be determined according to the method described above.
In practical application, when an image effective window signal of each line is in a pull-up state, a conversion result of the ADC to the pixel, i.e., a gray level value, is sequentially read according to a time sequence, the gray level value is compared with a preset threshold, if a preset condition is met, the foreground count is +1, otherwise, the foreground count remains unchanged, and the foreground counts are accumulated in this way to obtain foreground counts of each line. For example, the foreground count in the first row is Front _ cnt _1, the foreground count in the second row is Front _ cnt _2, and so on, the foreground count in the nth row is Front _ cnt _ n, and during the process that the same paper enters the scanning range of the image sensor and leaves the scanning range of the image sensor, the Front _ cnt _ n gradually increases and then gradually decreases, and if the moving direction of the paper is perpendicular to the long side of the image sensor, the Front _ cnt _ n will be in the shape of a square wave (see fig. 5), otherwise, the Front _ cnt _ n will be in the shape of a trapezoidal wave (see fig. 6).
And step S620, when the foreground count accumulated in the front row changes from 0 to non-0 to the foreground count accumulated in the rear row, identifying the image starting row of the rear row.
Assuming that the foreground count of the n-1 th line is 0 and the foreground count of the nth line is greater than 0, the nth line may be identified as the image start line.
Step S630, invoking a new storage unit, storing image data of each line after the image start line in the new storage unit, until the foreground count in the forward line changes to the foreground count in the backward line by a value other than 0 to 0, identifying the image end line in the backward line, and stopping storing the image data after the image end line in the storage unit.
When the foreground count is from 0 to non-0, which indicates that a new image is scanned, a new storage unit can be called to separately store image data of each line after the initial line of the image into the new storage unit, so as to realize the separate storage of the image. In the subsequent process, if the foreground count has a change from 0 to 0, which indicates that the new image is scanned completely, the image end line is identified, and the storage of the subsequent image data into the storage unit is stopped, thereby completing the independent storage of the image. When facing the paper flow, each paper can be stored into the corresponding storage unit by the method, so that the paper flow can be divided and stored in a sheet-by-sheet mode.
In one embodiment, in step S610, comparing the gray-scale values of the pixels in the same row of image data with a predetermined threshold one by one, if the comparison result meets a predetermined condition, then the foreground count is accumulated,
when the image data is a reflection-type image, if the gray-scale value of the pixel is greater than the preset threshold value, the foreground count is accumulated;
and when the image data is a transmission type image, if the gray-scale value of the pixel is smaller than the preset threshold value, accumulating the foreground count.
In the case of a reflection type image, the gray scale of the foreground (target sheet) is much higher than that of the background, and in the case of a transmission type image, the gray scale of the foreground (target sheet) is much lower than that of the background, and therefore, the judgment criteria for the foreground are different for different types of images.
Specifically, for a reflection-type image, a first preset threshold value is set, if the gray-scale value of a pixel is greater than the first preset threshold value, the pixel is regarded as a foreground, and foreground counting is accumulated; and setting a second preset threshold value for the transmission type image, and if the gray-scale value of the pixel is smaller than the second preset threshold value, determining that the pixel is a foreground, and counting and accumulating the foreground. For the reflection type image, the background gray scale is usually less than 60, the first preset threshold value may be set to be 80, for the transmission type image, the background gray scale is usually greater than 200, and the second preset threshold value may be set to be 180.
In one embodiment, in the step of identifying the starting line of the following line image when the foreground count accumulated in the preceding line changes from 0 to non-0 to the foreground count accumulated in the following line,
if the foreground count accumulated in the front row changes from 0 to non-0 to the foreground count accumulated in the rear row, judging whether the foreground counts of the n rows behind the rear row are all non-0;
and if the foreground counts of the n lines after the next line are all not 0, determining that the image of the next line is the initial line of the image.
That is, in order to avoid misjudgment, when the foreground count is detected to have a change from 0 to non-0, the image start line is not directly identified, but the foreground counts of the next n lines are all judged, if all the foreground counts are non-0, a new image is determined to be scanned, and the image start line is identified. Therefore, the storage of useless images caused by misjudgment can be avoided, and the utilization rate of the storage space is improved.
The foreground counts of the 4 or 5 or 6 lines after the subsequent line can be determined, and the number of the continuously determined lines can be set according to actual requirements. In this embodiment, it is preferable to determine the foreground count of 5 lines after the subsequent line, so that the calculation resource is saved while avoiding erroneous determination.
In one embodiment, when the foreground count of the preceding row changes to the foreground count of the following row by a value other than 0 to 0, the step of identifying the image ending row of the following row,
if the foreground count accumulated in the front row changes from 0 to 0, judging whether the foreground counts of the n rows behind the back row are all 0;
and if the foreground counts of the n lines after the next line are all 0, determining that the image of the next line is an end line.
That is, in order to avoid erroneous determination, when a foreground count is detected to have a change from 0 to 0, the image end line is not directly identified, but the foreground counts of the next n lines are all determined, and if all the foreground counts are 0, it is determined that the image scanning is ended, and at this time, the image end line is identified. Therefore, the storage of useless images caused by misjudgment can be avoided, and the utilization rate of the storage space is improved.
The foreground counts of the 4 or 5 or 6 lines after the subsequent line can be determined, and the number of the continuously determined lines can be set according to actual requirements. In this embodiment, it is preferable to determine the foreground count of 5 lines after the subsequent line, so that the calculation resource is saved while avoiding erroneous determination.
The above method is explained below with a specific example:
the FPGA controls the whole logic by using a state machine, and the specific logic control is as follows:
firstly, entering a state waiting, resetting foreground counting, judging whether the window is an image effective window of a line of image data, if so, entering a state counting, otherwise, keeping the original state.
In the state counting, the pixel gray level value gray _ n on the data bus is read out according to the time sequence of the ADC, and whether the reflection type image logic or the transmission type image logic is adopted is judged, if the gray _ n is greater than the first preset threshold gray _ th1, the foreground count front _ counter is added with 1, otherwise the front _ counter remains unchanged (80 is usually taken by gray _ th1, and the background gray level is less than 60 in the reflection type image), if the gray _ n is less than the second preset threshold gray _ th2, the front _ counter is added with 1, otherwise the front _ counter remains unchanged (180 is usually taken by gray _ th2, and the background gray level is greater than 200 in the transmission type image). And after the image effective window is finished, exiting the counting state, entering the analy state, and keeping the count of the counter unchanged.
In the analy state, the foreground count value of the current nth row is marked as counter _ n, the accumulated counter _ n is analyzed, if the counter _ n-1 to the counter _ n change from 0 to non-0, a filtering procedure is entered (the filtering threshold is 5, namely the behavior continuously exceeds 5 and is non-zero), and if the behavior is non-zero, the image is marked as the initial row. And simultaneously, an instruction for switching the storage area to the next unit is sent to the DSP (the DSP triggers the falling edge interruption by pulling high and then pulling low through the state of an IO pin, and switches the address pointer of the storage area in the interruption program), and the subsequent images are stored in a new unit interval. If the change from non-zero to zero occurs in the counter _ n-1 to counter _ n, the filtering procedure is also entered (the filtering threshold is 5, i.e. zero is considered when the behavior continuously exceeds 5), if the filtering procedure is zero, the image is identified as the end line of the image, and at this time, the image without foreground is no longer sent to the DSP, and the state of waiting is entered, and the process is repeated. In the waiting state, the DSP has essentially no interruption, and all time slices are centered on the algorithm computation.
The effect of the final split storage is shown in fig. 7.
Example two
The embodiment provides an image segmentation device for performing sheet-by-sheet segmentation on a paper sheet stream, and the image segmentation device comprises a sampling module, an acquisition module and a determination module.
The acquisition module is used for acquiring image data of the paper flow line by line, and each line of image data comprises a plurality of pixels;
the acquisition module is used for acquiring the gray-scale value of each pixel in each line of image data;
the determining module is used for determining a plurality of groups of adjacent image starting lines and image ending lines according to the gray-scale values of the pixels, and storing the image data between each group of adjacent image starting lines and image ending lines separately.
According to the image segmentation device, the transmission position of paper does not need to be sensed through an external photoelectric sensor, the image data of the paper flow only needs to be acquired line by line through the acquisition module, the adjacent image starting line and the image ending line are determined according to the gray-scale value of each line of pixels, the image data between the adjacent image starting line and the image ending line is taken as an independent image and is cut and stored in an independent storage unit, a plurality of groups of adjacent image starting lines and image ending lines can be determined according to the image starting line and the image ending line, then a plurality of independent images are cut, each image is independently stored in each storage unit, and cutting and separate storage of the paper flow are achieved. In the mode, a photoelectric sensor is not required to be arranged, the simplicity and convenience of paper stream cutting are improved, the storage of useless images is avoided, the waste of storage space is avoided, and the cutting and storage efficiency is improved.
In one embodiment, the obtaining module is configured to perform analog-to-digital conversion on the analog quantity of each pixel in each line of image data to obtain a gray-scale value of each pixel.
In one embodiment, the determining module is configured to:
comparing the gray-scale value of each pixel of the image data of the same row with a preset threshold one by one, if the comparison result meets a preset condition, accumulating the foreground counts, further determining the foreground counts accumulated in the row, and repeating the steps to determine the foreground counts accumulated in each row;
when the foreground count accumulated in the front row changes from 0 to non-0 to the foreground count accumulated in the rear row, identifying the initial row of the image of the rear row;
and calling a new storage unit, storing image data of each line behind the initial line of the image in the new storage unit, identifying an image ending line of a following line when the foreground counting in the forward line changes to the foreground counting in the following line from 0 to 0, and stopping storing the image data behind the image ending line in the storage unit.
In one embodiment, when the image data is a reflection-type image, if the gray-scale value of a pixel is greater than the preset threshold, the foreground count is accumulated;
and when the image data is a transmission type image, if the gray-scale value of the pixel is smaller than the preset threshold value, accumulating the foreground count.
In one embodiment, if the foreground count accumulated in the previous row changes from 0 to non-0 to the foreground count accumulated in the next row, determining whether the foreground counts of n rows after the next row are all non-0;
and if the foreground counts of the n lines after the next line are all not 0, determining that the image of the next line is the initial line of the image.
In one embodiment, if the foreground count accumulated in the previous row changes from 0 to 0, the foreground count accumulated in the next row is determined to be 0;
and if the foreground counts of the n lines after the next line are all 0, determining that the image of the next line is an end line.
The image segmentation apparatus provided in this embodiment and the image segmentation method provided in the first embodiment belong to the same inventive concept, and for specific contents of the image segmentation apparatus, reference may be made to corresponding descriptions in the first embodiment, which are not described herein again.
EXAMPLE III
The present embodiment provides an image segmentation system for segmenting a stream of sheets by sheet. Referring to fig. 8, the image segmentation system includes an image sensor 100, an analog-to-digital converter 200, a control chip 300, and a number of memory units 400;
the image sensor 100 is configured to acquire image data of the paper stream line by line, where each line of image data includes a plurality of pixels;
the analog-to-digital converter 200 is connected to the image sensor 100, and is configured to obtain a gray-scale value of each pixel in each line of image data;
the control chip 300 is connected to the analog-to-digital converter 200, and configured to determine a plurality of groups of adjacent image start lines and image end lines according to the gray-scale value of each pixel, and respectively store image data between each group of adjacent image start lines and each group of adjacent image end lines in the storage units 400 correspondingly.
According to the image segmentation system, the transmission position of paper does not need to be sensed through an external photoelectric sensor, only image data of a paper stream need to be acquired line by line through the image sensor, adjacent image starting lines and image ending lines are determined according to the gray-scale value of each line of pixels, the image data between the adjacent image starting lines and the adjacent image ending lines are used as an independent image and are cut and stored in an independent storage unit, a plurality of groups of adjacent image starting lines and image ending lines can be determined according to the independent image starting lines and the image ending lines, then a plurality of independent images are cut, each image is independently stored in each storage unit, and cutting and separate storage of the paper stream are achieved. In the mode, a photoelectric sensor is not required to be arranged, the simplicity and convenience of paper stream cutting are improved, the storage of useless images is avoided, the waste of storage space is avoided, and the cutting and storage efficiency is improved.
In practical application, a plurality of paper such as paper currency or bills after being separated can be placed on the conveyer belt in advance, the conveyer belt conveys the paper flow under the driving of the synchronizing wheel, and the image sensor is arranged at the preset position of the conveyer belt and is responsible for acquiring the image data of the paper flow passing through the image sensor line by line.
In one embodiment, the control chip may include an FPGA chip, the image data of the paper stream is divided by sheets through the FPGA chip, and when an image start line is identified, an instruction for switching the storage area to the next storage unit is sent to the DSP, so that the DSP switches the storage area address pointer in the interrupt program, and stores the subsequent image in the new storage unit; when the image end line is identified, the image is stopped from being stored in the storage unit. Thus, sheet-by-sheet cutting and sheet-by-sheet storage are realized.
The edges are recognized by adopting the image, judgment is not needed by means of the combinational logic of an external photoelectric sensor group, the work independence and the application applicability of the image sensor are increased, and the image sensor can be used for real-time and uninterrupted acquisition and analysis of a plurality of bill type targets on occasions without installing the photoelectric sensor. Meanwhile, the cost is saved, the cost performance of the whole machine can be improved to a certain extent, and the market competitiveness is increased. In addition, transmission and storage of useless images are eliminated to the greatest extent, in the prior art, a fixed line number is adopted or dozens of lines are stored after detection of a photoelectric sensor to avoid that the image of a target object is not completely acquired, transmission and storage of a lot of useless images are brought invisibly, not only is space wasted, but also performance of a processor is wasted, time slices for algorithm analysis and read-write bus control right of a DDR controller are occupied, influence is brought to the performance of the whole machine, the scheme can greatly improve the problems, and the scheme plays a great role in improving the performance of the whole machine and optimization of algorithm operation time.
Example four
The embodiment of the present application provides an electronic device, as shown in fig. 9, including a memory 600 and a processor 700, where the memory 600 and the processor 700 are communicatively connected with each other, and may be connected through a bus or in another manner, and fig. 9 takes the example of connection through a bus as an example.
Processor 700 may be a Central Processing Unit (CPU). The Processor 600 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, or combinations thereof.
The memory 600, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as the image segmentation method in the embodiments of the present invention. The processor 700 executes various functional applications and data processing of the processor 700, i.e., an image segmentation method, by executing non-transitory software programs, instructions, and modules stored in the memory 600.
The memory 600 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created by the processor 700, and the like. Further, the memory 600 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 600 optionally includes memory located remotely from processor 700, which may be connected to the processor via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD), a Solid State Drive (SSD), or the like; the storage medium may also comprise a combination of memories of the kind described above.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. An image segmentation method for segmenting a stream of paper sheets by sheets, the image segmentation method comprising:
acquiring image data of the paper flow line by line, wherein each line of image data comprises a plurality of pixels;
acquiring a gray-scale value of each pixel in each line of image data;
and determining a plurality of groups of adjacent image starting lines and image ending lines according to the gray-scale values of the pixels, and separately storing the image data between each group of adjacent image starting lines and image ending lines.
2. The image segmentation method according to claim 1, wherein the step of obtaining the gray-scale value of each pixel in each line of image data comprises:
and performing analog-to-digital conversion on the analog quantity of each pixel in each line of image data to obtain the gray-scale value of each pixel.
3. The image segmentation method according to claim 1, wherein the step of determining a plurality of sets of adjacent image start lines and image end lines according to the gray-scale values of the pixels, and separately storing the image data between each set of adjacent image start lines and image end lines comprises:
comparing the gray-scale value of each pixel of the image data of the same row with a preset threshold one by one, if the comparison result meets a preset condition, accumulating the foreground counts, further determining the foreground counts accumulated in the row, and repeating the steps to determine the foreground counts accumulated in each row;
when the foreground count accumulated in the front row changes from 0 to non-0 to the foreground count accumulated in the rear row, identifying the initial row of the image of the rear row;
and calling a new storage unit, storing image data of each line behind the initial line of the image in the new storage unit, identifying an image ending line of a following line when the foreground counting in the forward line changes to the foreground counting in the following line from 0 to 0, and stopping storing the image data behind the image ending line in the storage unit.
4. The image segmentation method according to claim 3, wherein in the step of comparing the gray-scale values of the pixels in the same row of image data with a predetermined threshold one by one, and if the comparison result meets a predetermined condition, accumulating the foreground count,
when the image data is a reflection-type image, if the gray-scale value of the pixel is greater than the preset threshold value, the foreground count is accumulated;
and when the image data is a transmission type image, if the gray-scale value of the pixel is smaller than the preset threshold value, accumulating the foreground count.
5. The image segmentation method according to claim 3, wherein in the step of identifying a starting line of the following line image when the foreground count accumulated in the preceding line changes from 0 to non-0 to the foreground count accumulated in the following line,
if the foreground count accumulated in the front row changes from 0 to non-0 to the foreground count accumulated in the rear row, judging whether the foreground counts of the n rows behind the rear row are all non-0;
and if the foreground counts of the n lines after the next line are all not 0, determining that the image of the next line is the initial line of the image.
6. The image segmentation method according to claim 3, wherein in the step of identifying the following-line image end line when a change other than 0 to 0 occurs from the preceding-line foreground count to the following-line foreground count,
if the foreground count accumulated in the front row changes from 0 to 0, judging whether the foreground counts of the n rows behind the back row are all 0;
and if the foreground counts of the n lines after the next line are all 0, determining that the image of the next line is an end line.
7. An image splitting apparatus for splitting a sheet stream by sheets, comprising:
the acquisition module is used for acquiring image data of the paper flow line by line, and each line of image data comprises a plurality of pixels;
the acquisition module is used for acquiring the gray-scale value of each pixel in each line of image data;
and the determining module is used for determining a plurality of groups of adjacent image starting lines and image ending lines according to the gray-scale value of each pixel, and storing the image data between each group of adjacent image starting lines and image ending lines separately.
8. An image segmentation system is used for performing sheet-by-sheet segmentation on a paper flow and is characterized by comprising an image sensor, an analog-to-digital converter, a control chip and a plurality of storage units;
the image sensor is used for acquiring the image data of the paper flow line by line, and each line of image data comprises a plurality of pixels;
the analog-to-digital converter is connected with the image sensor and is used for acquiring the gray-scale value of each pixel in each line of image data;
the control chip is connected with the analog-to-digital converter and used for determining a plurality of groups of adjacent image starting lines and image ending lines according to the gray-scale value of each pixel and correspondingly storing image data between each group of adjacent image starting lines and each group of adjacent image ending lines in each storage unit respectively.
9. An electronic device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the image segmentation method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the image segmentation method according to any one of claims 1 to 7.
CN202110435795.9A 2021-04-22 2021-04-22 Image segmentation method, device, system, electronic equipment and readable storage medium Active CN113298812B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110435795.9A CN113298812B (en) 2021-04-22 2021-04-22 Image segmentation method, device, system, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110435795.9A CN113298812B (en) 2021-04-22 2021-04-22 Image segmentation method, device, system, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN113298812A true CN113298812A (en) 2021-08-24
CN113298812B CN113298812B (en) 2023-11-03

Family

ID=77319991

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110435795.9A Active CN113298812B (en) 2021-04-22 2021-04-22 Image segmentation method, device, system, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN113298812B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030010530A (en) * 2001-07-26 2003-02-05 캐논 가부시끼가이샤 Image processing method, apparatus and system
CN105787954A (en) * 2016-03-28 2016-07-20 中金宝科技发展(北京)有限公司 Image segmentation method for banknote image collection of ATM
CN107331031A (en) * 2017-07-04 2017-11-07 深圳怡化电脑股份有限公司 A kind of recognition methods of note denomination, device, equipment and storage medium
CN109214996A (en) * 2018-08-29 2019-01-15 深圳市元征科技股份有限公司 A kind of image processing method and device
CN110427932A (en) * 2019-08-02 2019-11-08 杭州睿琪软件有限公司 The method and device of multiple document fields in a kind of identification image
US20200320817A1 (en) * 2016-05-20 2020-10-08 Julong Co., Ltd. Banknote management method and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030010530A (en) * 2001-07-26 2003-02-05 캐논 가부시끼가이샤 Image processing method, apparatus and system
CN105787954A (en) * 2016-03-28 2016-07-20 中金宝科技发展(北京)有限公司 Image segmentation method for banknote image collection of ATM
US20200320817A1 (en) * 2016-05-20 2020-10-08 Julong Co., Ltd. Banknote management method and system
CN107331031A (en) * 2017-07-04 2017-11-07 深圳怡化电脑股份有限公司 A kind of recognition methods of note denomination, device, equipment and storage medium
CN109214996A (en) * 2018-08-29 2019-01-15 深圳市元征科技股份有限公司 A kind of image processing method and device
CN110427932A (en) * 2019-08-02 2019-11-08 杭州睿琪软件有限公司 The method and device of multiple document fields in a kind of identification image

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
邹连英;季辉;周莹;余尚仁;: "纸币清分系统中光电图像实时采集方法", 武汉工程大学学报 *

Also Published As

Publication number Publication date
CN113298812B (en) 2023-11-03

Similar Documents

Publication Publication Date Title
US8970920B2 (en) Image processing apparatus and image processing method
AU2013347512B2 (en) Paper currency number recognition apparatus and recognition method
RU2652957C1 (en) System and method for determining banknote jams
CN108805180B (en) Target object detection method and device
JP2013224909A5 (en) Sheet transport device
US9973653B2 (en) Image processing apparatus and image processing method
CN109785632B (en) Traffic flow statistical method and device
US20190182403A1 (en) Scanning device, image-forming apparatus, and scanning method
EP2141633A3 (en) Biometric information reading device and biometric information reading method
CN113298812A (en) Image segmentation method, device, system, electronic equipment and readable storage medium
US11807490B2 (en) Sheet conveying apparatus and image reading apparatus
CN115329822B (en) Pulse identification method and device
CN116935631A (en) Abnormal traffic situation detection method, device and system based on radar fusion
US8861040B2 (en) Image-reading device and computer-readable storage medium configured to determine document edge from plurality of candidate edge points
CN202438473U (en) Chalky rice detecting and sorting device based on digital signal processing technology
CN115174761A (en) Method and device for adjusting image acquisition frequency and image acquisition of camera
US8605337B2 (en) Image scanning device
CN111546793B (en) Processing method and system for paper detection threshold of printer
CN110476155B (en) Algorithm triggered sensor data acquisition
CN111126106B (en) Lane line identification method and device
CN113283417A (en) Image data processing method and device, electronic equipment and medium
CN107464337B (en) Image acquisition method, image acquisition device and terminal equipment
CN111080894A (en) Intelligent currency counting and detecting machine local foreign currency and paper currency automatic coin sorting system and coin sorting method thereof
JP5288890B2 (en) Paper transport device and double feed detection method
JP3614122B2 (en) Reading surface dust detection device for sheet-through document reading system

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
GR01 Patent grant
GR01 Patent grant