CN109709843B - Train water filling port detection and positioning method - Google Patents

Train water filling port detection and positioning method Download PDF

Info

Publication number
CN109709843B
CN109709843B CN201811522435.7A CN201811522435A CN109709843B CN 109709843 B CN109709843 B CN 109709843B CN 201811522435 A CN201811522435 A CN 201811522435A CN 109709843 B CN109709843 B CN 109709843B
Authority
CN
China
Prior art keywords
water filling
filling port
train
video image
matching
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.)
Active
Application number
CN201811522435.7A
Other languages
Chinese (zh)
Other versions
CN109709843A (en
Inventor
周慧鑫
向培
邓宝凯
宋江鲁奇
郭立新
于跃
赵东
秦翰林
王炳健
赖睿
李欢
姚博
贾秀萍
周峻
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xidian University
Original Assignee
Xidian University
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 Xidian University filed Critical Xidian University
Priority to CN201811522435.7A priority Critical patent/CN109709843B/en
Publication of CN109709843A publication Critical patent/CN109709843A/en
Application granted granted Critical
Publication of CN109709843B publication Critical patent/CN109709843B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)

Abstract

The invention discloses a train water filling port detection and positioning method, which comprises the steps of collecting a train water filling port video image, and simultaneously carrying out threshold segmentation on the train water filling port video image to obtain a binaryzation train water filling port video image; and processing the binarized train water filling port video image and matching the binarized train water filling port video image with a train water filling port template image, detecting the position of a water filling port in the train water filling port video image, comparing the position with a preset position range where the water filling port is located, and if the position is matched, transmitting a matching effective signal to a mechanical device control module to control a mechanical device to move and stop, and starting water filling and stopping water filling. The invention can realize the automatic detection and identification of the train water filling port, can detect the parked train in real time for 24 hours, saves a large amount of labor cost and has high working efficiency.

Description

