CN113284116A - Real-time image analysis type red wine semi-finished product motion detection system - Google Patents

Real-time image analysis type red wine semi-finished product motion detection system Download PDF

Info

Publication number
CN113284116A
CN113284116A CN202110594150.XA CN202110594150A CN113284116A CN 113284116 A CN113284116 A CN 113284116A CN 202110594150 A CN202110594150 A CN 202110594150A CN 113284116 A CN113284116 A CN 113284116A
Authority
CN
China
Prior art keywords
image
red wine
sequence
detection
dsp
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.)
Withdrawn
Application number
CN202110594150.XA
Other languages
Chinese (zh)
Inventor
李蕊男
王希
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jingmen Huiyijia Information Technology Co ltd
Original Assignee
Jingmen Huiyijia Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jingmen Huiyijia Information Technology Co ltd filed Critical Jingmen Huiyijia Information Technology Co ltd
Priority to CN202110594150.XA priority Critical patent/CN113284116A/en
Publication of CN113284116A publication Critical patent/CN113284116A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/28Handling requests for interconnection or transfer for access to input/output bus using burst mode transfer, e.g. direct memory access DMA, cycle steal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/14Fourier, Walsh or analogous domain transformations, e.g. Laplace, Hilbert, Karhunen-Loeve, transforms
    • G06F17/148Wavelet transforms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Pure & Applied Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Geometry (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to a red wine semi-finished product motion detection system with real-time image analysis, which improves a background difference method to detect a motion foreground by using a current image and a background image difference, is a motion target detection algorithm based on background modeling, consists of video acquisition, conversion of a dynamic image sequence, preprocessing, background modeling, foreground detection and motion background extraction, utilizes selective filtering, homomorphic filtering, wavelet multi-scale edge detection and a surface area calculation method to identify image processing of residues, uses a parallel algorithm DSP real-time image detection system, can greatly improve the detection speed, provides a more reliable, convenient and efficient measurement method for a red wine semi-finished product, has simple and quick measurement method, accurate measurement result, is not easy to damage and age under heavy interference and corrosive conditions, has good real-time performance, flexible system architecture and convenient control interface, great practical value and wide application prospect.

Description

Real-time image analysis type red wine semi-finished product motion detection system
Technical Field
The invention relates to a red wine semi-finished product motion detection system, in particular to a red wine semi-finished product motion detection system capable of analyzing images in real time, and belongs to the technical field of image analysis detection.
Background
The development of the real-time image processing technology is rapidly developed in recent years, all image processing problems can be solved by a digital signal processing mode, the new real-time connotation is given to the image processing technology, and meanwhile, the application range of the technology is greatly expanded. Because of the large amount of information contained in the image, if a more ideal image real-time processing effect is to be obtained, a main processor with excellent performance and speed is firstly required, in addition, a parallel architecture using a plurality of processors and utilizing threads is also two important prerequisites, a famous CM2 connector is published, nearly 66000 high-speed processors are used together, and each processor is connected by a hypercube to form a network-like architecture, when the system performs 32-bit integer addition and 32-bit floating point multiplication, the speed peak values can respectively reach 25000MIPS and 10000MFLOPS ten thousand floating points which are the top level at the time, and the system has another advantage that the architecture composition is flexible and variable, so the system can be used for high-level understanding of the image. In recent years, real-time image processing techniques are changing day by day and have been widely used in various fields: the real-time visual detection system in the industrial field, the robot visual system in the robot research and development field, the real-time detection system of resources in the geological exploration field, various image analysis instruments in the medical field and the like all adopt the real-time image processing technology without exception.
Along with the development of computer and hardware technology, the performance is improved, the price is reduced, the development of an image processing system closely related to the computer is greatly promoted, and the development is divided into four stages. In the first stage, the image processing adopts a machine box type structure, the system has larger volume, stronger function and higher price, and the reason for generating the result is that a mainstream computer adopts a small machine type and double-screen operation; the second stage, the miniaturized image processing, its appearance chooses the card insertion type, the composition of the image processing system adopts PC series industrial control microcomputer, the bus adopts ISA bus and double-screen operation mode; the third stage, image processing in single screen mode supported by PCI bus of industrial microcomputer and image communication mode of picture compression and transmission; with the continuous development of industrial personal computers, the modern image processing mode is developed towards the aspects of rapidness and miniaturization, and a special and heavy image processor is eliminated and replaced by a general miniature mode. The digital signal processing system with super-strong computing power enables the image processing technology to jump into a digital system stage closely combined with a computer. Modern images can also be processed using DSP-based hardware systems, and entirely new ways of processing have been created. The DSP is an image processing system developed without an industrial control microcomputer, and the DSP is gradually improved in terms of operation speed and precision, the internal storage quantity is increased, the system function is enhanced, the data processing capability is enhanced, the communication function is also enhanced, the DSP is a place with good mode simply and flexibly, and the DSP is convenient to use in actual production at low cost.
The inspection of the semi-finished red wine product is a very key step in the production of red wine, a red wine inspection system is used on a production line to distinguish fermentation raw materials mixed in the red wine, and is an automatic inspection system for judging whether the semi-finished red wine product is qualified or not.
The red wine semi-finished product detection system in the prior art has a plurality of defects, and the difficulties in the prior art and the problems solved by the invention are mainly focused on the following aspects:
firstly, a red wine semi-finished product motion detection system is a very important ring on a red wine production line, the detection precision of the red wine semi-finished product motion detection system can directly influence the production quality of red wine, when the fermented red wine flows out of a fermentation furnace, a certain amount of fermentation raw materials can be mixed into the red wine to form a red wine mixture, the key task is to remove residues in the mixture to prepare a qualified red wine finished product, a filter screen in the prior art can primarily filter a part of residues, but a qualified product cannot be formed through the filter screen, because the filter screen is too strict, the blocking speed is too fast, and the production speed is influenced; even if pure solution passes through the filter screen, red wine liquid which just completes fermentation can be coagulated in the detection channel to form new residues, and the prior art lacks a detection device with high efficiency and high qualification degree to detect the red wine solution, so that the detection precision cannot be ensured, and the quality of the red wine cannot be improved;
secondly, although the infrared measurement method of the red wine semi-finished product by the photoelectric sensor in the prior art is simpler, the measurement result is not accurate enough, and because the accuracy of the infrared device is firstly ensured during equipment assembly, the electronic device is easy to damage and age under the conditions of heavy interference and corrosivity, the reliability of the electronic device is greatly reduced, the device is very frequently and fussy to replace, and the actual utilization value is not high;
thirdly, the detection real-time performance of the red wine semi-finished product in the prior art is poor, in the simulation detection of a laboratory, the red wine semi-finished product detection system in the prior art only reaches the processing speed of 20-45 ms/frame, the flow rate of a red wine sample in a detection channel is about 75cm/s, the shooting interval of a camera is 100ms, the speed requirement of the system for real-time detection cannot be met, the red wine production efficiency is seriously restricted, and the detection speed cannot meet the normal production requirement;
fourthly, the system architecture of the prior art is rigid, the control interface is troublesome, the system cannot be directly connected to a PCI slot of an industrial control microcomputer system, the industrial control microcomputer cannot form a master-slave system, the system architecture is rigid and the control is troublesome, meanwhile, an original signal acquired by a system camera cannot be directly transmitted to a program interface of a host through an A/D device, an actual industrial detection environment is difficult to observe, the detection result is complex, the function debugging time is long, the interface control is complex, the real-time image accurate analysis cannot be carried out, the red wine semi-finished product detection efficiency is low, and the system portability is poor;
fifth, image filtering and multi-scale wavelet transformation are not performed by adopting morphological preprocessing to perform image edge extraction, multiple degree and wavelet transformation information cannot be combined, a satisfactory edge extraction result cannot be obtained, and practical researches show that the prior art is poor in performance in occasions requiring calculation of high-order and large-quantity data, and an image analysis system in the prior art cannot be applied to the field of red wine semi-finished product detection.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a red wine semi-finished product motion detection system for real-time image analysis, which is based on real-time image analysis processing and detection, integrates morphological filtering, wavelet transformation and multi-scale edge detection, provides an edge detection wavelet function structure and algorithm, realizes a real-time red wine semi-finished product image analysis system based on a DSP chip, and provides a software programming and system debugging method of the DSP system; the red wine semi-finished product motion detection system is designed and realizes complete real-time image analysis on the basis of summarizing theoretical algorithms and system architectures in the prior art.
In order to achieve the technical effects, the technical scheme adopted by the invention is as follows:
a red wine semi-finished product motion detection system for real-time image analysis integrates morphological filtering, wavelet transformation and multi-scale edge detection on the basis of a DSP (digital signal processor) technology, provides an edge detection wavelet function structure and algorithm, realizes a real-time red wine semi-finished product image analysis system based on a DSP chip, and provides a software programming and system debugging method of the DSP system; realizing real-time image analysis of the red wine semi-finished product based on a motion detection method, and designing and realizing a complete red wine semi-finished product motion detection system for real-time image analysis;
the red wine inspection system is used for distinguishing fermentation raw materials mixed in red wine on a production line, is an automatic inspection system for judging whether a semi-finished red wine product is qualified or not, adopts an industrial control microcomputer as a host, adopts a TMS320C32 chip as a slave, carries out motion flow of the semi-finished red wine product in a segmented manner, sends a digital signal to a DSP chip through an image acquisition card and a D/A device to finish image noise reduction, edge detection wavelet function construction and algorithm processing, then sends a processing result to the industrial control microcomputer system for identification and automatic control, removes unqualified red wine components, obtains a mixed image of a red wine solution and residues through image acquisition when the solution mixed with the residues passes through a detection channel, the residues are objects to be detected and removed, removes noise under an industrial environment through an image preprocessing module, and separates the detected objects from a background; then, the edge of the detected object is binarized through an edge detection module; finally, calculating the surface area of the object to be detected according to an identification algorithm, setting a critical threshold, defining the object surface area as residue when the object surface area is larger than the critical threshold, and removing the partial solution in a shunting way by a control system, wherein the partial solution is unqualified;
the red wine semi-finished product motion detection system is composed of a camera, an image A/D conversion device, a DSP system, a display device, an industrial control microcomputer and a control system, wherein the camera, a light source and a detection channel are packaged in a closed box, a far infrared camera is adopted, and the working process comprises the following steps:
firstly, taking images, wherein fermented liquid flows out of a fermentation furnace on a production line, passes through an inspection pipeline at a certain speed, and simultaneously scans the liquid through a linear array CCD camera according to a corresponding frequency to continuously take images of red wine and foreign matter mixture;
and secondly, A/D conversion and DSP image processing, wherein the image shot by the CCD camera sends the digital image to a frame memory of a DSP system through an analog-to-digital conversion device, and high-speed operation processing is carried out on the digital image, wherein the image processing comprises the following steps: enhancing chroma, filtering and denoising, extracting foreign matter edges and carrying out binarization treatment;
thirdly, detecting data of the industrial personal computer, sending edge information processed by the DSP to the industrial personal computer system, identifying and positioning the foreign matters by the industrial personal computer system by calculating the surface area of the foreign matters, sending a control command to the control system, and shunting and removing the detected foreign matters;
and fourthly, controlling the detection channel, adding the identified single particle size or particle content of the foreign matters to be larger than respective standard critical values, proving that the part of red wine solution contains residues and needs to be shunted, synchronously controlling the valve by the control equipment, and enabling the red wine to enter the shunting channel to be rejected or to return to the fermentation furnace for continuous fermentation.
The red wine semi-finished product motion detection system capable of analyzing the real-time images further comprises a DSP system architecture and an external interface: the system adopts two TMS320C32 serial connections to form a pipeline working mode, the previous stage TMS320C32 is used for image preprocessing, the second stage TMS320C32 is used for edge detection, an image A/D chip adopts OV7610 of Omnivision company, address codes are compiled at the same time, and control circuit signal acquisition is completed by using an ISP type EPLS chip;
the system work flow is as follows: after the power is on, the system program is spontaneously loaded into the thirty-two bit off-chip program RAM from the Flash Memory, and after the program code is downloaded, the program code is immediately fed back to the TMS320C32 and then executed; in addition, the system program first passes through I2The bus C sets the working parameters of the OV7610 chip, and after the setting is finished, the OV7610 works according to the preset parameters under the control of the acquisition circuit so as to obtain an image; TMS320C32(1) stores the image data into the frame memory by DMA method, at the same time, the image data in the frame memory is processed in advance, the processed result data is directly sent to the data RAM (1), the next stage TMS320C32(2) carries out wavelet edge detection on the data in the RAM (1), the processed edge data is sent to the data RAM (2) and then sent back to the industrial control microcomputer, the industrial control microcomputer reads the data in the RAM (2) by PCI bus, whether the red wine is qualified or not is judged according to the edge information, and the control system controls the red wine detection process, the whole system works under the control of the industrial control microcomputer, and can also run independently without the industrial control microcomputer.
The red wine semi-finished product motion detection system capable of analyzing the real-time images further comprises a motion image acquisition control circuit: the image chip OV7610 in the system works in a frame or field mode, the output signal includes a vertical synchronizing signal VSYNC, a horizontal synchronizing signal HREF and a pixel synchronizing signal PCLK, the composition system ensures that the image finally obtained when the system executes the visual algorithm processing is a complete frame image, the VSYNC signal represents the rated time of the system scanning a frame or a field between two positive pulses, namely the effective time of scanning a complete frame or a field image between the two positive pulses, the HREF signal represents the rated time of each line pixel when scanning a field or a frame image, namely the effective time of scanning a line pixel under the condition of high level signal, and the PCLK signal represents the synchronizing signal provided when the system finishes the reading of the effective pixel value after scanning a field or a frame.
The image control circuit is used for combining three OV7610 output signals to form unique output, and then the external equipment is used for instantly reading the time sequence of operation, and the working mode of the image acquisition control circuit is as follows: the RESET port keeps a low level state under the condition of power-on, the RESET port is in a high level state when power-off occurs, the states of two D triggers are enabled to be RESET, and meanwhile, no matter how three input signals of VSYNC, HREF and PCLK change, the output end OUT still maintains the low level state, after the circuit starts working, when a frame of image is obtained, a signal is output from a TCLK0 pin of C32 to start a positive pulse, the output of the signal can guide the Q end of the trigger 1 to change from the RESET state to output the high level, and similarly, the D end of the trigger 2 also changes to the high level state; next, the trigger 2 is affected by the positive VSYNC pulse, so that its Q terminal is turned to output high, which brings about two results: firstly, the high level guides the signal after the HREF and the PCLK meet to be output to an OUT end through a NAND gate circuit, and secondly, the output of the high level forces the trigger 1 to be reset again and converted into the output low level, so that the D end of the trigger 2 is converted into the low level; after the next positive pulse comes, the Q end of the trigger 2 starts to output a low level, so that HREF and PCLK signals are shielded, and the output end OUT returns to an output low level state; every time the system outputs a start positive pulse signal, the output end OUT obtains the effective pixel value of a complete image of a frame, and reads the synchronous signal.
The red wine semi-finished product motion detection system capable of analyzing images in real time further comprises an image DMA access: reading an image from the OV7610 by adopting a DMA method and storing the image into a frame memory to synchronously perform two operations of image acquisition and visual algorithm processing, wherein two DMA pipelines are arranged in a TMS320C32 chip, DMA is simultaneously performed by utilizing the two pipelines in the two processes of operating DMA reading and writing, and external interruption, serial port sending, receiving interruption and timer interruption contained in the reading and writing processes keep the synchronous utilization of interrupt signals through a special framework;
the synchronous signal of DMA operation in the system is the output OUT end in the circuit, the DMA source address utilizes the output port address of OV7610, keep DMA address unchanged after the operation begins, set up the address of the frame memory as DMA target address at the same time, add 1 to the address value after each operation; when the image acquisition starting signal is sent by the C32, the system stores a complete image of one frame into the frame memory in a DMA mode;
industrial control microcomputer interface: the method comprises the steps of adopting a dual-port memory to realize communication between TMS320C32 and an industrial personal computer, obtaining boundary information of foreign matters detected in red wine after the memory of the industrial personal computer obtains result data, calculating the surface area of the foreign matters, judging whether the red wine meets qualified standards, controlling a detection channel of the red wine by a controller if the red wine does not meet the standards, removing unqualified parts in a shunting way, installing a shunting valve in the red wine detection channel, normally opening the valve, opening the detection channel, closing the shunting channel, enabling the red wine to flow into a continuous detection channel or a semi-finished product area, sending a control command to a servo mechanism by the computer if an unqualified product is detected, driving the controller to rotate the valve by the servo mechanism, closing the detection channel, opening the shunting channel, and removing the red wine from the shunting channel.
Real-time image analysis's red wine semi-manufactured goods motion detection system, further, in the real-time image analysis detection based on DSP chip, TMS320C32 includes with the external memory interface:
the memory adopts a double-frame memory architecture, one type of frame memory is used for image acquisition and image display and is composed of DRAM memory chips, the other type of frame memory is used for a DSP processor and is composed of SRAM memory chips;
memory interface, program memory uses thirty-two bit width, when 8 or 16 bit data is needed in the system, one method is to directly draw a certain amount of memory in 32 bit program memory as 8 bit or 16 bit data memory; the other method is to adopt two groups of memories with different widths, one group is 32 bits, the other group is 8 bits or 16 bits, one group is 32 Kx32 bits, STRB0\ gating is adopted, a control register is set to be 000F0000H, the width of the physical memory is 32 bits, and the data type is 32 bits; the other group is 32 Kx 8 bits, the STRB1\ gating is used, the control register is set to be all 0, the width of the physical register is 8 bits, the data type is 8 bits, C32 and 32 Kx 32 bit memory interface address lines A0 to A14 are mutually connected, four pieces of data lines form 32 bits of data, chip selection lines of the four pieces of memory are respectively connected with four gate lines of the STRB0\ when the C32 and the 8 bit memory interface are used, the STRB1_ B0\ is used as the gate lines, the internal address of the C32 is displayed on an external address pin after being shifted to the right by two bits, and the STRB1_ B3\ A _1 and the STRB1_ B2\ A _2 are used as additional address lines.
Real-time image analysis based red wine semi-finished product motion detection system, and further TMS32C32 and I2C, hardware connection of a bus and an A/D chip: TMS320C32 and OV7610 utilize I2The C bus carries out hardware connection of data communication: i is carried out between TMS320C32 and OV76102C bus data communication, OV 7610I2CLKX0 of C bus pin SCL and C32 is connected, SDA is connected with DX0 of C32, and a resistor is added between Vcc, SCL and SDA, the resistance value is 4.7k, SDA low level is kept, CLKX0 and DX0 are used as output pins, I is2The time sequence control of C is realized by software, programming is controlled, OV7610 is initialized, and parameters are set;
TMS320C32 and OV7610 carry out I2C, bus data communication programming: OV7610 is slave device, in the internal address distribution, the occupation address of 52 registers is 00H to 34H, the write operation address is 42H, the read operation address is 43H, in the data transfer process, C32 is used as the master device and provided with a transmitter, OV7610 is used as the slave device and provided with a receiver, the write-in of a plurality of registers is completed once, the master device continuously transmits data, the register address can be automatically added with value, the written data are sequentially stored in the registers with continuous addresses, the work flow can improve the efficiency, the repeated execution of all the processes of transmitting data is avoided, and a large amount of data can be transmitted once as long as the SDA generates a response signal; c32 does when C32 does readIs a master device with a receiver and OV7610 as a slave device with a transmitter.
The red wine semi-finished product motion detection system based on real-time image analysis is further based on TMS320C32 master-slave mode system hardware: the method is realized by adopting a plurality of DSPs and a general microprocessor MPU, each processor finishes partial work of a system, the MPU is defined as a host, the DSP is defined as a slave, the host controls the slave, the MPU controls the running and suspension of the DSP, the DSP gives data acquired from the outside to the DSP for disposal under the control of the MPU, the DSP transmits corresponding results acquired after the disposal to the MPU, and the MPU transmits the disposal results to other systems;
the dual-computer communication between the host and the slave is realized by adopting the following steps: the method comprises the steps that a memory sharing mode is adopted, a general x86 computer is adopted as a main processor, a DSP undertakes real-time input/output processing, the main CPU is responsible for various controls, and after the DSP is finished, the main CPU judges a processing result and determines whether a detected product meets the specification or not;
the data bus and address bus of the double-port RAM of the shared memory are the same as the single-port RAM, two groups of buses access in sequence, the arbitration logic of the bus in the chip sends a waiting signal to one party accessing backwards, only when the two groups of address buses are all the same, the party is allowed to wait, when the other party finishes accessing, the waiting party accesses, the bus arbitration logic determines the sequence of the access of the two groups of buses, the parallel processing capability of the industrial control microcomputer and the DSP chip is improved, and the special structure of the double-port RAM promotes the double-machine to conveniently exchange data.
The red wine semi-finished product motion detection system capable of real-time image analysis further comprises the following steps: detecting a moving target of an existing AVI video, determining the position of the moving target by detecting the moving target in an image sequence, acquiring the image sequence through the existing AVI video by video acquisition by adopting an improved background difference method, modeling the background to obtain an accurate background image, extracting the current background from a plurality of images, denoising the background image from the sequence image by target extraction, comparing the background image with the denoised current image when the sequence image contains the moving target, detecting a corresponding area of the moving target, and extracting a change area from the background image;
the improved background difference method uses the current image and the background image to detect the motion foreground differentially, which is a motion target detection algorithm based on background modeling, and comprises video acquisition, conversion of dynamic image sequence, preprocessing, background modeling, foreground detection and extraction of motion background, wherein the dynamic image sequence conversion converts AVI video into image sequence, the image preprocessing improves the quality of input image, transforms outstanding useful information, and removes or weakens useless information, the image extracts the motion foreground after the background modeling and the foreground detection, and extracts the detected motion target by using a frame, so as to obtain the final detection result, and the unqualified residue component in red wine solution is determined and removed, so that the online detection of the red wine semi-finished product is realized.
The red wine semi-finished product motion detection system capable of analyzing the real-time images further comprises a morphological pre-processing module: in equation 1, g (x, y) represents a grayscale image, f (x, y) represents an architectural element, l (x, y) represents a smoothed image of h (x, y), a smoothed image l (x, y) of the grayscale image g (x, y) is expressed using an average of both the form open g and the form closed f · g,
Figure RE-GDA0003150980020000071
in order to express the target that may be included in the high frequency part of the spatial domain, the difference between the original g (x, y) and l (x, y), i.e. the residual image b (x, y), must be grasped, as shown in equation 2:
b (x, y) ═ g (x, y) -l (x, y) formula 2
Further carrying out local critical value segmentation on the residual image b (x, y), and obtaining a corresponding target image sequence without background noise by the treatment of a critical threshold;
the morphological DSP implementation method is divided into shift, OR, AND-AND.
Real-time image analysis's red wine semi-manufactured goods motion detection system, further, the edge detection module:
firstly, a wavelet edge detection function construction method:
wavelet transforms decompose an image into three components: smooth images
Figure RE-GDA0003150980020000072
Horizontal detail image
Figure RE-GDA0003150980020000073
And vertical detail images
Figure RE-GDA0003150980020000081
Wherein,
Figure RE-GDA0003150980020000082
g (x, y) is the original two-dimensional digital signal,
Figure RE-GDA0003150980020000083
is a discrete profile of g (x, y) at resolution j,
Figure RE-GDA0003150980020000086
is the discrete detail of g (x, y) in the vertical direction at resolution j,
Figure RE-GDA0003150980020000088
is a discrete detail in the vertical direction at resolution j, taken
Figure RE-GDA0003150980020000087
The wavelet edge detection flow algorithm of the invention is as follows:
step 1, selecting a decomposition scale J;
step 2, each line of g (x, y) needs to increase J value two-dimensional binary wavelet transform, and J is more than 0 and less than J; can obtain
Figure RE-GDA00031509800200000813
Step 3, find out
Figure RE-GDA00031509800200000810
Zero-crossing point of (a);
step 4, calculating all module values of wavelet transformation
Figure RE-GDA00031509800200000811
Maximum value points on the gradient in the direction within the m × m domain of the pixel point (x, y);
removing the sequence of the extreme value amplitude of the coefficient which increases on the average value along with the reduction of the size;
step 6, repeating the steps 2 to 5 for each column of the image;
step 7, taking the point where the extreme value is obtained for 2 times as an edge, and setting an edge line g (x, y) to be 200, otherwise, setting g (x, y) to be 0;
secondly, detecting the moving edge of the red wine semi-finished product:
the image edge is defined as the transition between image coverage areas with different color intensity, wherein, the first differential is calculated for the amplitude, the high point corresponds to the edge point, the zero crossing point of the second differential also represents the edge point, the edge is extracted by the maximum value of the gradient module or the zero crossing point of the second derivative, the invention applies the DSP processor in the wavelet analysis, and the parallel computation of the wavelet transformation is realized;
fast wavelet transform for finite sequences: a periodic extension method is adopted, a finite sequence is used as a periodic signal to be extended outwards, wherein the critical period length is the length of the sequence, the defect of discontinuity at the boundary caused by a zero interpolation method is overcome, the sequence can be periodically carried out along the corresponding direction, and in order to further improve the operation speed of the FWT of the finite sequence, addresses are circularly searched in a DSP processor to carry out the periodic extension of the sequence;
the wavelet transform decomposition formula is represented by the general formula:
Figure RE-GDA0003150980020000084
the input sequence is defined as z (m), the scale expansion coefficient is x (w), the coefficient is g (h), when the DSP processor is started, the subscripts of the coefficient sequence range from 0, …, h _ upper, h _ upper represents the maximum value of the subscript,
Figure RE-GDA0003150980020000085
length of input sequence z (m)
Figure RE-GDA00031509800200000812
The lengths of x (w) are divided equally along the scale in turn, and the value interval of k is: 0, …, N/2-1;
and accurately calculating the numerical value of the specified scale according to the algorithm, wherein the specific method comprises the following steps: putting coefficient sequence at the beginning of input sequence, multiplying the coefficient with its corresponding input value, accumulating to obtain the first scale value on the expansion sequence, calculating the product of each new coefficient and corresponding input value at two positions before the coefficient sequence, accumulating to obtain the second value, and so on, until the coefficient sequence completely departs from the input sequence, to ensure that each coefficient can be multiplied by a value in the input sequence, adding a plurality of values of the beginning part of the input sequence at the end part of the sequence, taking the new sequence as the input sequence of the next algorithm, translating the coefficient sequence g (h) (0, …,3) with the original length of 4, finally, the input sequence z (M) (M ═ 0, …, M-1; and M is 2.v,v∈X+);
When w is 0, the first value x on the scale n +1 is calculatedn+1(0):
zn+1(0)=g(0)·zn(0)+g(1)·zn(1)+g(2)·zn(2)+g(3)·zn(3) Formula 5
The coefficient sequence is then translated to w ═ 1, and a second value z is calculatedn+1(1):
zn+1(1)=g(0)·zn(2)+g(1)·zn(3)+g(2)·zn(4)+g(3)·zn(5) Formula 6
When moving to w-M/2-1, the input sequence can only be multiplied by the first two coefficients, zn(0) Andzn(1) added to the end of the sequence; last value z of the scale n +1n+1(M/2-1) is calculated from the following formula:
Figure RE-GDA0003150980020000091
by analogy, let zn+1(M) (M ═ 0, …, M/2-1) as an input value gives the next scale value n + 2.
Compared with the prior art, the invention has the following contributions and innovation points:
firstly, a red wine semi-finished product motion detection system is a very important ring on a red wine production line, the detection precision of the red wine semi-finished product motion detection system can directly influence the production quality of red wine, when the fermented red wine flows out of a fermentation furnace, a certain amount of fermentation raw materials can be mixed into the fermented red wine to form a red wine mixture, residues in the mixture are specially removed to prepare a qualified red wine finished product, a detection device with high efficiency and high qualification degree is successfully developed to detect a red wine solution, the detection process is carried out in multiple stages, the detection precision is ensured, the red wine detection and purification can be efficiently and accurately finished, and the quality of the red wine is greatly improved;
secondly, the improved background difference method of the invention uses the difference of the current image and the background image to detect the moving foreground, is a moving object detection algorithm based on background modeling, consists of video acquisition, conversion of dynamic image sequence, preprocessing, background modeling, foreground detection and extraction of moving background, applies selective filtering and homomorphic filtering, the wavelet multi-scale edge detection and surface area calculation method identifies the image processing of the residue, a new method for detecting the red wine qualification degree by using an image method is provided, a parallel algorithm DSP real-time image detection system is used, the detection speed can be greatly improved, a more reliable, convenient and efficient measurement method is provided for a red wine semi-finished product, the measurement method is simple and rapid, the measurement result is accurate, and the device is not easy to damage and age under the conditions of heavy interference and corrosivity, so that the method is a high-efficiency and low-cost detection and purification method;
third, good real-time: the red wine semi-finished product motion detection system capable of analyzing the real-time images can reach the processing speed of 75-90 ms/frame in the simulation detection of a laboratory, the flow speed of a red wine sample in a detection channel is about 75cm/s, the shooting interval of a camera is 100ms, the speed requirement of the system on real-time detection can be met, and the system has great improvement on the red wine production efficiency;
fourthly, the method has great practical value and wide application prospect: the morphological preprocessing is adopted to carry out image filtering and multi-scale wavelet transformation to carry out image edge extraction, and the multiple degree and wavelet transformation information are combined to obtain a more satisfactory edge extraction result.
Fifth, flexible system architecture and convenient control interface: the whole DSP system adopts a PCI card inserting frame configuration mode, can be directly connected into a PCI slot of an industrial control microcomputer system to form a master-slave system in the industrial control microcomputer, is convenient and flexible, simultaneously, original signals collected by a system camera can be directly transmitted into a program interface of a host through an A/D device, the actual industrial detection environment is easily observed, comparison with a detection result is convenient, function debugging is completed, interface control is convenient, real-time images are analyzed accurately, red wine semi-finished product detection efficiency is high, and system transportability is good.
Drawings
FIG. 1 is a block diagram of a system for detecting a solution by an image method according to the present invention.
Fig. 2 is an architecture diagram of a red wine semi-finished product detection system based on TMS320C 32.
Fig. 3 is a schematic diagram of an image acquisition control circuit of the present invention.
FIG. 4 is a schematic diagram of 32-bit and 8-bit zero state memory interfaces of the present invention.
FIG. 5 is C32 performing I on OV7610 internal register2C, bus reading operation flow chart.
Fig. 6 is a flow chart of the background subtraction method of the improvement of the present invention.
FIG. 7 is a flow chart of dynamic sequence moving object detection according to the present invention.
Fig. 8 is a diagram illustrating the result of the morphological filtering of the present invention.
Detailed Description
The technical scheme of the red wine semi-finished product movement detection system adopting real-time image analysis provided by the invention is further described below with reference to the accompanying drawings, so that the technical scheme can be better understood and implemented by those skilled in the art.
The invention provides a red wine semi-finished product motion detection system based on real-time image analysis processing and detection, integrates morphological filtering, wavelet transformation and multi-scale edge detection, provides an edge detection wavelet function structure and algorithm, realizes a real-time red wine semi-finished product image analysis system based on a DSP chip, and provides a software programming and system debugging method of the DSP system; and realizing real-time image analysis of the red wine semi-finished product based on a motion detection method.
The invention integrates morphological filtering, wavelet transformation and multi-scale edge detection on the basis of DSP technology, provides an edge detection wavelet function structure and algorithm, so that the practicability and the innovation of the whole system reach higher level, and designs and realizes a complete red wine semi-finished product motion detection system for real-time image analysis on the basis of summarizing the theoretical algorithm and the system architecture in the prior art.
Overview of motion detection System for Red wine semi-finished products
The red wine semi-finished product inspection is a very key step in the red wine manufacturing production, the red wine inspection system of the invention is used for distinguishing the fermentation raw materials mixed in the red wine on a production line, and is an automatic inspection system for judging whether the red wine semi-finished product is qualified or not, the red wine semi-finished product motion inspection system of the invention adopts an industrial control microcomputer as a host, adopts a TMS320C32 chip as a slave, the red wine semi-finished product motion process is performed in a segmented way, digital signals are sent to a DSP chip through an image acquisition card and a D/A device to complete image noise reduction, edge detection wavelet function construction and algorithm processing, then the processing result is sent to the industrial control microcomputer system for identification and automatic control, unqualified red wine components are removed, when the solution mixed with residues passes through a detection channel, the mixed image of the red wine solution and the residues is obtained through image acquisition, and the residues are the objects to be detected and removed, removing noise in an industrial environment through an image preprocessing module, and separating a detection object and a background; then, the edge of the detected object is binarized through an edge detection module; and finally, calculating the surface area of the object to be detected according to an identification algorithm, setting a critical threshold, defining the object surface area as residue when the object surface area is larger than the critical threshold, and removing the partial solution as unqualified product by a control system.
Although the infrared measurement method by the photoelectric sensor is simple and the measurement result is not accurate enough, the accuracy of the infrared device is firstly ensured during equipment assembly, the electronic device is easy to damage and age under the conditions of heavy interference and corrosivity, and the similar problems can be avoided by using the image identification method for measurement.
Framework of red wine semi-finished product motion detection system
Overall structure
A red wine semi-finished product motion detection system is an important ring on a red wine production line, and the detection precision of the red wine semi-finished product motion detection system can directly influence the quality of red wine production. In the detection process, when the red wine after fermentation flows out of the fermentation furnace, a certain amount of fermentation raw materials are mixed in the red wine to form a red wine mixture, the invention aims to remove residues in the mixture to prepare a qualified red wine finished product, a filter screen can preliminarily filter off a part of residues, but the qualified red wine cannot be formed through the filter screen, and the reason is that: firstly, the filter screen is too strict, the blocking speed is too fast, and the production speed is influenced; and secondly, even if pure solution passes through the filter screen, the red wine liquid which just completes fermentation can be coagulated in the detection channel to form new residues. Therefore, a high-efficiency and high-qualification testing device is required to test the red wine solution. FIG. 1 is a block diagram of a system for detecting a solution by an image method, which is developed by the invention, wherein the detection process is carried out in multiple stages, and the detection precision is ensured.
The red wine semi-finished product motion detection system comprises a camera, an image A/D conversion device, a DSP system, a display device, an industrial control microcomputer and a control system, wherein the camera, a light source and a detection channel are packaged in a closed box, the interference of light is weakened, a condensation layer of mist water vapor can be generated on the outer surface of a container under the condition that the constant temperature is lower than 19 ℃, the camera is specially designed, a far infrared camera is adopted, and the working flow comprises the following steps:
firstly, taking images, wherein fermented liquid flows out of a fermentation furnace on a production line, passes through an inspection pipeline at a certain speed, and simultaneously scans the liquid through a linear array CCD camera according to a corresponding frequency to continuously take images of red wine and foreign matter mixture;
and secondly, A/D conversion and DSP image processing, wherein the image shot by the CCD camera sends the digital image to a frame memory of a DSP system through an analog-to-digital conversion device, and high-speed operation processing is carried out on the digital image, wherein the image processing comprises the following steps: enhancing chroma, filtering and denoising, extracting foreign matter edges and carrying out binarization treatment;
thirdly, detecting data of the industrial personal computer, sending edge information processed by the DSP to the industrial personal computer system, identifying and positioning the foreign matters by the industrial personal computer system by calculating the surface area of the foreign matters, sending a control command to the control system, and shunting and removing the detected foreign matters;
and fourthly, controlling the detection channel, adding the identified single particle size or particle content of the foreign matters to be larger than respective standard critical values, proving that the part of red wine solution contains residues and needs to be shunted, synchronously controlling the valve by the control equipment, and enabling the red wine to enter the shunting channel to be rejected or to return to the fermentation furnace for continuous fermentation.
(II) DSP system architecture and peripheral interface
The system adopts two TMS320C32 pieces to form a pipeline work mode in series, the TMS320C32 of the previous stage is used for image preprocessing, and the TMS320C32 of the second stage is used for edge detection. Fig. 2 is an architecture diagram of a red wine semi-finished product detection system based on TMS320C32, an image a/D chip adopts an OV7610 of Omnivision corporation, an address code is compiled simultaneously, signal acquisition of a control circuit is completed by using an ISP type EPLS chip, and the system has the following working flows: after power-on, the system program spontaneously starts from the Flash MemoryLoading the TMS into a thirty-two bit external program RAM, feeding back the program code to the TMS320C32 immediately after downloading, and executing the program code; in addition, the system program first passes through I2The bus C sets the working parameters of the OV7610 chip, and after the setting is finished, the OV7610 works according to the preset parameters under the control of the acquisition circuit so as to obtain an image; TMS320C32(1) stores the image data into the frame memory by DMA method, at the same time, the image data in the frame memory is processed in advance, the processed result data is directly sent to the data RAM (1), the next stage TMS320C32(2) carries out wavelet edge detection on the data in the RAM (1), the processed edge data is sent to the data RAM (2) and then sent back to the industrial control microcomputer, the industrial control microcomputer reads the data in the RAM (2) by PCI bus, whether the red wine is qualified or not is judged according to the edge information, and the control system controls the red wine detection process. The whole system works under the control of the industrial personal computer and can also be independently operated without the industrial personal computer.
1. Motion image acquisition control circuit
The image chip OV7610 in the system works in a frame or field mode, the output signal includes a vertical synchronizing signal VSYNC, a horizontal synchronizing signal HREF and a pixel synchronizing signal PCLK, the composition system ensures that the image finally obtained when the system executes the visual algorithm processing is a complete frame image, the VSYNC signal represents the rated time of the system scanning a frame or a field between two positive pulses, namely the effective time of scanning a complete frame or a field image between the two positive pulses, the HREF signal represents the rated time of each line pixel when scanning a field or a frame image, namely the effective time of scanning a line pixel under the condition of high level signal, and the PCLK signal represents the synchronizing signal provided when the system finishes the reading of the effective pixel value after scanning a field or a frame.
The invention aims to efficiently and completely obtain a frame image, combine three OV7610 output signals into a unique output by using an image control circuit, and then immediately read the time sequence of operation by using external equipment. The schematic diagram is shown in fig. 3. The image acquisition control circuit has the working modes as follows: the RESET port keeps a low level state under the condition of power-on, the RESET port is in a high level state when power-off occurs, the states of two D triggers are enabled to be RESET, and meanwhile, no matter how three input signals of VSYNC, HREF and PCLK change, the output end OUT still maintains the low level state, after the circuit starts working, when a frame of image is obtained, a signal is output from a TCLK0 pin of C32 to start a positive pulse, the output of the signal can guide the Q end of the trigger 1 to change from the RESET state to output the high level, and similarly, the D end of the trigger 2 also changes to the high level state; next, the trigger 2 is affected by the positive VSYNC pulse, so that its Q terminal is turned to output high, which brings about two results: firstly, the high level guides the signal after the HREF and the PCLK meet to be output to an OUT end through a NAND gate circuit, and secondly, the output of the high level forces the trigger 1 to be reset again and converted into the output low level, so that the D end of the trigger 2 is converted into the low level; after the next positive pulse comes, the Q end of the trigger 2 starts to output a low level, so that HREF and PCLK signals are shielded, and the output end OUT returns to an output low level state; every time the system outputs a start positive pulse signal, the output end OUT obtains the effective pixel value of a complete image of a frame, and reads the synchronous signal.
2. Image DMA access
The TMS320C32 chip is internally provided with two DMA pipelines, the two DMA pipelines are respectively utilized to carry out DMA simultaneously in the two processes of operating DMA reading and writing, and external interruption, serial port sending, receiving interruption and timer interruption contained in the reading and writing processes keep the synchronous utilization of the interruption signals through the special architecture.
The synchronous signal of DMA operation in the system is the output OUT end in the circuit, the DMA source address utilizes the output port address of OV7610, keep DMA address unchanged after the operation begins, set up the address of the frame memory as DMA target address at the same time, add 1 to the address value after each operation; when the image capture start signal is issued by C32, the system DMA-stores a complete frame of image into the frame memory.
Industrial control microcomputer interface: the method comprises the steps of adopting a dual-port memory to realize communication between TMS320C32 and an industrial personal computer, obtaining boundary information of foreign matters detected in red wine after the memory of the industrial personal computer obtains result data, calculating the surface area of the foreign matters, judging whether the red wine meets qualified standards, controlling a detection channel of the red wine by a controller if the red wine does not meet the standards, removing unqualified parts in a shunting way, installing a shunting valve in the red wine detection channel, normally opening the valve, opening the detection channel, closing the shunting channel, enabling the red wine to flow into a continuous detection channel or a semi-finished product area, sending a control command to a servo mechanism by the computer if an unqualified product is detected, driving the controller to rotate the valve by the servo mechanism, closing the detection channel, opening the shunting channel, and removing the red wine from the shunting channel.
Third, real-time image analysis and detection based on DSP chip
TMS320C32 and external memory interface
1. The memory adopts a double-frame memory architecture, one frame memory is used for image acquisition and image display and is composed of DRAM memory chips, the other frame memory is used for a DSP processor and is composed of SRAM memory chips.
2. Memory interface, program memory uses thirty-two bit width, when 8 or 16 bit data is needed in the system, one method is to directly draw a certain amount of memory in 32 bit program memory as 8 bit or 16 bit data memory; another approach is to use two sets of memories of different widths, one 32 bits and the other 8 or 16 bits. FIG. 4 is a schematic diagram of an interface employing two memory widths, one set being 32K 32 bits, with STRB0\ strobe, control register set to 000F0000H, physical memory width of 32 bits, and data type of 32 bits; the other group is 32 Kx 8 bits, STRB1\ gating is used, a control register is set to be all 0, the width of a physical register is 8 bits, the data type is 8 bits, C32 and 32 Kx 32 bit memory interface address lines A0 to A14 are mutually connected, four pieces of data lines form 32 bits of data, chip selection lines of the four pieces of memory are respectively connected with four gate lines of the STRB0\ when the C32 and the 8 bit memory interface are used, STRB1_ B0\ is used as the gate lines, an internal address of the C32 is displayed on an external address pin after being shifted to the right by two bits, STRB1_ B3\ A _1 and STRB1_ B2\ A _2 are used as additional address lines, and the rest connections are shown in FIG. 4.
(II) TMS32C32 and I2Hardware connection of C bus and A/D chip
TMS320C32 and OV7610 utilize I2The C bus carries out hardware connection of data communication: i is carried out between TMS320C32 and OV76102C bus data communication, OV 7610I2CLKX0 of C bus pin SCL and C32 is connected, SDA is connected with DX0 of C32, and a resistor is added between Vcc, SCL and SDA, the resistance value is 4.7k, SDA low level is kept, CLKX0 and DX0 are used as output pins, I is2The timing control of C is implemented by software, programmed to control, initialize OV7610, and set parameters.
TMS320C32 and OV7610 carry out I2C, bus data communication programming: OV7610 is slave device, in the internal address distribution, the occupation address of 52 registers is 00H to 34H, the write operation address is 42H, the read operation address is 43H, in the data transfer process, C32 is used as the master device and provided with a transmitter, OV7610 is used as the slave device and provided with a receiver, the write-in of a plurality of registers is completed once, the master device continuously transmits data, the register address can be automatically added with value, the written data are sequentially stored in the registers with continuous addresses, the work flow can improve the efficiency, the repeated execution of all the processes of transmitting data is avoided, and a large amount of data can be transmitted once as long as the SDA generates a response signal; when C32 performs a read operation, C32 serves as a master device and has a receiver, and OV7610 serves as a slave device and has a transmitter, and the flow of the read operation is shown in fig. 5.
TMS320C 32-based master-slave system hardware
The method is realized by adopting a plurality of DSPs and MPUs of a general-purpose microprocessor, each processor finishes partial work of a system, the MPU is defined as a master, the DSP is defined as a slave, the master controls the slave, the MPU controls the running and suspension of the DSP, the DSP passes data acquired from the outside to the DSP for disposal under the control of the MPU, the DSP transmits corresponding results acquired after the disposal to the MPU, and the MPU transmits the disposal results to other systems.
The dual-computer communication between the host and the slave is realized by adopting the following steps: the main processor adopts a general x86 computer, the DSP undertakes real-time input/output processing, the main CPU is responsible for various controls, and after the DSP is finished, the main CPU judges the processing result to determine whether the checked product meets the standard.
The data bus and address bus of the double-port RAM of the shared memory are the same as the single-port RAM, two groups of buses access in sequence, the arbitration logic of the bus in the chip sends a waiting signal to one party accessing backwards, only when the two groups of address buses are all the same, the party is allowed to wait, when the other party finishes accessing, the waiting party accesses, the bus arbitration logic determines the sequence of the access of the two groups of buses, the parallel processing capability of the industrial control microcomputer and the DSP chip is improved, and the special structure of the double-port RAM can promote the double-machine to conveniently exchange data.
Motion detection system for real-time image analysis
The method comprises the steps of detecting a moving target of an existing AVI video, determining the position of the moving target by detecting the moving target in an image sequence, adopting an improved background difference method, acquiring the image sequence through the existing AVI video by video acquisition, modeling the background to obtain an accurate background image, extracting the current background from a plurality of images, extracting the target from the sequence image to obtain the background image by denoising, comparing the background image with the denoised current image when the sequence image contains the moving target, detecting a corresponding area of the moving target, and extracting a change area from the background image.
The improved background difference method uses the difference of the current image and the background image to detect the moving foreground, is a moving object detection algorithm based on background modeling, has a flow of a dynamic sequence as shown in figure 7, and consists of video acquisition, conversion of the dynamic image sequence, preprocessing, background modeling, foreground detection and extraction of a moving background. The dynamic image sequence conversion converts AVI video into an image sequence, the image preprocessing improves the quality of input images, the image preprocessing transforms outstanding useful information and removes or weakens useless information, after the images are subjected to background modeling and foreground detection, the image preprocessing extracts a moving foreground and extracts a detected moving target by using a frame to obtain a final detection result, and the online detection of the red wine semi-finished product is realized according to the determination and the elimination of unqualified residue components in the red wine solution. The invention provides a new method for detecting the qualification degree of red wine by using an image method through image processing of selecting filtering, homomorphic filtering, wavelet multi-scale edge detection and identifying residues by using a surface area calculation method, and provides a more reliable, convenient and efficient measuring method for a semi-finished product of red wine by using a parallel algorithm DSP real-time image detection system.
Fifth, real-time image analyzing and identifying method
Morphological preprocessing module
In equation 1, g (x, y) represents a grayscale image, f (x, y) represents an architectural element, l (x, y) represents a smoothed image of h (x, y), a smoothed image l (x, y) of the grayscale image g (x, y) is expressed using an average of both the form open g and the form closed f · g,
Figure RE-GDA0003150980020000161
in order to express the target that may be included in the high frequency part of the spatial domain, the difference between the original g (x, y) and l (x, y), i.e. the residual image b (x, y), must be grasped, as shown in equation 2:
b (x, y) ═ g (x, y) -l (x, y) formula 2
And further performing local critical value segmentation on the residual image b (x, y), and performing critical threshold treatment to obtain a corresponding target image sequence with background noise removed.
The morphological DSP implementation method is divided into shift, OR, AND-AND.
Morphological pre-processing filtering was performed on the samples used in the red wine test, and the results are shown in FIG. 8.
(II) edge detection module
1. Wavelet edge detection function construction method
Wavelet transforms decompose an image into three components: smooth images
Figure RE-GDA0003150980020000165
Horizontal detail image
Figure RE-GDA0003150980020000164
And vertical detail images
Figure RE-GDA0003150980020000166
Wherein,
Figure RE-GDA0003150980020000167
g (x, y) is the original two-dimensional digital signal,
Figure RE-GDA0003150980020000168
is a discrete profile of g (x, y) at resolution j,
Figure RE-GDA0003150980020000169
is the discrete detail of g (x, y) in the vertical direction at resolution j,
Figure RE-GDA00031509800200001610
is a discrete detail in the vertical direction at resolution j, taken
Figure RE-GDA00031509800200001611
The wavelet edge detection flow algorithm of the invention is as follows:
step 1, selecting a decomposition scale J;
step 2, each line of g (x, y) needs to increase J value two-dimensional binary wavelet transform, and J is more than 0 and less than J; can obtain
Figure RE-GDA0003150980020000162
Step 3, find out
Figure RE-GDA00031509800200001612
Zero-crossing point of (a);
step 4, calculating all module values of wavelet transformation
Figure RE-GDA0003150980020000163
Maximum value points on the gradient in the direction within the m × m domain of the pixel point (x, y);
removing the sequence of the extreme value amplitude of the coefficient which increases on the average value along with the reduction of the size;
step 6, repeating the steps 2 to 5 for each column of the image;
and in the 7 th step, the point where the extreme value is obtained for 2 times is an edge, and an edge line g (x, y) is set to be 200, otherwise, g (x, y) is set to be 0.
2. Red wine semi-finished product motion edge detection
The image edge is defined as the transition between image coverage areas with different color intensity, wherein, the first differential is calculated for the amplitude, the high point corresponds to the edge point, the zero crossing point of the second differential also represents the edge point, the edge is extracted by the maximum value of the gradient modulus or the zero crossing point of the second derivative.
Fast wavelet transform for finite sequences: a periodic extension method is adopted, a finite sequence is used as a periodic signal to be extended outwards, wherein the critical period length is the length of the sequence, the defect of discontinuity at the boundary caused by a zero interpolation method is overcome, the sequence can be periodically carried out along the corresponding direction, and in order to further improve the operation speed of the finite sequence FWT, addresses are circularly searched in a DSP processor to carry out the periodic extension of the sequence.
The wavelet transform decomposition formula is represented by the general formula:
Figure RE-GDA0003150980020000171
the input sequence is defined as z (m), the scale expansion coefficient is x (w), the coefficient is g (h), when the DSP processor is started, the subscripts of the coefficient sequence range from 0, …, h _ upper, h _ upper represents the maximum value of the subscript,
Figure RE-GDA0003150980020000172
length of input sequence z (m)
Figure RE-GDA0003150980020000174
The lengths of x (w) are divided equally along the scale in turn, and the value interval of k is: 0, …, N/2-1;
and accurately calculating the numerical value of the specified scale according to the algorithm, wherein the specific method comprises the following steps: putting coefficient sequence at the beginning of input sequence, multiplying the coefficient with its corresponding input value, accumulating to obtain the first scale value on the expansion sequence, calculating the product of each new coefficient and corresponding input value at two positions before the coefficient sequence, accumulating to obtain the second value, and so on, until the coefficient sequence completely departs from the input sequence, to ensure that each coefficient can be multiplied by a value in the input sequence, adding a plurality of values of the beginning part of the input sequence at the end part of the sequence, taking the new sequence as the input sequence of the next algorithm, translating the coefficient sequence g (h) (0, …,3) with the original length of 4, finally, the input sequence z (M) (M ═ 0, …, M-1; and M is 2.v,v∈X+)。
When w is 0, the first value x on the scale n +1 is calculatedn+1(0):
zn+1(0)=g(0)·zn(0)+g(1)·zn(1)+g(2)·zn(2)+g(3)·zn(3) Formula 5
The coefficient sequence is then translated to w ═ 1, and a second value z is calculatedn+1(1):
zn+1(1)=g(0)·zn(2)+g(1)·zn(3)+g(2)·zn(4)+g(3)·zn(5) Formula 6
When moving to w-M/2-1, the input sequence can only be multiplied by the first two coefficients, zn(0) And zn(1) Added to the end of the sequence; last value z of the scale n +1n+1(M/2-1) is calculated from the following formula:
Figure RE-GDA0003150980020000173
by analogy, let zn+1(M) (M ═ 0, …, M/2-1) as an input value gives the next scale value n + 2.
(1) Cyclic addressing: circularly addressing by adopting a DSP system; the periodic expansion is guided to finally complete the circular buffer process, which is embodied in a slidable window, the data waiting for processing is stored in the window, after new data input occurs, the original data is overwritten, z (M) is used as the beginning of the buffer area and a storage unit, the data before z (M), such as z (M-1) and z (M-2), are continuously written into the system along the clockwise direction, and are automatically placed into z (M) after each new data is calculated, finally, under the guidance of a related algorithm, the pointer is translated and locked in a specific direction and screens each data until the final output data is generated, and after the process is completed, the pointer is returned to the position of z (M) and immediately moves along the counterclockwise direction, and points to z (M-M), and z (M-M) stores the earliest data, new data will overwrite this data and the entire calculation is repeating the above process. The high-performance microprocessor of the system can provide enough linear storage space, and after the circular addressing instruction is adopted, the linear storage space can be completely converted into a circular cache space, so that the linear storage space can be utilized more greatly.
(2) The kernel of the scale algorithm lies in the inner and outer nested loop use, the inner loop finally obtains a scale value through wavelet transform, the outer loop nested use accurately controls the translation position of the coefficient sequence after the inner loop finishes, in addition, the number of the outer loop operation times corresponds to the number of the needed scale values, before the program starts, a pointer must be initialized, an input sequence is indicated by an AR0 pointer, data of related scales are stored in a buffer area indicated by an AR1 pointer, finally, an AR2 point to a wavelet coefficient table of a system, a cycle number register RC determines the running number of cycles, a length value of a scale to be analyzed is given to the RC in advance before operation, the default minimum is 1, after the cycle starts, calculating all scale values in one scale by the outer loop, and simultaneously calculating one scale value by the inner loop under the control of an RPTS instruction; during this period the following parameters are first specified: first, the number of times the next command is executed in the inner loop: under the control of an RPTS src instruction, the number of times is src + 1; secondly, the cycle number of the system is consistent with the length of the coefficient sequence; thirdly, each value in the system scale sequence is calculated by multiplying the input sequence and the coefficient sequence value in a certain order and then summing, and the calculation is completed through the parallel operation structure of the instruction, and the parallel operation (the identifier is "|") puts two instructions into two parallel units and starts to be executed at the same time, so that the high concurrency is achieved, and the corresponding codes are as follows:
RPTS @L_UPPER
MPYF *AR0++%,*AR2++,R0
||ADDF R0,R2
ADDF R0,R2
r0 and R2 represent two registers that need to be cleared 0 when executing RPTS instructions, and the results stored in R0 are: after the input value pointed by the pointer AR0 and the value obtained by multiplying the coefficient pointed by the pointer AR2 are finished once, the pointers AR0 and AR2 are respectively increased by 1 value to point to the next storage position and the operation is repeated, the initial operation result is also added to the pointer R2 from the pointer R0, the pointer AR0 is continuously increased (indicated by "%") according to the circular addressing algorithm, the pointer AR0 does not return to the initial position of the buffer area again until all the operations in the buffer area are finished, the operation is waited for the beginning of the next operation, the size of the pointer AR0 needs to be clearly defined when the outer loop is executed for the first time, and the circular buffer area and the normal operation of the whole system are ensured.
Assuming that the number of cycles specified by the parallel operation command is the maximum UPPER limit H _ UPPER, the value in the register R2 is continuously changed according to R0 during the cycle, and the execution of the command by using the TMS320C32 goes through four independent steps: 1-fetch, 2-decode, 3-access data, 4-pipeline execution; when the operation command is executed, after data is written into R0, the value of R2 is 0, and after the RPTS command is executed, the control enables the value in R0 to be written into R2 once again; next, the calculated scale value is stored to the storage location indicated by the pointer AR1, and AR1 continues the next run by increasing the value by 1 after the execution is completed,
STF R2,*AR1++
at the end of the loop module WTBLOCK, the pointer AR0 points back to the beginning of the input sequence and at the same time adds the value in register IR 0;
LD I @XARRAY,AR0
NOP *++AR0(IR0)
when sampling in the Mallat algorithm needs to be completed, the specific operation method is as follows: register IR0 is initially initialized to 0 internally before the first execution of loop module WTBLOCK, but at the end its value is incremented by 2, and during the first execution, the AR0 pointer points to Z (0) first, to Z (2) second, to Z (4) third, and so on.
The pointer AR2, when pointing to a sequence of wavelet coefficients, points to the first coefficient in the sequence before the start of each new cycle:
LD I@WLETTAB,AR2
the contents of the registers RC, RE, RS and ST are respectively stored by using the instruction PUSH (before the RPTS instruction is executed), and are recovered by using the instruction POP (after the RPTS instruction is executed), so that the mutual influence among the loop instructions is reduced to the maximum extent, and the loop instruction execution efficiency is improved.
(3) Wavelet edge detection result: according to the comparison between the filtered original image and the image after wavelet edge detection, the wavelet can detect the edge details in the image, and the method has a good detection effect.
Sixthly, realizing system hardware and software
In order to enable the simulator to debug a user hardware system, the simulation head portrait is connected with twelve simulation lines when a circuit board is designed, and the simulator directly debugs software and hardware according to the requirements of the user system; the process of executing the compiling or assembling program and finally converting the compiling or assembling program into the writing Flash Memory file is as follows:
coding by using a program C and an assembler to obtain a target file with an expansion name of OBJ;
linking and executing the target file and the system to obtain an output file of which the OUT is an extension name;
converting the format of the file, and converting the OUT file into a TI format file MBE.TI;
the fourth process, converting the format of the MBE.TI in the third process to obtain a binary file MBE.BIN with the width of octet;
storing the MBE.BIN into a writer, and then writing into a Flash Memory;
the last step of the system running the DSP system is to insert the Flash Memory into the Flash Memory of the circuit board;
the link command file adopted by the system is as follows:
Figure RE-GDA0003150980020000201

Claims (10)

1. the red wine semi-finished product motion detection system based on real-time image analysis is characterized in that morphological filtering, wavelet transformation and multi-scale edge detection are fused on the basis of DSP technology, an edge detection wavelet function structure and algorithm are provided, a real-time red wine semi-finished product image analysis system based on a DSP chip is realized, and a software programming and system debugging method of the DSP system is provided; realizing real-time image analysis of the red wine semi-finished product based on a motion detection method, and designing and realizing a complete red wine semi-finished product motion detection system for real-time image analysis;
the red wine inspection system is used for distinguishing fermentation raw materials mixed in red wine on a production line, is an automatic inspection system for judging whether a semi-finished red wine product is qualified or not, adopts an industrial control microcomputer as a host, adopts a TMS320C32 chip as a slave, carries out motion flow of the semi-finished red wine product in a segmented manner, sends a digital signal to a DSP chip through an image acquisition card and a D/A device to finish image noise reduction, edge detection wavelet function construction and algorithm processing, then sends a processing result to the industrial control microcomputer system for identification and automatic control, removes unqualified red wine components, obtains a mixed image of a red wine solution and residues through image acquisition when the solution mixed with the residues passes through a detection channel, the residues are objects to be detected and removed, removes noise under an industrial environment through an image preprocessing module, and separates the detected objects from a background; then, the edge of the detected object is binarized through an edge detection module; finally, calculating the surface area of the object to be detected according to an identification algorithm, setting a critical threshold, defining the object surface area as residue when the object surface area is larger than the critical threshold, and removing the partial solution in a shunting way by a control system, wherein the partial solution is unqualified;
the red wine semi-finished product motion detection system is composed of a camera, an image A/D conversion device, a DSP system, a display device, an industrial control microcomputer and a control system, wherein the camera, a light source and a detection channel are packaged in a closed box, a far infrared camera is adopted, and the working process comprises the following steps:
firstly, taking images, wherein fermented liquid flows out of a fermentation furnace on a production line, passes through an inspection pipeline at a certain speed, and simultaneously scans the liquid through a linear array CCD camera according to a corresponding frequency to continuously take images of red wine and foreign matter mixture;
and secondly, A/D conversion and DSP image processing, wherein the image shot by the CCD camera sends the digital image to a frame memory of a DSP system through an analog-to-digital conversion device, and high-speed operation processing is carried out on the digital image, wherein the image processing comprises the following steps: enhancing chroma, filtering and denoising, extracting foreign matter edges and carrying out binarization treatment;
thirdly, detecting data of the industrial personal computer, sending edge information processed by the DSP to the industrial personal computer system, identifying and positioning the foreign matters by the industrial personal computer system by calculating the surface area of the foreign matters, sending a control command to the control system, and shunting and removing the detected foreign matters;
and fourthly, controlling the detection channel, adding the identified single particle size or particle content of the foreign matters to be larger than respective standard critical values, proving that the part of red wine solution contains residues and needs to be shunted, synchronously controlling the valve by the control equipment, and enabling the red wine to enter the shunting channel to be rejected or to return to the fermentation furnace for continuous fermentation.
2. The real-time image-resolved red wine semi-finished product motion detection system of claim 1, wherein the DSP system architecture interfaces with external devices: the system adopts two TMS320C32 serial connections to form a pipeline working mode, the previous stage TMS320C32 is used for image preprocessing, the second stage TMS320C32 is used for edge detection, an image A/D chip adopts OV7610 of Omnivision company, address codes are compiled at the same time, and control circuit signal acquisition is completed by using an ISP type EPLS chip;
the system work flow is as follows: after the power is on, the system program is spontaneously loaded into the thirty-two bit off-chip program RAM from the Flash Memory, and after the program code is downloaded, the program code is immediately fed back to the TMS320C32 and then executed; in addition, the system program first passes through I2The bus C sets the working parameters of the OV7610 chip, and after the setting is finished, the OV7610 works according to the preset parameters under the control of the acquisition circuit so as to obtain an image; TMS320C32(1) stores the image data into the frame memory by DMA method, at the same time, the image data in the frame memory is processed in advance, the processed result data is directly sent to the data RAM (1), the next stage TMS320C32(2) carries out wavelet edge detection on the data in the RAM (1), the processed edge data is sent to the data RAM (2) and then sent back to the industrial control microcomputer, the industrial control microcomputer reads the data in the RAM (2) by PCI bus, whether the red wine is qualified or not is judged according to the edge information, and the control system controls the red wine detection process, the whole system works under the control of the industrial control microcomputer, and can also run independently without the industrial control microcomputer.
3. The real-time image analysis red wine semi-finished product motion detection system according to claim 2, wherein the motion image acquisition control circuit: an image chip OV7610 in the system works in a mode of working in a frame or working in a field, output signals comprise three modes of a vertical synchronizing signal VSYNC, a horizontal synchronizing signal HREF and a pixel synchronizing signal PCLK, the composition system ensures that an image finally obtained when the system executes visual algorithm processing is a complete frame image, the VSYNC signal represents the rated time of scanning one frame or one field by the system between two positive pulses, namely the effective time of scanning the complete frame or one field image between the two positive pulses, the HREF signal represents the rated time of scanning one field or one frame image by each line pixel, namely the effective time of scanning one line pixel under the condition of high level signals, and the PCLK signal represents a synchronizing signal provided when the system finishes reading the effective pixel values after scanning one field or one frame;
the image control circuit is used for combining three OV7610 output signals to form unique output, and then the external equipment is used for instantly reading the time sequence of operation, and the working mode of the image acquisition control circuit is as follows: the RESET port keeps a low level state under the condition of power-on, the RESET port is in a high level state when power-off occurs, the states of two D triggers are enabled to be RESET, and meanwhile, no matter how three input signals of VSYNC, HREF and PCLK change, the output end OUT still maintains the low level state, after the circuit starts working, when a frame of image is obtained, a signal is output from a TCLK0 pin of C32 to start a positive pulse, the output of the signal can guide the Q end of the trigger 1 to change from the RESET state to output the high level, and similarly, the D end of the trigger 2 also changes to the high level state; next, the trigger 2 is affected by the positive VSYNC pulse, so that its Q terminal is turned to output high, which brings about two results: firstly, the high level guides the signal after the HREF and the PCLK meet to be output to an OUT end through a NAND gate circuit, and secondly, the output of the high level forces the trigger 1 to be reset again and converted into the output low level, so that the D end of the trigger 2 is converted into the low level; after the next positive pulse comes, the Q end of the trigger 2 starts to output a low level, so that HREF and PCLK signals are shielded, and the output end OUT returns to an output low level state; every time the system outputs a start positive pulse signal, the output end OUT obtains the effective pixel value of a complete image of a frame, and reads the synchronous signal.
4. The real-time image-resolved red wine semi-finished product movement detection system of claim 2, wherein image DMA access: reading an image from the OV7610 by adopting a DMA method and storing the image into a frame memory to synchronously perform two operations of image acquisition and visual algorithm processing, wherein two DMA pipelines are arranged in a TMS320C32 chip, DMA is simultaneously performed by utilizing the two pipelines in the two processes of operating DMA reading and writing, and external interruption, serial port sending, receiving interruption and timer interruption contained in the reading and writing processes keep the synchronous utilization of interrupt signals through a special framework;
the synchronous signal of DMA operation in the system is the output OUT end in the circuit, the DMA source address utilizes the output port address of OV7610, keep DMA address unchanged after the operation begins, set up the address of the frame memory as DMA target address at the same time, add 1 to the address value after each operation; when the image acquisition starting signal is sent by the C32, the system stores a complete image of one frame into the frame memory in a DMA mode;
industrial control microcomputer interface: the method comprises the steps of adopting a dual-port memory to realize communication between TMS320C32 and an industrial personal computer, obtaining boundary information of foreign matters detected in red wine after the memory of the industrial personal computer obtains result data, calculating the surface area of the foreign matters, judging whether the red wine meets qualified standards, controlling a detection channel of the red wine by a controller if the red wine does not meet the standards, removing unqualified parts in a shunting way, installing a shunting valve in the red wine detection channel, normally opening the valve, opening the detection channel, closing the shunting channel, enabling the red wine to flow into a continuous detection channel or a semi-finished product area, sending a control command to a servo mechanism by the computer if an unqualified product is detected, driving the controller to rotate the valve by the servo mechanism, closing the detection channel, opening the shunting channel, and removing the red wine from the shunting channel.
5. The system for detecting motion of red wine semi-finished product through real-time image analysis according to claim 1, wherein in the real-time image analysis detection based on DSP chip, the TMS320C32 and external memory interface comprises:
the memory adopts a double-frame memory architecture, one type of frame memory is used for image acquisition and image display and is composed of DRAM memory chips, the other type of frame memory is used for a DSP processor and is composed of SRAM memory chips;
memory interface, program memory uses thirty-two bit width, when 8 or 16 bit data is needed in the system, one method is to directly draw a certain amount of memory in 32 bit program memory as 8 bit or 16 bit data memory; the other method is to adopt two groups of memories with different widths, one group is 32 bits, the other group is 8 bits or 16 bits, one group is 32 Kx32 bits, STRB0\ gating is adopted, a control register is set to be 000F0000H, the width of the physical memory is 32 bits, and the data type is 32 bits; the other group is 32 Kx 8 bits, the STRB1\ gating is used, the control register is set to be all 0, the width of the physical register is 8 bits, the data type is 8 bits, C32 and 32 Kx 32 bit memory interface address lines A0 to A14 are mutually connected, four pieces of data lines form 32 bits of data, chip selection lines of the four pieces of memory are respectively connected with four gate lines of the STRB0\ when the C32 and the 8 bit memory interface are used, the STRB1_ B0\ is used as the gate lines, the internal address of the C32 is displayed on an external address pin after being shifted to the right by two bits, and the STRB1_ B3\ A _1 and the STRB1_ B2\ A _2 are used as additional address lines.
6. The system for real-time image-resolved motion detection of red wine semi-finished products according to claim 1, wherein TMS32C32 and I2C, hardware connection of a bus and an A/D chip: TMS320C32 and OV7610 utilize I2The C bus carries out hardware connection of data communication: i is carried out between TMS320C32 and OV76102C bus data communication, OV 7610I2CLKX0 of C bus pin SCL and C32 is connected, SDA is connected with DX0 of C32, and a resistor is added between Vcc, SCL and SDA, the resistance value is 4.7k, SDA low level is kept, CLKX0 and DX0 are used as output pins, I is2The time sequence control of C is realized by software, programming is controlled, OV7610 is initialized, and parameters are set;
TMS320C32 and OV7610 carry out I2C, bus data communication programming: OV7610 is slave device, in the internal address distribution, the occupation address of 52 registers is 00H to 34H, the write operation address is 42H, the read operation address is 43H, in the data transfer process, C32 is used as the master device and provided with a transmitter, OV7610 is used as the slave device and provided with a receiver, the write-in of a plurality of registers is completed once, the master device continuously transmits data, the register address can be automatically added with value, the written data are sequentially stored in the registers with continuous addresses, the work flow can improve the efficiency, the repeated execution of all the processes of transmitting data is avoided, and a large amount of data can be transmitted once as long as the SDA generates a response signal; c32 for read operation, C32 as master with receiver and OV7610 as slave with transmitter.
7. The real-time image-resolved red wine semi-finished product motion detection system of claim 1, wherein based on TMS320C32 master-slave system hardware: the method is realized by adopting a plurality of DSPs and a general microprocessor MPU, each processor finishes partial work of a system, the MPU is defined as a host, the DSP is defined as a slave, the host controls the slave, the MPU controls the running and suspension of the DSP, the DSP gives data acquired from the outside to the DSP for disposal under the control of the MPU, the DSP transmits corresponding results acquired after the disposal to the MPU, and the MPU transmits the disposal results to other systems;
the dual-computer communication between the host and the slave is realized by adopting the following steps: the method comprises the steps that a memory sharing mode is adopted, a general x86 computer is adopted as a main processor, a DSP undertakes real-time input/output processing, the main CPU is responsible for various controls, and after the DSP is finished, the main CPU judges a processing result and determines whether a detected product meets the specification or not;
the data bus and address bus of the double-port RAM of the shared memory are the same as the single-port RAM, two groups of buses access in sequence, the arbitration logic of the bus in the chip sends a waiting signal to one party accessing backwards, only when the two groups of address buses are all the same, the party is allowed to wait, when the other party finishes accessing, the waiting party accesses, the bus arbitration logic determines the sequence of the access of the two groups of buses, the parallel processing capability of the industrial control microcomputer and the DSP chip is improved, and the special structure of the double-port RAM promotes the double-machine to conveniently exchange data.
8. The real-time image-resolved red wine semi-finished product motion detection system of claim 1, wherein the real-time image-resolved motion detection system: detecting a moving target of an existing AVI video, determining the position of the moving target by detecting the moving target in an image sequence, acquiring the image sequence through the existing AVI video by video acquisition by adopting an improved background difference method, modeling the background to obtain an accurate background image, extracting the current background from a plurality of images, denoising the background image from the sequence image by target extraction, comparing the background image with the denoised current image when the sequence image contains the moving target, detecting a corresponding area of the moving target, and extracting a change area from the background image;
the improved background difference method uses the current image and the background image to detect the motion foreground differentially, which is a motion target detection algorithm based on background modeling, and comprises video acquisition, conversion of dynamic image sequence, preprocessing, background modeling, foreground detection and extraction of motion background, wherein the dynamic image sequence conversion converts AVI video into image sequence, the image preprocessing improves the quality of input image, transforms outstanding useful information, and removes or weakens useless information, the image extracts the motion foreground after the background modeling and the foreground detection, and extracts the detected motion target by using a frame, so as to obtain the final detection result, and the unqualified residue component in red wine solution is determined and removed, so that the online detection of the red wine semi-finished product is realized.
9. The real-time image-resolved red wine semi-finished product movement detection system of claim 1, wherein the morphological pre-processing module: in formula 1, g (x, y) represents a gray image, f (x, y) represents an architectural element, l (x, y) represents a smooth image of h (x, y), and the shape of the operation is defined
Figure FDA00030903564600000510
And the mean value of the morphology closed f.g, a smoothed image l (x, y) expressing the gray level image g (x, y),
Figure FDA0003090356460000051
in order to express the target that may be included in the high frequency part of the spatial domain, the difference between the original g (x, y) and l (x, y), i.e. the residual image b (x, y), must be grasped, as shown in equation 2:
b (x, y) ═ g (x, y) -1(x, y) formula 2
Further carrying out local critical value segmentation on the residual image b (x, y), and obtaining a corresponding target image sequence without background noise by the treatment of a critical threshold;
the morphological DSP implementation method is divided into shift, OR, AND-AND.
10. The real-time image-resolved red wine semi-finished product movement detection system of claim 1, wherein the edge detection module:
firstly, a wavelet edge detection function construction method:
wavelet transforms decompose an image into three components: smooth images
Figure FDA0003090356460000052
Horizontal detail image
Figure FDA0003090356460000053
And vertical detail images
Figure FDA0003090356460000054
Wherein,
Figure FDA0003090356460000055
g (x, y) is the original two-dimensional digital signal,
Figure FDA0003090356460000056
is a discrete profile of g (x, y) at resolution j,
Figure FDA0003090356460000057
is the discrete detail of g (x, y) in the vertical direction at resolution j,
Figure FDA0003090356460000058
is a discrete detail in the vertical direction at resolution j, taken
Figure FDA0003090356460000059
The wavelet edge detection flow algorithm of the invention is as follows:
step 1, selecting a decomposition scale J;
step 2, each line of g (x, y) needs to increase J value two-dimensional binary wavelet transform, and J is more than 0 and less than J; can obtain
Figure FDA0003090356460000061
Step 3, find out
Figure FDA0003090356460000062
Zero-crossing point of (a);
step 4, calculating all module values of wavelet transformation
Figure FDA0003090356460000063
Maximum value points on the gradient in the direction within the m × m domain of the pixel point (x, y);
removing the sequence of the extreme value amplitude of the coefficient which increases on the average value along with the reduction of the size;
step 6, repeating the steps 2 to 5 for each column of the image;
step 7, taking the point where the extreme value is obtained for 2 times as an edge, and setting an edge line g (x, y) to be 200, otherwise, setting g (x, y) to be 0;
secondly, detecting the moving edge of the red wine semi-finished product:
the image edge is defined as the transition between image coverage areas with different color intensity, wherein, the first differential is calculated for the amplitude, the high point corresponds to the edge point, the zero crossing point of the second differential also represents the edge point, the edge is extracted by the maximum value of the gradient module or the zero crossing point of the second derivative, the invention applies the DSP processor in the wavelet analysis, and the parallel computation of the wavelet transformation is realized;
fast wavelet transform for finite sequences: a periodic extension method is adopted, a finite sequence is used as a periodic signal to be extended outwards, wherein the critical period length is the length of the sequence, the defect of discontinuity at the boundary caused by a zero interpolation method is overcome, the sequence can be periodically carried out along the corresponding direction, and in order to further improve the operation speed of the FWT of the finite sequence, addresses are circularly searched in a DSP processor to carry out the periodic extension of the sequence;
the wavelet transform decomposition formula is represented by the general formula:
Figure FDA0003090356460000064
the input sequence is defined as z (m), the scale expansion coefficient is x (w), the coefficient is g (h), when the DSP processor is started, the subscripts of the coefficient sequence range from 0, …, h _ upper, h _ upper represents the maximum value of the subscript,
Figure FDA0003090356460000065
length M of input sequence z (M) is 2v,v∈X+And the lengths of x (w) are divided equally along the scale in sequence, and the value interval of k is as follows: 0, …, N/2-1;
and accurately calculating the numerical value of the specified scale according to the algorithm, wherein the specific method comprises the following steps: putting coefficient sequence at the beginning of input sequence, multiplying the coefficient with its corresponding input value, accumulating to obtain the first scale value on the expansion sequence, calculating the product of each new coefficient and corresponding input value at two positions before the coefficient sequence, accumulating to obtain the second value, and so on, until the coefficient sequence completely departs from the input sequence, to ensure that each coefficient can be multiplied by a value in the input sequence, adding a plurality of values of the beginning part of the input sequence at the end part of the sequence, taking the new sequence as the input sequence of the next algorithm, translating the coefficient sequence g (h) (0, …,3) with the original length of 4, finally, the input sequence z (M) (M ═ 0, …, M-1; and M is 2.v,v∈X+);
When w is 0, the first value x on the scale n +1 is calculatedn+1(0):
zn+1(0)=g(0)·zn(0)+g(1)·zn(1)+g(2)·zn(2)+g(3)·zn(3) Formula 5
The coefficient sequence is then translated to w ═ 1, and a second value z is calculatedn+1(1):
zn+1(1)=g(0)·zn(2)+g(1)·zn(3)+g(2)·zn(4)+g(3)·zn(5) Formula 6
When moving to w-M/2-1, the input sequence can only be multiplied by the first two coefficients, zn(0) And zn(1) Added to the end of the sequence; last value z of the scale n +1n+1(M/2-1) is calculated from the following formula:
Figure FDA0003090356460000071
by analogy, let zn+1(M) (M ═ 0, …, M/2-1) as an input value gives the next scale value n + 2.
CN202110594150.XA 2021-05-28 2021-05-28 Real-time image analysis type red wine semi-finished product motion detection system Withdrawn CN113284116A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110594150.XA CN113284116A (en) 2021-05-28 2021-05-28 Real-time image analysis type red wine semi-finished product motion detection system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110594150.XA CN113284116A (en) 2021-05-28 2021-05-28 Real-time image analysis type red wine semi-finished product motion detection system

Publications (1)

Publication Number Publication Date
CN113284116A true CN113284116A (en) 2021-08-20

Family

ID=77282660

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110594150.XA Withdrawn CN113284116A (en) 2021-05-28 2021-05-28 Real-time image analysis type red wine semi-finished product motion detection system

Country Status (1)

Country Link
CN (1) CN113284116A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115169387A (en) * 2022-06-20 2022-10-11 脉冲视觉(北京)科技有限公司 Foreground detection method and device of pulse signal, electronic equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3048049B1 (en) * 1998-02-18 2000-06-05 株式会社スキャンテクノロジー Foreign matter inspection system
US6081324A (en) * 1998-06-22 2000-06-27 Scan Technology Co., Ltd. Foreign matter detecting system
CN101692056A (en) * 2009-10-15 2010-04-07 湖南大学 Method and device for automatically detecting impurities in health wine
CN101859378A (en) * 2010-06-11 2010-10-13 湖南大学 Visual detection method for quality of liquid medicine on high-speed pharmaceutical production line
CN105181714A (en) * 2015-09-08 2015-12-23 哈尔滨工程大学 Image processing-based bottled liquid impurity detection system and detection method thereof
CN108896574A (en) * 2018-05-11 2018-11-27 四川大学 A kind of bottled liquor method for detecting impurities and system based on machine vision
CN109883959A (en) * 2019-02-26 2019-06-14 江苏大学 A kind of Portable multiple spectrum imaging device and its application based on array sensor chip
CN109978874A (en) * 2019-04-02 2019-07-05 湖南大学 A kind of rail surface defects vision inspection apparatus and recognition methods
CN110717852A (en) * 2019-06-13 2020-01-21 内蒙古大学 FPGA-based field video image real-time segmentation system and method
WO2020026114A1 (en) * 2018-08-03 2020-02-06 Proxentia S.R.L. System for the rapid analysis of samples and corresponding reader, cartridge and method
CN111627025A (en) * 2020-05-21 2020-09-04 江苏华阳智能装备股份有限公司 Bottled liquid medicine intelligent detection method and system

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3048049B1 (en) * 1998-02-18 2000-06-05 株式会社スキャンテクノロジー Foreign matter inspection system
US6081324A (en) * 1998-06-22 2000-06-27 Scan Technology Co., Ltd. Foreign matter detecting system
CN101692056A (en) * 2009-10-15 2010-04-07 湖南大学 Method and device for automatically detecting impurities in health wine
CN101859378A (en) * 2010-06-11 2010-10-13 湖南大学 Visual detection method for quality of liquid medicine on high-speed pharmaceutical production line
CN105181714A (en) * 2015-09-08 2015-12-23 哈尔滨工程大学 Image processing-based bottled liquid impurity detection system and detection method thereof
CN108896574A (en) * 2018-05-11 2018-11-27 四川大学 A kind of bottled liquor method for detecting impurities and system based on machine vision
WO2020026114A1 (en) * 2018-08-03 2020-02-06 Proxentia S.R.L. System for the rapid analysis of samples and corresponding reader, cartridge and method
CN109883959A (en) * 2019-02-26 2019-06-14 江苏大学 A kind of Portable multiple spectrum imaging device and its application based on array sensor chip
CN109978874A (en) * 2019-04-02 2019-07-05 湖南大学 A kind of rail surface defects vision inspection apparatus and recognition methods
CN110717852A (en) * 2019-06-13 2020-01-21 内蒙古大学 FPGA-based field video image real-time segmentation system and method
CN111627025A (en) * 2020-05-21 2020-09-04 江苏华阳智能装备股份有限公司 Bottled liquid medicine intelligent detection method and system

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
李艳婷;王水鱼;: "视频图像中动态目标检测系统的FPGA硬件设计", 计算机系统应用, no. 03 *
林克正: "基于小波分析的焊缝图象处理与识别的研究", 中国优秀博硕士学位论文全文数据库 (博士)信息科技辑, pages 26 - 64 *
王克勇;宋承天;郑链;: "基于局部纹理分析的红外小目标检测及其DSP实现", 光学技术, no. 1 *
肖方良: "劲酒中可见异物的图像检测技术研究", 中国优秀硕士学位论文全文数据库信息科技辑, pages 10 - 59 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115169387A (en) * 2022-06-20 2022-10-11 脉冲视觉(北京)科技有限公司 Foreground detection method and device of pulse signal, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US9451142B2 (en) Vision sensors, systems, and methods
US8570393B2 (en) System and method for processing image data relative to a focus of attention within the overall image
Joshi et al. OpenCV by example
Wu et al. Text Detection and Recognition for Natural Scene Images Using Deep Convolutional Neural Networks.
CN114065874A (en) Medicine glass bottle appearance defect detection model training method and device and terminal equipment
CN113284116A (en) Real-time image analysis type red wine semi-finished product motion detection system
Han et al. Adaptive feature representation for visual tracking
Ahmad et al. Implementasi Convolutional Neural Network (CNN) untuk Klasifikasi Ikan Cupang Berbasis Mobile
Huang et al. The detection of defects in ceramic cell phone backplane with embedded system
CN102039738A (en) Page online fuzzy identification system of high-speed binding machine
CN111914786B (en) Finger vein recognition method and system
Georgantzoglou et al. Image Processing with MATLAB and GPU
Bilal et al. Rapid prototyping of image contrast enhancement hardware accelerator on FPGAs using high-level synthesis tools
Yang et al. Defect recognition of printed circuit board based on YOLOv3-DenseNet optimization model
Qiu et al. Real-Time Object Detection based on the Heterogeneous SoC Platform.
Zhang et al. An efficient and universal polygon prediction method based on derivable analytic geometry for arbitrary-shaped text detection
Ren et al. The application of Virtex-II Pro FPGA in high-speed image processing technology of robot vision sensor
CN111914787B (en) Register configuration method for finger vein recognition SOC system
Liu et al. Identification and reading method of pointer meter based on CBAM D2-Net
Reddy et al. YOLO-Extract: Improved YOLOv5 for Aircraft Object Detection in Remote Sensing Images
Nogueira et al. Object Tracking and Detection on FPGA Board Cyclone II
CN204680067U (en) A kind of motor cell image processing system based on FPGA
Lougheed et al. An analysis of computer architectural factors contributing to image processor capacity
Mohan et al. Design and implementation of shape-based feature extraction engine for vision systems using Zynq SoC
BR102021004789A2 (en) FLEXIBLE ARCHITECTURE FOR THE DEVELOPMENT OF COMPUTER VISION SYSTEMS IN FPGA

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20210820

WW01 Invention patent application withdrawn after publication