Disclosure of Invention
The application provides a microfluidic chip channel identification method, a device, equipment and a readable storage medium, which can realize efficient and high-precision division of channels in a microfluidic chip image.
In a first aspect, an embodiment of the present application provides a method for identifying a channel of a microfluidic chip, where the method includes:
acquiring an image of a microfluidic chip acquired by an imaging sensor;
preprocessing an image of a microfluidic chip to obtain a first image, wherein the preprocessing comprises image enhancement, image binarization and small target removal;
sliding on the first image by using a sliding window with a preset size, and storing the central coordinate of the sliding window meeting a preset condition as a first target point to a target coordinate list, wherein the preset condition is a coordinate point of a target pixel value in the sliding window;
judging whether all first target points in the target coordinate list are in a micro-fluidic chip channel or not;
performing water-flooding filling treatment by taking a first target point in a chip channel as a seed point to obtain an image mask of a channel image in the microfluidic chip image, wherein the gray value of the seed point subjected to water-flooding filling treatment is a target pixel value;
and cutting out the image of the microfluidic chip by using the image mask to obtain a target image only containing channels of the microfluidic chip.
Further, the step of preprocessing the image of the microfluidic chip to obtain a first image includes:
performing image enhancement on the image of the microfluidic chip by using an MSRCP algorithm developed based on a retinex algorithm to obtain a second image;
performing binarization processing on the second image based on a self-adaptive equalization algorithm to obtain a third image, wherein the gray value of the outline part of the microfluidic chip channel in the microfluidic chip image is set as a target pixel value during the binarization processing;
and carrying out background impurity removal processing on the third image based on a small target removal algorithm to obtain a first image, wherein the number of the connected areas with the whole pixel values not larger than a preset threshold value is removed during the background impurity removal processing.
Further, the step of determining whether all the first target points in the target coordinate list are in the microfluidic chip channel includes:
checking all first target points in a target coordinate list, wherein the checking comprises taking the first target point as a center, transmitting line segments with lengths not more than the minimum value of the length and the width of a sliding window in four directions, namely, up, down, left and right, and determining the intersection point of the line segments and the contour part of a microfluidic chip channel in a first image;
and if the line segments in the up-down direction or the left-right direction have intersection points at the same time and the absolute value of the difference between the intersection points of the two sides of the line segments in the up-down direction or the left-right direction is smaller than a preset difference value, determining that the first target point is in the microfluidic chip channel.
Further, the preset size is set to 16 times the size of the first image size.
In a second aspect, the present application also provides a microfluidic chip channel identification device, the device comprising:
the acquisition module is used for acquiring the image of the microfluidic chip acquired by the imaging sensor;
the image preprocessing module is used for preprocessing the image of the microfluidic chip to obtain a first image, wherein the preprocessing comprises image enhancement, image binarization and small target removal;
the sliding window processing module is used for sliding on the first image by using a sliding window with a preset size, and storing the central coordinate of the sliding window meeting the preset condition as a first target point to a target coordinate list, wherein the preset condition is a coordinate point of a target pixel value in the sliding window;
the judging module is used for judging whether all the first target points in the target coordinate list are in the microfluidic chip channel or not;
the device comprises a water-flooding filling processing module, a first target point processing module and a second target point processing module, wherein the water-flooding filling processing module is used for performing water-flooding filling processing by taking the first target point in a chip channel as a seed point to obtain an image mask of a channel image in a microfluidic chip image, and the gray value of the seed point subjected to water-flooding filling processing is a target pixel value;
and the clipping module is used for clipping the image of the microfluidic chip by using the image mask to obtain a target image only containing channels of the microfluidic chip.
Further, the image preprocessing module is specifically configured to:
performing image enhancement on the image of the microfluidic chip based on an MSRCP algorithm developed by a retine microfluidic chip channel recognition algorithm to obtain a second image;
performing binarization processing on the second image based on a self-adaptive equalization algorithm to obtain a third image, wherein the gray value of the outline part of the microfluidic chip channel in the microfluidic chip image is set as a target pixel value during the binarization processing;
and carrying out background impurity removal processing on the third image based on a small target removal algorithm to obtain a first image, wherein the number of the connected areas with the whole pixel values not larger than a preset threshold value is removed during the background impurity removal processing.
Further, the judging module is specifically configured to:
checking all first target points in a target coordinate list, wherein the checking comprises taking the first target point as a center, transmitting line segments with lengths not more than the minimum value of the length and the width of a sliding window in four directions, namely, up, down, left and right, and determining the intersection point of the line segments and the contour part of a microfluidic chip channel in a first image;
and if the line segments in the up-down direction or the left-right direction have intersection points at the same time and the absolute value of the difference between the intersection points of the two sides of the line segments in the up-down direction or the left-right direction is smaller than a preset difference value, determining that the first target point is in the microfluidic chip channel.
Further, the preset size is set to 16 times the size of the first image size.
In a third aspect, an embodiment of the present application further provides a microfluidic chip channel identification device, where the microfluidic chip channel identification device includes a processor, a memory, and a microfluidic chip channel identification program stored on the memory and executable by the processor, where the microfluidic chip channel identification program, when executed by the processor, implements the steps of the microfluidic chip channel identification method described above.
In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, where a microfluidic chip channel identification program is stored on the computer readable storage medium, where the steps of the microfluidic chip channel identification method described above are implemented when the microfluidic chip channel identification program is executed by a processor.
In summary, compared with the prior art, the technical scheme provided by the embodiment of the application has the following beneficial effects:
according to the method, the device and the equipment for identifying the channels of the microfluidic chip and the readable storage medium, the collected images of the microfluidic chip are subjected to pretreatment, sliding window treatment, water diffusion treatment and cutting treatment to obtain the target images only containing the channels of the microfluidic chip, and the efficient and high-precision division of the channels in the images of the microfluidic chip can be realized. The obtained target image is also corresponding to a chip channel part which only comprises the visible chip in the micro-fluidic chip image, so that the manual visual inspection can be assisted in time, the step of determining the channel position in the conventional manual visual inspection is replaced, and the problems of whether foreign matters, quality flaws and the like exist in the channel can be detected on the determined target image again in the subsequent manual visual inspection, so that the visual fatigue of the detection personnel in the manual visual inspection can be relieved well.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Referring to fig. 1, an embodiment of the present application provides a method for identifying a channel of a microfluidic chip, where the method specifically includes:
step S10, acquiring a micro-fluidic chip image acquired by an imaging sensor;
step S20, preprocessing the image of the microfluidic chip to obtain a first image, wherein the preprocessing comprises image enhancement, image binarization and small target removal;
step S30, sliding on the first image by using a sliding window with a preset size, and storing the central coordinate of the sliding window meeting a preset condition as a first target point to a target coordinate list, wherein the preset condition is a coordinate point with a target pixel value in the sliding window;
step S40, judging whether all first target points in the target coordinate list are in a micro-fluidic chip channel or not;
step S50, performing water-flooding filling treatment by taking a first target point in a chip channel as a seed point to obtain an image mask of a channel image in the microfluidic chip image, wherein the gray value of the seed point subjected to water-flooding filling treatment is a target pixel value;
and step S60, cutting out the image of the microfluidic chip by using the image mask to obtain a target image only containing channels of the microfluidic chip.
In this embodiment, the image of the microfluidic chip is obtained by directly photographing the chip with an imaging sensor such as a digital microscope under the irradiation of natural light. Under the condition that the channel identification of the micro-fluidic chip channel image is difficult due to the two technical difficulties of incomplete photographing channels and transparent chip whole in the existing scheme, when the chip channel part in the micro-fluidic chip image is searched for by the conventional template matching strategy, only part of the chip channels can be obtained due to the fact that the whole chip channel part cannot be observed, and the channel in the micro-fluidic chip image cannot be divided due to the fact that the outline of the chip channels is obtained instead of the channels due to the transparent characteristic. Therefore, in order to realize efficient and high-precision division of channels in the image of the microfluidic chip, after the image of the microfluidic chip acquired by the imaging sensor is acquired, preprocessing, sliding window processing, water diffusion processing and cutting processing are performed on the acquired image of the microfluidic chip, so as to obtain a target image only comprising the channels of the microfluidic chip. Wherein, the micro-fluidic chip image only contains partial chip channel image, and the obtained target image also corresponds to the chip channel part which only contains the micro-fluidic chip image and is visible. Although the target image only comprises a chip channel part visible in the micro-fluidic chip image, the target image only comprises the micro-fluidic chip channel, so that the method can assist in manual visual inspection in time, replace the existing step of determining the channel position during manual visual inspection, and further detect whether the channel has foreign matters, quality flaws and the like on the determined target image by the subsequent manual visual inspection so as to better relieve the visual fatigue of the detection personnel in the manual visual inspection.
Specifically, since the whole chip is transparent, the outline part of the microfluidic chip channel is not obviously distinguished from other parts in the chip, after the microfluidic chip image acquired by the imaging sensor is acquired, preprocessing including image enhancement, image binarization and small target removal is performed on the microfluidic chip image, so that a first image is obtained. The brightness of channel outlines (corresponding to shadow parts) in the image of the microfluidic chip can be improved through image enhancement, so that the comparison between the chip outlines and other chip parts is more obvious, and a foundation is laid for a subsequently executed image processing algorithm. The gray value of the outline part of the chip channel can be distinguished from the gray values of other parts by binarization processing because the channels in the microfluidic chip are mainly required to be divided. In addition, since small targets similar to the outline parts of the chip channels can appear except other parts, the small targets can become channel division in the chip image after noise interference, and therefore small targets are removed from the microfluidic chip image when the microfluidic chip image is subjected to binarization processing, and the reserved channel outline is ensured to be clear and accurate.
On the basis of determining that the reserved channel profile is clearer and more accurate, in order to divide the more accurate actual channel inner area based on the channel profile, the embodiment of the application can perform sliding window processing and water diffusion processing on the first image obtained after preprocessing, thereby obtaining the image mask of the channel inner area. When the sliding window is used for sliding on the first image, a sliding window with a preset size is used for sliding on the first image, and when a coordinate point of a target pixel value (corresponding to a gray value of a binarized chip channel contour part) appears in the sliding window, the sliding window is confirmed to be contacted with the chip channel contour point. Referring to fig. 2, the center coordinates of the sliding window may be saved as the first target point to the target coordinate list at this time. After the sliding of the whole first image is finished, whether the first target point in the target coordinate list is needed to be used as a seed point for water diffusion treatment can be determined by judging whether the first target point is positioned in the micro-fluidic chip channel.
And the first target point in the chip channel can be used as a seed point for water diffusion filling treatment, the coordinate point is set in the middle of the channel by taking the outline of the chip channel as a boundary, and the image mask of the chip channel in the microfluidic chip image is obtained through water diffusion. When the first target point in the chip channel is used as a seed point to carry out water diffusion filling treatment, and an image mask of a channel image in the microfluidic chip image is obtained, whether the seed point is subjected to water diffusion treatment or not is detected in real time, after the water diffusion treatment, the channel contour included in the channel contour on the first image is kept to be the same pixel value, namely, a target pixel value of a channel contour part which is set during binarization, and when the target pixel value is set to 255, the gray value of the seed point subjected to water diffusion filling treatment is also 255. And then cutting the original directly obtained image of the microfluidic chip by using the image mask, so as to obtain a target image only comprising channels of the microfluidic chip.
Further, in an embodiment, the step S20 includes:
performing image enhancement on the image of the microfluidic chip based on an MSRCP algorithm developed by a retine microfluidic chip channel recognition algorithm to obtain a second image;
performing binarization processing on the second image based on a self-adaptive equalization algorithm to obtain a third image, wherein the gray value of the outline part of the microfluidic chip channel in the microfluidic chip image is set as a target pixel value during the binarization processing;
and carrying out background impurity removal processing on the third image based on a small target removal algorithm to obtain a first image, wherein the number of the connected areas with the whole pixel values not larger than a preset threshold value is removed during the background impurity removal processing.
In this embodiment, when preprocessing including image enhancement, image binarization and small object removal is performed on the microfluidic chip image, compared with common image enhancement algorithms, such as histogram equalization, gray world algorithm, retinex algorithm, automatic white balance, automatic color balance, and other image enhancement algorithms, the brightness enhancement of the chip channel outline (shadow portion) in the microfluidic chip image is most obvious based on the MSRCP algorithm developed by Retinex algorithm, so that the image enhancement is performed on the microfluidic chip image by using the MSRCP algorithm developed based on retine microfluidic chip channel recognition algorithm to obtain a second image. After the image is enhanced, the self-adaptive equalization algorithm in OpenCV can be directly used for carrying out binarization processing on the image of the micro-fluidic chip after the image is enhanced, the gray value of the outline part of the chip channel of the image of the micro-fluidic chip after the binarization can be 255, and the rest part can be 0, so that the target pixel value can be 255. After binarization, all white parts except the channel part are regarded as background impurities, and gray values corresponding to the white parts (including the channel outline part and the background impurity part) are 255. For the background impurity part appearing after binarization, the small target removing algorithm in OpenCV is directly used in the scheme of the embodiment, the function is used for reserving the area with the number of the whole pixel values of the connected area being larger than a preset threshold value, and the preset threshold value (the minimum pixel value corresponding to the connected area) is preferably set to 4000 through test determination. The function is used for reserving the area with the integral pixel value number of the connected area being larger than 4000, surrounding isolated pixels are removed, and therefore the purpose that the channel outline is clearer and more accurate is achieved.
Further, in an embodiment, the step S40 includes:
checking all first target points in a target coordinate list, wherein the checking comprises taking the first target point as a center, transmitting line segments with lengths not more than the minimum value of the length and the width of a sliding window in four directions, namely, up, down, left and right, and determining the intersection point of the line segments and the contour part of a microfluidic chip channel in a first image;
and if the line segments in the up-down direction or the left-right direction have intersection points at the same time and the absolute value of the difference between the intersection points of the two sides of the line segments in the up-down direction or the left-right direction is smaller than a preset difference value, determining that the first target point is in the microfluidic chip channel.
In this embodiment, when determining whether all the first target points in the target coordinate list are in the microfluidic chip channel, all the first target points in the target coordinate list are checked, a line segment with a length not greater than the minimum value of the window length and width is emitted in four directions up, down, left and right with the first target point as a center, and an intersection point of the line segment and the outline portion of the microfluidic chip channel in the first image is determined, so as to determine whether the first target point is in the channel. Only when the line segments in the up-down direction or the left-right direction have intersection points at the same time and the absolute value of the difference between the intersection points of the up-down or left-right sides is smaller than a preset difference value, the first target point can be determined to be in the micro-fluidic chip channel outline, and other first target points are all outside the micro-fluidic chip channel outline. Wherein the preset difference is preferably set to 3. Through the inspection of the scheme, seed points which are not in the outline of the microfluidic chip channel can be eliminated, the image mask obtained by carrying out water diffusion treatment on the basis of the screened first target point can be more accurately distinguished from other parts which characterize the microfluidic chip channel part and the channel, the screening mode does not need to additionally carry out other image treatment, the consumed computing resource is less, and the screening speed is higher.
Further, in an embodiment, the preset size is set to 16 times the size of the first image size.
In this embodiment, when the sliding window is used to perform the sliding processing on the first image, the preset size of the sliding window is set to be 16 times the size of the first image, mainly considering that the size of the processed first image may be different, and in the experiment, the size of the first image is mainly 2048x3096, but may also be 1024x 72048. In view of adapting to image processing of different sizes, it is set to 16 times the picture size. In addition, the sliding step of the sliding window is preferably set to 50px, that is, 50 pixel values, and the window slides from left to right and from top to bottom, and when the moving distance is less than 50, the window moves directly to the end position, thereby completing the sliding process of the entire first image.
The embodiment of the application also provides a microfluidic chip channel identification device.
Referring to fig. 3, a functional block diagram of a first embodiment of a microfluidic chip channel recognition device is shown.
In this embodiment, the microfluidic chip channel recognition device includes:
an acquisition module 10, configured to acquire an image of the microfluidic chip acquired by the imaging sensor;
an image preprocessing module 20, configured to preprocess an image of a microfluidic chip to obtain a first image, where the preprocessing includes image enhancement, image binarization, and small target removal;
the sliding window processing module 30 is configured to slide on the first image using a sliding window with a preset size, and store, as a first target point, a center coordinate of the sliding window that meets a preset condition, where the preset condition is a coordinate point where a target pixel value appears in the sliding window, to a target coordinate list;
a judging module 40, configured to judge whether all the first target points in the target coordinate list are in the microfluidic chip channel;
the device comprises a water-flooding filling processing module, a first target point processing module and a second target point processing module, wherein the water-flooding filling processing module is used for performing water-flooding filling processing by taking the first target point in a chip channel as a seed point to obtain an image mask of a channel image in a microfluidic chip image, and the gray value of the seed point subjected to water-flooding filling processing is a target pixel value;
and the clipping module 50 is used for clipping the image of the microfluidic chip by using the image mask to obtain a target image only containing channels of the microfluidic chip.
Further, in an embodiment, the image preprocessing module 20 is specifically configured to:
performing image enhancement on the image of the microfluidic chip based on an MSRCP algorithm developed by a retine microfluidic chip channel recognition algorithm to obtain a second image;
performing binarization processing on the second image based on a self-adaptive equalization algorithm to obtain a third image, wherein the gray value of the outline part of the microfluidic chip channel in the microfluidic chip image is set as a target pixel value during the binarization processing;
and carrying out background impurity removal processing on the third image based on a small target removal algorithm to obtain a first image, wherein the number of the connected areas with the whole pixel values not larger than a preset threshold value is removed during the background impurity removal processing.
Further, in an embodiment, the determining module 40 is specifically configured to:
checking all first target points in a target coordinate list, wherein the checking comprises taking the first target point as a center, transmitting line segments with lengths not more than the minimum value of the length and the width of a sliding window in four directions, namely, up, down, left and right, and determining the intersection point of the line segments and the contour part of a microfluidic chip channel in a first image;
and if the line segments in the up-down direction or the left-right direction have intersection points at the same time and the absolute value of the difference between the intersection points of the two sides of the line segments in the up-down direction or the left-right direction is smaller than a preset difference value, determining that the first target point is in the microfluidic chip channel.
Further, in an embodiment, the preset size is set to 16 times the size of the first image size.
The function implementation of each module in the microfluidic chip channel recognition device corresponds to each step in the embodiment of the microfluidic chip channel recognition method, and the function and implementation process of each module are not described in detail herein.
The embodiment of the application provides a microfluidic chip channel identification device which can be devices with data processing functions such as a personal computer (personal computer, PC), a notebook computer, a server and the like.
Referring to fig. 4, fig. 4 is a schematic hardware structure diagram of a microfluidic chip channel recognition device according to an embodiment of the present application. In an embodiment of the present application, the microfluidic chip channel recognition device may include a processor 1001 (e.g., a central processing unit Central Processing Unit, a CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein the communication bus 1002 is used to enable connected communications between these components; the user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., WIreless-FIdelity, WI-FI interface); the memory 1005 may be a high-speed random access memory (random access memory, RAM) or a stable memory (non-volatile memory), such as a disk memory, and the memory 1005 may alternatively be a storage device independent of the processor 1001. Those skilled in the art will appreciate that the hardware configuration shown in the figure microfluidic chip channel identification is not limiting of the application and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
With continued reference to fig. 4, an operating system, a network communication module, a user interface module, and a microfluidic chip channel recognition program may be included in the memory 1005 of fig. 4, which is a type of computer-readable storage medium. The processor 1001 may call a microfluidic chip channel identification program stored in the memory 1005, and execute the steps of the microfluidic chip channel identification method provided by the embodiment of the present application.
The method implemented when the microfluidic chip channel identification program is executed may refer to various embodiments of the microfluidic chip channel identification method of the present application, which will not be described herein.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.