Train water filling port detection and positioning method
Technical Field
The invention belongs to the technical field of train water filling port detection, and particularly relates to a train water filling port detection and positioning method.
Background
At present, the railways in China are developed rapidly, the high-speed rail technology is more reputable to the world, but the common trains still occupy the main position in railway transportation in China. Because of the water demand and consumption of train passengers and the like, the water in the train water storage tank needs to be continuously replenished, and the water adding work of the train water storage tank in China needs to be manually completed at present. The train is short in station entering and stopping time, water needs to be added to each carriage at the same time, railway workers move to and fro between each train water injection port and a water well, and the efficiency is low. Because of the water demand of the train, the railroad workers must work continuously for 24 hours regardless of weather conditions, thereby having a certain influence on the health of the railroad workers. The labor cost is huge and the efficiency is low due to the manual water injection, so that the development of a novel automatic train water feeding device is particularly important. Most of the existing train water feeding devices are matched with railway workers through mechanical devices to butt joint a water filling gun and a train water filling port. Due to the limitation of factors such as the surrounding environment of a train at a stop and the like, the existing train water feeding device cannot be separated from manual cooperation to carry out full-automatic water feeding.
Disclosure of Invention
In view of the above, the present invention provides a method for detecting and positioning a water filling port of a train.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
the embodiment of the invention provides a method for detecting and positioning a water filling port of a train, which comprises the following steps: acquiring continuous train water filling port video images, and simultaneously performing threshold segmentation on the train water filling port video images to obtain binary train water filling port video images; and processing the binarized train water filling port video image and matching the binarized train water filling port video image with a train water filling port template image, detecting the position of a water filling port in the train water filling port video image, comparing the position with a preset position range where the water filling port is located, and if the position is matched, transmitting a matching effective signal to a mechanical device control module to control a mechanical device to move and stop, and starting water filling and stopping water filling.
In the above scheme, the threshold segmentation is performed on the train water filling port video image to obtain a binarized train water filling port video image, which specifically comprises: and (3) carrying out binarization segmentation on the video image of the water injection port of the train according to a binarization threshold value, and sequentially generating an mxn video image window according to the pixel size of 1.
In the above scheme, the position of the pixel in the first row and the first column in the video image window position in the whole frame image is marked as a video image window position coordinate P (i, j).
In the above scheme, the specific process of obtaining the binarization threshold value is as follows: and counting the number of pixels corresponding to each gray value in the current frame image in the train water filling port video image to form an abstract gray histogram, and calculating a binarization threshold with the best segmentation effect according to the abstract gray histogram.
In the scheme, the maximum value M1 and the corresponding gray value G1 in the abstract gray histogram are determined, the secondary high peak value M2 and the corresponding gray value G2 in the right part of the gray value G1 in the abstract gray histogram are determined, the histogram between G1 and G2 is calculated to obtain the peak-valley minimum value M3 and the corresponding gray value G3, and G3 is defined as the binarization threshold.
In the above-mentioned scheme, compare with the preset position scope at water filling port place, if match then will match effective signal transmission and control mechanical device to remove or stop to and begin the water injection or stop the water injection mechanical device control module, specifically do: and comparing the generated video image window with the train water filling port template image, calculating the total number of pixels of the video image window and the train water filling port template image which are the same at the same position, recording the total number as a window matching result, verifying the matching degree of the window matching result, verifying the window matching position in combination with the video image window position P (i, j) to obtain a matching effective signal, and sending the matching effective signal to a mechanical device control module.
In the above scheme, the generated video image window is compared with the train water filling port template image, the total number of the two pixels at the same position is calculated, and the result is recorded as a window matching result, specifically: sequentially storing m lines in the binarized video image into m FIFOs, leftwards moving data read from the m FIFOs as shift bits to corresponding m n-bit shift registers, performing bitwise coincidence or on the read m n-bit shift registers and m n-bit template registers, adding coincidence or results of each line, counting the number of the same pixels in each corresponding n-bit register to form n line matching results, performing summation again on the m corresponding n-bit register line matching results, and counting the number of the same pixels of a video image window and a train water filling port template image, namely window matching results.
In the above scheme, the method further comprises: verifying the window matching result, and comparing the window matching result with the set matching threshold value: and if the window matching result is greater than the matching threshold, matching the pixel number, then performing position matching, and if the window matching result is less than the matching threshold, waiting for the next clock window matching result to arrive, and continuing to perform pixel number matching.
In the above scheme, the method further comprises: and carrying out position verification on the video image window with successfully matched pixel number, and comparing a position matching result P (i, j) with a set window position range: if Pi, j is within the set window position range, the position matching is successful and a matching valid signal is transmitted to the mechanical device control module, and if Pi, j is not within the set window position range, the next verification is waited.
In the above scheme, the method further comprises: the light intensity in the surrounding environment is detected in real time, and when the detected ambient illuminance is lower than a set illuminance threshold value, the external illuminating lamp is controlled to be turned on or turned off.
Compared with the prior art, the automatic detection and identification device can realize automatic detection and identification of the train water filling port, can detect a stopped train in real time for 24 hours, saves a large amount of labor cost and has high working efficiency.
Drawings
FIG. 1 is a schematic diagram of pixel statistics in a method for detecting and positioning a water filling port of a train according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of threshold segmentation in a method for detecting and positioning a water filling port of a train according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating the generation of a video image window in a method for detecting and positioning a water filling port of a train according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of template matching in a method for detecting and positioning a water filling port of a train according to an embodiment of the present invention;
FIG. 5 is a block diagram of a FPGA-based train water filling port detection and positioning system in accordance with an embodiment of the present invention;
fig. 6 is a block diagram of a structure of a train water filling port detection and positioning system based on an FPGA according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the invention provides a method for detecting and positioning a water filling port of a train, which comprises the following steps: acquiring continuous train water filling port video images, and simultaneously performing threshold segmentation on the train water filling port video images to obtain binary train water filling port video images; and processing the binarized train water filling port video image and matching the binarized train water filling port video image with a train water filling port template image, detecting the position of a water filling port in the train water filling port video image, comparing the position with a preset position range where the water filling port is located, and if the position is matched, transmitting a matching effective signal to a mechanical device control module to control a mechanical device to move or stop, and starting water filling or stopping water filling.
The method for obtaining the binary train water filling port video image by carrying out threshold segmentation on the train water filling port video image specifically comprises the following steps: and (3) carrying out binarization segmentation on the video image of the water injection port of the train according to a binarization threshold value, and sequentially generating an mxn video image window according to the pixel size of 1.
And marking the position of the pixel of the first row and the first column in the video image window in the position of the video image window in the whole frame image as a video image window position coordinate P (i, j).
The specific process for obtaining the binarization threshold value is as follows: and counting the number of pixels corresponding to each gray value in the current frame image in the train water filling port video image to form an abstract gray histogram, and calculating a binarization threshold with the best segmentation effect according to the abstract gray histogram.
Determining a maximum value M1 and a corresponding gray value G1 in the abstract gray histogram, determining a secondary high peak value M2 and a corresponding gray value G2 in the right part of the gray value G1 in the abstract gray histogram, calculating the histogram between G1 and G2 to obtain a peak-valley minimum value M3 and a corresponding gray value G3, and defining G3 as a binary threshold value.
Specifically, as shown in fig. 1, the resolution of the consecutive video images of the train water filling port collected in the present invention is 640 × 480, and therefore the bit width of the dual-port RAM is set to be 16. Both ports of the dual-port RAM support reading and writing, the pixel gray value of the currently arrived video image is used as the address of the port A of the dual-port RAM, and the stored data is read from the port A of the dual-port RAM and is added into an adder; and simultaneously delaying the arriving video image pixel to the B port of the double-port RAM by a clock through the cache register to be used as the address of the B port of the double-port RAM, and storing the data calculated by adding an adder into the double-port RAM through the B port. And when the statistics of all the images of one frame is finished, controlling and reading out the pixel statistical result by the address of the B port of the double-port RAM in the frame blanking period.
As shown in fig. 2, the pixel statistics result enters the first comparator one by one, the first comparator leaves a large value and discards a small value, and finally the maximum value M1 of the pixel statistics result is obtained, and the address of the dual-port RAM storage space corresponding to the maximum value is read as the corresponding gray value G1. Secondly, a 5-level comparator is arranged, the 5-level comparator leaves small values and abandons large values, the pixel statistical results with the gray values larger than G1 sequentially enter the 5-level comparator, if the numerical value of a certain gray statistic sequentially appears in the five-level comparator, the numerical value is considered as the first valley M12 on the right side of G1, and then the comparator is used for calculating the second highest peak M2 on the right side of the corresponding gray value G12, which corresponds to the gray value G2. And finally, setting a second comparator, leaving a small numerical value and discarding a large numerical value by the second comparator, sequentially entering pixel statistical results from G1 to G2 into the second comparator, calculating to obtain a minimum value M3, wherein the corresponding gray value is G3, and defining G3 as a binarization threshold.
The generated video image window is compared with the train water injection port template image, the total number of the video image window and the train water injection port template image which are the same in the same position pixel point is calculated, and the result is recorded as a window matching result, and the method specifically comprises the following steps: sequentially storing m lines in the binarized video image into m FIFOs, leftwards shifting data read out from the m FIFOs as shift bits to corresponding m n-bit left shift registers, carrying out bitwise coincidence on the read m n-bit left shift registers and m n-bit template image registers, adding each bit of the coincidence result of each line, namely counting the number of the same pixels in each corresponding n-bit register to form n line matching results, and summing the line matching results of the m corresponding n-bit registers again, namely counting the number of the same pixels of a video image window and a train water filling port template image, namely a window matching result.
Specifically, as shown in fig. 3, the train water filling port template image consists of m FIFOs and a left shift register, the number of lines of the train water filling port template image is 24, so that the number of m in this case is 24; each line of the binarized video image has 640 pixels, so that the depth of the FIFO is set to be 640; since the gray value bit width per pixel is 1, the width of the FIFO is 1. The binarized video image pixels first enter the FIFO1, then enter the FIFO2 when the FIFO is filled, and then end the 24-line image buffer when all the 24 FIFOs are filled, thus generating a 24-line two-dimensional image matrix. 24 16-bit left shift registers are arranged to correspond to 24 FIFOs, when the 24 FIFOs are completely written, the carry bits are simultaneously read out to the left shift registers, and the 24 16-bit left shift registers form a 16 x 24 video image window. When the 24 FIFOs are completely written, a window column counter and a window row counter are set, when the FIFOs read one data, the window column counter is added with a row coordinate for calibrating the first pixel of the window, and when the window column counter reaches 640, the window row counter is added with one for calibrating the row coordinate of the first pixel of the window.
As shown in fig. 4, the matching result is obtained by matching the video image window and the train water filling port template image according to the position. The template images of the water filling port of the train are stored in 24 16-bit template image registers, corresponding to 24 16-bit left shift registers of a video image window, each pair of registers are subjected to bitwise exclusive OR operation to obtain a group of 16 x 24 exclusive OR results, and the 16 x 24 exclusive OR results are placed in 24 16-bit exclusive OR result registers. Firstly, adding each bit of data in each register of the same or result to obtain a line matching result, wherein the added sum is the number of 1 in the register, namely the number of pixels successfully matched with the first line of the water filling port template image of the train, and then adding the 24 line matching results to obtain a window matching result.
Whether the video image window is successfully matched with the train water filling port template image or not is determined, and then whether the window which is successfully matched is within the range of the specified position or not is determined. Setting a matching threshold PE, when a window matching result is greater than the PE, matching successfully, then reading in coordinates of a window which is successfully matched from a video image window generation module, judging whether the coordinates of the window which is successfully matched are within a set range through a comparator, namely, the abscissa is greater than RA and smaller than RB, the ordinate is greater than CA and smaller than CB, and if the coordinates are within the range, matching successfully, and sending a matching effective signal to a mechanical device. PE, RA, RB, CA, CB are preset values, with PE generally equal to 325, RA equal to 298, RB equal to 318, CA equal to 222, and CB equal to 242.
And after the train stops, the mechanical device is started, and a moving time timer is started. And after the matched effective signal is transmitted to the control module of the mechanical device, the mechanical device stops moving, the moving time timer stops timing, and the water injection gun stretches out to start water injection. After 6 minutes, stopping water injection, and returning the mechanical device according to the time counted by the moving time timer.
The method further comprises the following steps: the light intensity in the surrounding environment is detected in real time, and when the detected ambient illuminance is lower than a set illuminance threshold value, the external illuminating lamp is controlled to be turned on or turned off.
Specifically, when light is dim around the train water filling port, the CMOS camera can not work normally, so utilize the light detector real-time supervision surrounding environment's light, when illuminance was low excessively, the light detector sent the control of illumination start signal and opened the light.
The embodiment of the invention also provides a train water filling port detection and positioning system based on the FPGA, as shown in fig. 5 and 6, comprising: the system comprises a video acquisition module 1, an image cache module 2, an image processing module 3, a mechanical device control module 4 and an ambient light adjusting module 5;
the video acquisition module 1 is used for acquiring continuous train water filling port video images, decoding the train water filling port video images, and respectively transmitting the decoded train water filling port video images to the image cache module 2, the image processing module 3 and the mechanical device control module 4;
the image caching module 2 is used for receiving the decoded train water filling port video images, caching two frames of train water filling port video images and coordinate information of all pixel positions, and sending the cached train water filling port video images and the coordinate information of the pixel positions to the image processing module 3;
the image processing module 3 is used for preprocessing the acquired train water filling port video image, matching the preprocessed image with a train water filling port template image, detecting the position of a water filling port in the train water filling port video image, comparing the detected position with a preset position range where the water filling port is located, determining whether the detected position is matched, and transmitting a matching effective signal to the mechanical device control module 4 if the detected position is matched;
the mechanical device control module 4 is used for sending a mechanical device working mode control signal to a receiving unit of the mechanical device to control the movement and stop of the mechanical device, and simultaneously controlling the mechanical device to start water injection and stop water injection by combining a matching effective signal;
the ambient light adjusting module 5 is used for detecting the intensity of light in the surrounding environment, controlling the on and off of an illuminating lamp and adjusting the ambient brightness in real time;
the video acquisition module 1 comprises a CMOS camera 11, a USB2.0 video interface 12, a video decoding chip 13 and an FPGA video control submodule 14;
the CMOS camera 11 is used for acquiring a train water filling port video image with the resolution of M multiplied by N pixels and the frame frequency of f, wherein the acquired gray value of each pixel is 8-bit integer data, and the acquired data are transmitted to the USB2.0 video interface 12 through a USB data line;
the USB2.0 video interface 12 is used for receiving the video image of the water filling port of the train, which is acquired by the CMOS camera 11, and transmitting the video image of the water filling port of the train to the video decoding chip 13 by using a differential transmission mode;
the video decoding chip 13 is used for recoding the video image of the water filling port of the train transmitted by the USB2.0 video interface 12 into 8-bit pixel signals, line synchronizing signals and frame synchronizing signals, and calling the 10-bit signals as decoded video images, and then parallelly transmitting the decoded video images to the FPGA video control submodule 14;
the FPGA video control submodule 14 is configured to receive a decoded video image transmitted by the video decoding chip 13, calibrate pixel position coordinate information for each pixel according to a line synchronization signal and a frame synchronization signal, transmit the decoded video image to the image cache module 2 and the image processing module 3, and transmit a first line of pixels in the decoded video image to the mechanical device control module 4;
the image cache module 2 comprises an FPGA cache control submodule 21 and an SDRAM memory 22, wherein the SDRAM memory comprises SDRAM1 and SDRAM 2;
the FPGA cache control submodule 21 is used for receiving the decoded video image transmitted by the video acquisition module 1, writing the decoded video image into one SDRAM, reading out the decoded video image in the other SDRAM at the same time, and transmitting the decoded video image to the image processing module 3;
the SDRAM 22 comprises two SDRAMs, each SDRAM is used for storing a frame of decoded video image, the module reads the decoded video image from the FPGA cache control submodule 21 and stores the decoded video image into a storage unit of one SDRAM, and each storage unit stores one pixel;
the image processing module 3 includes: the system comprises a pixel counting module 31, a threshold value calculating module 32, an image segmentation module 33, a video image window generating module 34, a template matching module 35 and a matching result verifying module 36;
the pixel counting module 31 is configured to receive the decoded video image from the FPGA video acquisition module 1, count the number of pixels corresponding to each gray value in the current frame image to form an abstract gray histogram, and output the pixel counting result of each frame image to the threshold calculation module 32 during the frame blanking period;
a threshold value calculating module 32, configured to receive the pixel statistical result transmitted from the pixel statistical module 31, calculate a binarization threshold value with a best segmentation effect according to the abstract grayscale histogram, and transmit the binarization threshold value to the image segmentation module 33;
the image segmentation module 33 is configured to perform threshold segmentation on the decoded video image, sequentially read in the decoded video image according to pixels, perform binarization segmentation by using a binarization threshold, and sequentially transmit the binarized video image to the video image window generation module 34 according to pixels;
a video image window generating module 34, configured to sequentially generate mxn video image windows from a binarized video image according to a step size of 1, transmit the video image windows to the template matching module 35, mark a position of a first row and a first column in the video image windows in a whole frame image as a video image window position coordinate P (i, j), and transmit P (i, j) to the matching result verification module 36, where m is a row number of a train water filling port template image, n is a column number of the train water filling port template image, i is a video image window row coordinate, and j is a video image window column coordinate;
the template matching module 35 is configured to compare the generated video image window with a train water filling port template image, calculate the total number of pixels of the video image window and the train water filling port template image that are the same at the same position, record the total number as a window matching result, and transmit the window matching result to the matching result verification module 36;
the matching result verification module 36 is configured to verify the matching degree of the window matching result and the window matching position to obtain a matching effective signal, and send the matching effective signal to the mechanical device control module 4;
the mechanical device control module 4 includes: starting a control module 41, starting a water injection control module 42, stopping the water injection control module 43 and returning to a control module 44;
the starting control module 41 is configured to receive a movement starting signal transmitted by the starting switch, send a movement command to the mechanical device through the serial port, and count movement time at the same time, and after receiving a matching valid signal transmitted by the matching result verification module 36, send a stop command to the mechanical device through the serial port, and end the counting of the movement time at the same time;
a water injection starting control module 42, configured to receive the matched valid signal and control the mechanical device to start water injection;
the water injection stopping control module 43 is used for timing the water injection time, controlling the mechanical device to stop water injection when the timing time reaches 6 minutes and sending a water injection ending signal to the original return control module 44;
the original return control module 44 is used for receiving a water injection ending signal, reading a timing value of the movement time of the starting control module 41 and controlling the timing value of the reverse movement time of the mechanical device to a starting position;
the ambient light adjusting module 5 includes: a light intensity sensing module 51 and an illumination control module 52;
the light intensity sensing module 51 is used for detecting the light intensity in the surrounding environment in real time, and sending an illumination starting signal to the illumination control module 52 when the detected ambient light intensity is lower than a set light intensity threshold value;
the illumination control module 52 is used for receiving the illumination starting signal sent by the light intensity sensing module 51 and then controlling the external illumination lamp to be turned on or turned off;
the FPGA cache control sub-module 21 includes a pixel stream receiving unit 21a, a read-write control unit 21b, and a pixel stream sending unit 21 c;
the pixel stream receiving unit 21a is configured to read a decoded video image from the video acquisition module 1, count video frames according to a frame synchronization signal, and transmit a frame count value to the read-write control unit 21 b;
the read-write control unit 21b is configured to receive a frame count value and control reading and writing of the SDRAM: if the frame count value is 2a, writing to SDRAM1 while reading the image of the 2a-1 th frame from SDRAM2, and if the frame count value is 2a +1, writing to SDRAM2 while reading the image of the 2a th frame from SDRAM1, a being 0, 1, 2, …, in such a manner that repeated reading and writing is performed;
the pixel stream sending unit 21c is configured to send the decoded video image read from the SDRAM to the image processing module 3, count pixels in the decoded video image to generate pixel position coordinate information, a cache line synchronization signal, and a cache frame synchronization signal, and transmit the pixel position coordinate information, the cache line synchronization signal, and the cache frame synchronization signal to the image processing module 3;
the pixel counting module 31 comprises a dual-port RAM31a, a buffer register 31b and an adder 31 c;
the dual-port RAM31a is configured to store a pixel statistical result with a bit depth of 256 and a bit width of 16, and use a gray value of a decoded video image transmitted from the FPGA video acquisition module 1 as an address of a storage space, read data stored in a corresponding address through an a port of the dual-port RAM, use data cached by the cache register 31B as an address, write a result calculated by adding the adder 31c into the corresponding address storage space through a B port of the dual-port RAM, and read all stored data to the threshold calculation module 32 from a small value to a small value through the B port of the dual-port RAM after the full-frame statistics is completed;
the buffer register 31B is used for buffering one clock for each pixel of the decoded video image, reading data in the decoded video image to an adder 31c by taking the gray value of the pixel before buffering as the address of the port A of the dual-port RAM31a in the same clock cycle, and writing the data output by the adder by taking the gray value of the pixel after buffering as the address of the port B of the dual-port RAM31 a;
an adder 31c for adding one to the data read out from the a port of the dual port RAM31a, and storing the calculation result in the same memory cell through the B port of the dual port RAM at the same address;
the threshold segmentation module 32 comprises a highest peak calculation module 32a, a secondary high peak calculation module 32b and a minimum value calculation module 32 c;
the highest peak calculating module 32a is used for calculating the maximum value M1 in the abstract gray level histogram, and transmitting the calculated M1 and the gray level G1 corresponding to the M1 to the secondary high peak calculating module 32b and the minimum value calculating module 32 c;
the secondary peak calculating module 32b is used for calculating a secondary peak value M2 of the right part of G1 in the histogram and transmitting M2 and the corresponding gray value G2 to the minimum value calculating module 32 c;
the minimum value calculating module 32c is used for calculating the histogram between G1 and G2 to obtain a peak-valley minimum value M3 and a corresponding gray value G3, and defining G3 as a binarization threshold;
the video image window generating module 34 comprises a FIFO buffer module 34a, a window register group 34b, and a window position calibration module 34 c;
the FIFO cache module 34a is used for receiving the binarized video image transmitted by the image segmentation module 33, sequentially storing m lines in m FIFOs, and reading each FIFO to the window register group 34b after all the FIFOs are fully stored, wherein m is the line number of the train water filling port template image;
the window register group 34b is used for registering data read out from the FIFOs, shifting the data read out from the m FIFOs to the left as shift values to the corresponding m n-bit shift registers, and reading out the data in the m n-bit shift registers to the template matching module 35, wherein n is the number of columns of the template images at the water injection port of the train;
the window position calibration module 34c is configured to receive pixel position coordinate information in the image cache module 2, assign pixel position coordinate information corresponding to pixels in a first row and a first column of a video image window to a video image window position coordinate P (i, j), and transmit P (i, j) to the template matching module 35, where i is a video image window row coordinate and j is a video image window column coordinate;
the template matching module 35 comprises a template storage register group 35a, an exclusive nor gate array 35b, a matching line adder group 35c and a video image window adder group 35 d;
the template storage register group 35a is used for storing a train water filling port template image into m n-bit template registers and transmitting data stored in the train water filling port template image to an exclusive-nor gate array 35b, wherein m is the number of lines of the train water filling port template image, and n is the number of columns of the train water filling port template image;
the exclusive nor gate array 35b is used for carrying out exclusive nor on the read m n-bit shift registers and m n-bit template registers according to bits and simultaneously transmitting exclusive nor results to the matching row adder group 35 c;
a matching line adder group 35c for adding the result of the same or each line, counting the number of the same pixels in each corresponding n-bit register to form a line matching result, and transmitting the line matching result to a video image window adder group 35 d;
the video image window adder group 35d is used for summing the matching results of the m corresponding n-bit register lines again, counting the number of pixels of the video image window, which are the same as the number of pixels of the train water filling port template image, namely the window matching result, and transmitting the window matching result to the matching result verification module 36;
the matching result verification module 36 includes a pixel number matching module 36a, a position matching module 36 b;
the pixel number matching module 36a is configured to verify the window matching result transmitted by the template matching module 35, and compare the window matching result with the set matching threshold: if the window matching result is larger than the matching threshold, the pixel number is matched, then position matching is carried out, if the window matching result is smaller than the matching threshold, the arrival of the next clock window matching result is waited, and pixel number matching is continued;
the position matching module 36b is configured to perform position verification on the video image window with the successfully matched pixel number, read the video image window position coordinate P (i, j) from the window position calibration module 34c, and compare the position matching result P (i, j) with the set window position range: if P (i, j) is within the set window position range, the position matching is successful and a matching valid signal is transmitted to the mechanical device control module 4, and if P (i, j) is not within the set window position range, the next verification is waited.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention.

