A kind of cotton seeds detection system and its detection method based on machine vision
Technical field
The present invention relates to detection technique field more particularly to a kind of cotton seeds detection system based on machine vision and its
Detection method.
Background technique
Currently, Cotton Production kind, based on upland cotton, the new dormancy for harvesting cotton seed is relatively conventional, especially make
With chemical regulator and under the conditions of encountering the rainy equal unfavourable weathers of later period low temperature, the suspend mode of cotton seed is deeper, and control cotton seed is repaired recklessly
Cotton is that considerable major issue is answered in new harvest cotton seeds quality inspection in the process;Machine vision be with machine replace human eye come
A kind of technology for measuring and judging, NI Vision Builder for Automated Inspection are will to be ingested target by machine vision product to be converted into image letter
Number, it sends dedicated image processing system to, obtains the shape information of target subject, according to pixel distribution and brightness, color etc.
Information, is transformed into digitized signal, and picture system carries out various operations to these signals to extract clarification of objective, obtains differentiation
As a result.
Most of existing cotton seeds quality determining method detects cotton seeds by artificial experience, cotton seeds
The subjective error of quality measurements is very big, is unfavorable for raising seedling of cotton, the directly economic loss of meeting cotton planting, detects simultaneously
Efficiency is very low, and therefore, the present invention proposes a kind of cotton seeds detection system and its detection method based on machine vision, to solve
Shortcoming in the prior art.
Summary of the invention
In view of the above-mentioned problems, detection standard can be improved by carrying out cotton seeds quality testing based on machine vision in the present invention
True rate, subjective error is small, while detection efficiency is high, can effectively save detection cycle.
The present invention proposes a kind of cotton seeds detection system based on machine vision, including image capture module and host computer
Module, described image acquisition module connect upper computer module, and the upper computer module includes image pre-processing module, image segmentation
Module and PC machine, described image acquisition module connect image pre-processing module, and the picture acquisition module acquires cotton seeds image,
It is pre-processed again by image of the image pre-processing module to acquisition, described image preprocessing module connects image segmentation mould
Block, described image divides module to pretreated carrying out image threshold segmentation, then carries out histogram analysis, detects cotton seeds matter
Amount, described image preprocessing module connect PC machine with image segmentation module, and the PC machine is for receiving preprocessing module and image
Data after dividing resume module, are analyzed, show that cotton seeds quality measurements are exported.
Further improvement lies in that: memory is embedded in the PC machine, the memory connects image capture module, described
Memory is flash storage, and the memory in the form of BMP files for storing the cotton of image capture module acquisition
Drawing of seeds picture.
Further improvement lies in that: described image acquisition module is the Image Acquisition that Image Acquisition is carried out using sweep optical square
Module.
Further improvement lies in that: described image acquisition module further includes supplementary lighting module, and the supplementary lighting module uses axis light
Source carries out light filling, eliminates reflective and phenomenon of giving out light.
A kind of cotton seeds detection method based on machine vision, comprising the following steps:
Step 1: Image Acquisition is carried out to cotton seeds to be detected using image capture module, and by the image of acquisition
It is transmitted to memory, memory stores image in the form of BMP files, then by image transmitting to preprocessing module;
Step 2: image conversion process, figure are carried out using cotton seeds original image of the image pre-processing module to acquisition
As encoding compression processing, image enhancement and restoration disposal and gray proces, pretreatment image is obtained;
Step 3: Threshold segmentation, filtering processing and Mathematical Morphology are carried out to pretreatment image using image segmentation module
Processing, and the segmented image that treated obtains is transmitted to PC machine;
Step 4: analyzing segmented image data using PC machine, and differentiation detects that cotton seeds quality results are reported,
And result is exported.
Further improvement lies in that: the cotton seeds that image capture module acquires in the step 1 are original to be transmitted to storage
It needs to carry out image pixel value Screening Treatment before device, the pixel value of the cotton seeds image of image capture module acquisition be carried out flat
Homogenizing, obtains average value, takes pixel value close to the cotton seeds image of average value as original image.
Further improvement lies in that: Fourier transformation, Walsh transformation can be used in the step 2 when image conversion process
Or the indirect processing technique of any one in discrete cosine transform changes the array size of original image, reduces original image with this
Calculation amount.
Further improvement lies in that: Threshold segmentation carries out image point using adaptive mean shift algorithm in the step 3
It cuts, expansion process first is carried out to the image after segmentation after Threshold segmentation, so that image difference regional connectivity and being carried out centainly to it
Error compensation, be finally filtered and Mathematical Morphology processing.
The invention has the benefit that detection standard can be improved by carrying out cotton seeds quality testing based on machine vision
True rate, subjective error is small, while detection efficiency is high, can effectively save detection cycle, is image by using sweep optical square
Acquisition module, which carries out cotton seeds Image Acquisition, can be improved the clarity of acquisition image and has adjustable resolution ratio, image
Color is more bright-coloured and edge does not distort, and can provide a stable image basis for detection, improve Detection accuracy.
Detailed description of the invention
Fig. 1 is present system structural framing schematic diagram.
Specific embodiment
In order to realize invention technological means, reach purpose and effect is easy to understand, below with reference to specific implementation
Mode, the present invention is further explained.
Embodiment one
According to Fig. 1, the present embodiment proposes that a kind of cotton seeds detection system based on machine vision, including image are adopted
Collect module and upper computer module, described image acquisition module connects upper computer module, and the upper computer module includes that image is located in advance
Module, image segmentation module and PC machine are managed, described image acquisition module connects image pre-processing module, described as acquisition module is adopted
Collect cotton seeds image, then is pre-processed by image of the image pre-processing module to acquisition, described image preprocessing module
Image segmentation module is connected, described image divides module to pretreated carrying out image threshold segmentation, then carries out histogram analysis, examines
Cotton seeds quality is surveyed, described image preprocessing module connects PC machine with image segmentation module, and the PC machine is for receiving pre- place
Module and image segmentation module are managed treated data, is analyzed, show that cotton seeds quality measurements are exported.
Memory is embedded in the PC machine, the memory connects image capture module, and the memory is deposited for Flash
Reservoir, the memory in the form of BMP files for storing the cotton seeds image of image capture module acquisition.The figure
As acquisition module is the image capture module for carrying out Image Acquisition using sweep optical square.Described image acquisition module further includes mending
Optical module, the supplementary lighting module carry out light filling using coaxial light source, eliminate reflective and phenomenon of giving out light.
A kind of cotton seeds detection method based on machine vision, comprising the following steps:
Step 1: Image Acquisition is carried out to cotton seeds to be detected using image capture module, then carries out image pixel
It is worth Screening Treatment, the pixel value of the cotton seeds image of image capture module acquisition is averaged, average value, capture are obtained
The cotton seeds image of element value close to average value is transmitted to memory as original image, and by the original image of acquisition, stores
Device stores image in the form of BMP files, then by image transmitting to preprocessing module;
Step 2: image conversion process, figure are carried out using cotton seeds original image of the image pre-processing module to acquisition
As encoding compression processing, image enhancement and restoration disposal and gray proces, pretreatment image is obtained, when image conversion process can
Change the array size of original image using the indirect processing technique of Fourier transformation, original image calculation amount is reduced with this;
Step 3: Threshold segmentation, filtering processing and Mathematical Morphology are carried out to pretreatment image using image segmentation module
Processing, and the segmented image that treated obtains is transmitted to PC machine, Threshold segmentation is carried out using adaptive mean shift algorithm
Image segmentation first carries out expansion process to the image after segmentation after Threshold segmentation so that image difference regional connectivity and to its into
The certain error compensation of row, is finally filtered and Mathematical Morphology is handled;
Step 4: analyzing segmented image data using PC machine, and differentiation detects that cotton seeds quality results are reported,
And result is exported.
Embodiment two
According to Fig. 1, the present embodiment proposes that a kind of cotton seeds detection system based on machine vision, including image are adopted
Collect module and upper computer module, described image acquisition module connects upper computer module, and the upper computer module includes that image is located in advance
Module, image segmentation module and PC machine are managed, described image acquisition module connects image pre-processing module, described as acquisition module is adopted
Collect cotton seeds image, then is pre-processed by image of the image pre-processing module to acquisition, described image preprocessing module
Image segmentation module is connected, described image divides module to pretreated carrying out image threshold segmentation, then carries out histogram analysis, examines
Cotton seeds quality is surveyed, described image preprocessing module connects PC machine with image segmentation module, and the PC machine is for receiving pre- place
Module and image segmentation module are managed treated data, is analyzed, show that cotton seeds quality measurements are exported.
Memory is embedded in the PC machine, the memory connects image capture module, and the memory is deposited for Flash
Reservoir, the memory in the form of BMP files for storing the cotton seeds image of image capture module acquisition.The figure
As acquisition module is the image capture module for carrying out Image Acquisition using sweep optical square.Described image acquisition module further includes mending
Optical module, the supplementary lighting module carry out light filling using coaxial light source, eliminate reflective and phenomenon of giving out light.
A kind of cotton seeds detection method based on machine vision, comprising the following steps:
Step 1: Image Acquisition is carried out to cotton seeds to be detected using image capture module, then carries out image pixel
It is worth Screening Treatment, the pixel value of the cotton seeds image of image capture module acquisition is averaged, average value, capture are obtained
The cotton seeds image of element value close to average value is transmitted to memory as original image, and by the original image of acquisition, stores
Device stores image in the form of BMP files, then by image transmitting to preprocessing module;
Step 2: image conversion process, figure are carried out using cotton seeds original image of the image pre-processing module to acquisition
As encoding compression processing, image enhancement and restoration disposal and gray proces, pretreatment image is obtained, when image conversion process can
Change the array size of original image using the indirect processing technique of Walsh transformation, original image calculation amount is reduced with this;
Step 3: Threshold segmentation, filtering processing and Mathematical Morphology are carried out to pretreatment image using image segmentation module
Processing, and the segmented image that treated obtains is transmitted to PC machine, Threshold segmentation is carried out using adaptive mean shift algorithm
Image segmentation first carries out expansion process to the image after segmentation after Threshold segmentation so that image difference regional connectivity and to its into
The certain error compensation of row, is finally filtered and Mathematical Morphology is handled;
Step 4: analyzing segmented image data using PC machine, and differentiation detects that cotton seeds quality results are reported,
And result is exported.
Embodiment three
According to Fig. 1, the present embodiment proposes that a kind of cotton seeds detection system based on machine vision, including image are adopted
Collect module and upper computer module, described image acquisition module connects upper computer module, and the upper computer module includes that image is located in advance
Module, image segmentation module and PC machine are managed, described image acquisition module connects image pre-processing module, described as acquisition module is adopted
Collect cotton seeds image, then is pre-processed by image of the image pre-processing module to acquisition, described image preprocessing module
Image segmentation module is connected, described image divides module to pretreated carrying out image threshold segmentation, then carries out histogram analysis, examines
Cotton seeds quality is surveyed, described image preprocessing module connects PC machine with image segmentation module, and the PC machine is for receiving pre- place
Module and image segmentation module are managed treated data, is analyzed, show that cotton seeds quality measurements are exported.
Memory is embedded in the PC machine, the memory connects image capture module, and the memory is deposited for Flash
Reservoir, the memory in the form of BMP files for storing the cotton seeds image of image capture module acquisition.The figure
As acquisition module is the image capture module for carrying out Image Acquisition using sweep optical square.Described image acquisition module further includes mending
Optical module, the supplementary lighting module carry out light filling using coaxial light source, eliminate reflective and phenomenon of giving out light.
A kind of cotton seeds detection method based on machine vision, comprising the following steps:
Step 1: Image Acquisition is carried out to cotton seeds to be detected using image capture module, then carries out image pixel
It is worth Screening Treatment, the pixel value of the cotton seeds image of image capture module acquisition is averaged, average value, capture are obtained
The cotton seeds image of element value close to average value is transmitted to memory as original image, and by the original image of acquisition, stores
Device stores image in the form of BMP files, then by image transmitting to preprocessing module;
Step 2: image conversion process, figure are carried out using cotton seeds original image of the image pre-processing module to acquisition
As encoding compression processing, image enhancement and restoration disposal and gray proces, pretreatment image is obtained, when image conversion process can
Change the array size of original image using the indirect processing technique of discrete cosine transform, original image calculation amount is reduced with this;
Step 3: Threshold segmentation, filtering processing and Mathematical Morphology are carried out to pretreatment image using image segmentation module
Processing, and the segmented image that treated obtains is transmitted to PC machine, Threshold segmentation is carried out using adaptive mean shift algorithm
Image segmentation first carries out expansion process to the image after segmentation after Threshold segmentation so that image difference regional connectivity and to its into
The certain error compensation of row, is finally filtered and Mathematical Morphology is handled;
Step 4: analyzing segmented image data using PC machine, and differentiation detects that cotton seeds quality results are reported,
And result is exported.
It can be concluded that, Fu is used in the present invention when image conversion process according to embodiment one, embodiment two and embodiment three
In in leaf transformation, Walsh transformation or discrete cosine transform any one indirect processing technique it is big come the array for changing original image
It is small, original image calculation amount can be effectively reduced, shortens detection cycle, effectively increases detection efficiency.
Detection accuracy can be improved by carrying out cotton seeds quality testing based on machine vision, subjective error is small,
Detection efficiency is high simultaneously, can effectively save detection cycle, is that image capture module carries out cotton kind by using sweep optical square
Subgraph acquisition can be improved the clarity of acquisition image and have adjustable resolution ratio, and color of image is more bright-coloured and edge
It does not distort, a stable image basis can be provided for detection, improve Detection accuracy.
The basic principles, main features and advantages of the invention have been shown and described above.The technical staff of the industry should
Understand, the present invention is not limited to the above embodiments, and the above embodiments and description only describe originals of the invention
Reason, without departing from the spirit and scope of the present invention, various changes and improvements may be made to the invention, these changes and improvements
It all fall within the protetion scope of the claimed invention.The claimed scope of the invention is by appended claims and its equivalent circle
It is fixed.