Claims (7)

1. A method for detecting and positioning a water filling port of a train is characterized by comprising the following steps: acquiring continuous train water filling port video images, and simultaneously performing threshold segmentation on the train water filling port video images to obtain binary train water filling port video images;
the method comprises the following steps of carrying out threshold segmentation on a train water filling port video image to obtain a binary train water filling port video image, wherein the method specifically comprises the following steps: performing binarization segmentation on a video image of a water injection port of the train according to a binarization threshold value, and sequentially generating mxn video image windows according to pixels and the size of a step length of 1;
marking the position of a pixel of a first row and a first column in the video image window in the position of the video image window in the whole frame image as a video image window position coordinate P (i, j);
the specific process for obtaining the binarization threshold value is as follows: counting the number of pixels corresponding to each gray value in a current frame image in the train water filling port video image to form an abstract gray histogram, and calculating a binarization threshold with the best segmentation effect according to the abstract gray histogram;
and processing the binarized train water filling port video image and matching the binarized train water filling port video image with a train water filling port template image, detecting the position of a water filling port in the train water filling port video image, comparing the position with a preset position range where the water filling port is located, and if the position is matched, transmitting a matching effective signal to a mechanical device control module to control a mechanical device to move and stop, and starting water filling and stopping water filling.
2. The train water filling port detection and positioning method according to claim 1, characterized by determining a maximum value M1 and a corresponding gray value G1 in the abstract gray histogram, determining a sub-high peak value M2 and a corresponding gray value G2 in the right part of a gray value G1 in the abstract gray histogram, calculating the histogram between G1 and G2 to obtain a peak-valley minimum value M3 and a corresponding gray value G3, and defining G3 as a binarization threshold.
3. The train water filling port detection and positioning method according to claim 2, wherein the comparison with the preset position range where the water filling port is located is performed, and if the comparison is performed, a matching valid signal is transmitted to the mechanical device control module to control the mechanical device to move or stop, and water filling is started or stopped, specifically: and comparing the generated video image window with the train water filling port template image, calculating the total number of pixels of the video image window and the train water filling port template image which are the same at the same position, recording the total number as a window matching result, verifying the matching degree of the window matching result, verifying the window matching position in combination with the video image window position P (i, j) to obtain a matching effective signal, and sending the matching effective signal to a mechanical device control module.
4. The method for detecting and positioning the water filling port of the train according to claim 3, wherein the generated video image window is compared with a template image of the water filling port of the train, the total number of pixels of the window and the template image of the water filling port of the train at the same position is calculated, and the result is recorded as a window matching result, specifically: sequentially storing m lines in the binarized video image into m FIFOs, leftwards moving data read from the m FIFOs as shift bits to corresponding m n-bit shift registers, performing bitwise coincidence or on the read m n-bit shift registers and m n-bit template registers, adding coincidence or results of each line, counting the number of the same pixels in each corresponding n-bit register to form n line matching results, performing summation again on the m corresponding n-bit register line matching results, and counting the number of the same pixels of a video image window and a train water filling port template image, namely window matching results.
5. The method for detecting and positioning the water filling port of the train according to claim 4, further comprising the following steps: verifying the window matching result, and comparing the window matching result with the set matching threshold value: and if the window matching result is greater than the matching threshold, matching the pixel number, then performing position matching, and if the window matching result is less than the matching threshold, waiting for the next clock window matching result to arrive, and continuing to perform pixel number matching.
6. The method for detecting and positioning the water filling port of the train according to claim 5, further comprising the following steps: and carrying out position verification on the video image window with successfully matched pixel number, and comparing a position matching result P (i, j) with a set window position range: if P (i, j) is within the set window position range, the position matching is successful and a matching valid signal is transmitted to the mechanical device control module, and if P (i, j) is not within the set window position range, the next verification is waited.
7. The method for detecting and positioning the water filling port of the train according to any one of claims 1 to 6, further comprising the following steps: the light intensity in the surrounding environment is detected in real time, and when the detected ambient illuminance is lower than a set illuminance threshold value, the external illuminating lamp is controlled to be turned on or turned off.
CN201811522435.7A 2018-12-13 2018-12-13 Train water filling port detection and positioning method Active CN109709843B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811522435.7A CN109709843B (en) 2018-12-13 2018-12-13 Train water filling port detection and positioning method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811522435.7A CN109709843B (en) 2018-12-13 2018-12-13 Train water filling port detection and positioning method

Publications (2)

Publication Number Publication Date
CN109709843A CN109709843A (en) 2019-05-03
CN109709843B true CN109709843B (en) 2021-01-05

Family

ID=66255750

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811522435.7A Active CN109709843B (en) 2018-12-13 2018-12-13 Train water filling port detection and positioning method

Country Status (1)

Country Link
CN (1) CN109709843B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020118621A1 (en) * 2018-12-13 2020-06-18 西安电子科技大学 Detection and positioning method for train water injection port
CN112185004A (en) * 2020-09-27 2021-01-05 安徽上尚电子科技股份有限公司 Tap water adding machine control system based on Internet of things

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100575873C (en) * 2007-12-29 2009-12-30 武汉理工大学 Dual container localization method based on machine vision
JP5429446B2 (en) * 2008-09-16 2014-02-26 株式会社セガ GAME DEVICE AND PATTERN MATCHING METHOD THEREOF
CN102682455B (en) * 2012-05-10 2014-11-12 天津工业大学 Front vehicle detection method based on monocular vision
CN104331910B (en) * 2014-11-24 2017-06-16 沈阳建筑大学 A kind of track obstacle detecting system based on machine vision
CN108229250B (en) * 2016-12-14 2020-07-10 杭州海康威视数字技术股份有限公司 Traffic signal lamp repositioning method and device
CN106934808B (en) * 2017-02-15 2020-05-15 江苏文光车辆附件有限公司 Method for identifying and tracking tail lamp of automobile headlight under visual perception
CN106919933A (en) * 2017-03-13 2017-07-04 重庆贝奥新视野医疗设备有限公司 The method and device of Pupil diameter
CN107231521B (en) * 2017-04-29 2019-07-19 安徽慧视金瞳科技有限公司 A kind of meter reading identification camera automatic positioning method

Also Published As

Publication number Publication date
CN109709843A (en) 2019-05-03

Similar Documents

Publication Publication Date Title
US9811921B2 (en) Apparatus and method for processing a depth image
CN109709843B (en) Train water filling port detection and positioning method
CN104427310B (en) Image storage method and its device
CN114049557A (en) Garbage sorting robot visual identification method based on deep learning
CN107277348B (en) Focusing method, device, computer readable storage medium and mobile terminal
CN105574161A (en) Trademark graph element identification method, device and system
CN109767424B (en) Binocular vision train water injection port detection and positioning method based on FPGA
US20060245652A1 (en) Method for recognizing objects in an image without recording the image in its entirety
US7433522B2 (en) JBIG coding apparatus and method with low cost, high-performance ping-pong buffer arrangement
CN106846398B (en) Image line data scanning-based starry sky target maximum light intensity position identification method
CN112714244A (en) Image acquisition method and system based on linear array camera
CN104657960A (en) Gray level image contrast drawing method and device
US11066088B2 (en) Detection and positioning method for train water injection port
JP3349037B2 (en) Method and apparatus for capturing moving object image
CN108428241B (en) Method for capturing motion trail of moving target in high-definition video
CN116403200A (en) License plate real-time identification system based on hardware acceleration
CN110019060B (en) Method and device for automatically synchronizing locomotive video file and operation record file
CN111179355A (en) Binocular camera calibration method combining point cloud and semantic recognition
CN209250756U (en) A kind of image capturing system and automated optical detection equipment
CN107509036A (en) A kind of video camera large nuber of images compression method based on FPGA
CN110689515B (en) Computer image processing system adopting intelligent recognition technology
US9841488B2 (en) IR detector system and method
CN115713756A (en) Method for improving accurate positioning of license plate
JP3552419B2 (en) Object recognition method
CN116977995A (en) Vehicle-mounted front license plate recognition method and system

Legal Events

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