Disclosure of Invention
The invention provides a target detection method and a target detection system for a digital image based on medical examination, which mainly aim to solve the problem of how to accurately and effectively detect a target in the digital image of the medical examination.
In order to achieve the above object, the present invention provides a digital image target detection method based on medical examination, including:
acquiring a digital image of medical examination, performing image decomposition on the digital image by using a preset decomposition algorithm to obtain a decomposition image, and generating a wavelet pyramid according to the decomposition image, wherein the decomposition algorithm is expressed as follows:
;
wherein,,indicate->The corresponding +.>Line->Column pixels>Indicate->Digital image corresponding +.>Line->Column pixels>Representing preset high-pass filter coefficients, < >>Representing a preset low-pass filter coefficient;
selecting a basic image from the wavelet pyramid, extracting features of the basic image to obtain image features, and calculating the optical flow of the basic image;
estimating a background motion vector of the basic image based on the optical flow, matching the image characteristics with the background motion vector, and carrying out registration image transformation on the basic image according to a matching result to obtain a differential image;
and extracting the maximum connected region from the differential image as a potential target, and performing pipeline filtering processing on the differential image based on the target to obtain a target image.
Optionally, the generating a wavelet pyramid according to the decomposed image includes:
acquiring the frequency of the decomposed image, and judging whether the frequency is larger than a preset target threshold value or not;
when the frequency is not greater than the target threshold, judging that the frequency is low frequency, carrying out weight assignment on the decomposed image to obtain decomposed weight, and carrying out fusion processing on the decomposed image based on the decomposed weight to obtain a first fusion image;
when the frequency is larger than the target threshold, judging that the frequency is high frequency, and performing fusion processing on the decomposed image to obtain a second fusion image;
and integrating according to the first fused image and the second fused image to obtain a wavelet pyramid.
Optionally, the calculating the optical flow of the base image includes:
acquiring a center coordinate and a basic gray value of the basic image, and respectively calculating a transverse optical flow and a longitudinal optical flow of the basic image according to the center coordinate and the basic gray value;
generating an optical flow of the base image from the lateral optical flow and the longitudinal optical flow;
generating an optical flow of the base image using the following formula:
;
wherein,,representing the optical flow->Representing the lateral optical flow->Representing the longitudinal optical flow.
Optionally, the calculating the lateral optical flow and the longitudinal optical flow of the base image according to the center coordinates and the base gray values includes:
the lateral optical flow and the longitudinal optical flow are calculated by using the following formula:
;
;
wherein,,representing the lateral optical flow->Representing the longitudinal optical flow->An abscissa representing said central coordinate +.>Corresponding basic gray value, ">An ordinate representing said center coordinate +.>Corresponding base gray values.
Optionally, the estimating the background motion vector of the base image based on the optical flow includes:
randomly selecting a frame image from the basic image based on the optical flow, and calculating gradient values of pixels of the frame image;
calculating an optical flow field value of the frame image according to the gradient value and the optical flow, and judging whether the optical flow field value is consistent with a preset real field value or not;
the optical flow field value of the frame image is calculated using the following formula:
;
wherein,,representing the optical flow field value,/->Representing the gradient value,/->Representing the optical flow;
returning to the step of randomly selecting a frame image from the base image based on the optical flow when the optical flow field value is inconsistent with the real field value;
and when the optical flow field value is consistent with the real field value, carrying out vector conversion on the frame image to obtain a background motion vector.
Optionally, the performing registration map transformation on the base image according to the matching result to obtain a differential image includes:
acquiring a basic gradient value and an image gray value of the basic image, and acquiring a registration gray value of a corresponding registration image according to a matching result;
threshold calculation is carried out according to the basic gradient value, the image gray value and the registration gray value, and a standard threshold is obtained;
and adjusting the basic image according to the standard threshold value to obtain a differential image.
Optionally, the calculating the threshold according to the basic gradient value, the image gray value and the registration gray value to obtain a standard threshold includes:
the threshold calculation is performed using the following formula:
;
wherein,,representing the standard threshold,/->Representing the gray value of said image,>representing the registration gray value,/or->Representing the basal gradient value,/->Representing a preset control factor.
Optionally, the performing pipeline filtering processing on the differential image based on the target to obtain a target image includes:
acquiring a potential target position of the target, and inputting the potential target position into the differential image as a pipeline to obtain a pipeline differential image;
denoising the pipeline differential image to obtain a denoised image;
and carrying out segmentation processing on the denoising image to obtain a target image.
Optionally, the matching the image feature and the background motion vector includes:
judging whether the image features are consistent with the background motion vectors or not;
when the image features are inconsistent with the background motion vectors, the background motion vectors cannot be used as registration images;
and when the image features are consistent with the background motion vectors, taking the background motion vectors corresponding to the vector features as registration images.
In order to solve the above-mentioned problems, the present invention also provides a digital image object detection system based on medical examination, the system comprising:
the system comprises a wavelet pyramid generation module, a medical detection module and a detection module, wherein the wavelet pyramid generation module is used for acquiring a digital image of medical detection, performing image decomposition on the digital image by using a preset decomposition algorithm to obtain a decomposition image, and generating a wavelet pyramid according to the decomposition image;
the optical flow calculation module is used for selecting a basic image from the wavelet pyramid, extracting the characteristics of the basic image to obtain image characteristics, and calculating the optical flow of the basic image;
the differential image generation module is used for estimating a background motion vector of the basic image based on the optical flow, matching the image characteristics with the background motion vector, and carrying out registration image transformation on the basic image according to a matching result to obtain a differential image;
and the target image generation module is used for extracting the maximum communication area from the differential image as a potential target, and performing pipeline filtering processing on the differential image based on the target to obtain a target image.
According to the embodiment of the invention, the digital image is subjected to image decomposition, and a wavelet pyramid with more layers can be generated according to the decomposed digital image; by selecting a basic image from the wavelet pyramid and extracting the characteristics of the basic image, the image characteristics can be accurately obtained; the background motion vector of the basic image can be estimated more accurately through the optical flow; matching is carried out through image features and background motion vectors, registration image transformation is carried out on a basic image according to a matching result, weak targets and excessive interference information can be prevented from being omitted, and a differential image can be accurately obtained; the maximum communication area is extracted from the differential image to serve as a potential target, and pipeline filtering processing is carried out on the differential image based on the target, so that interference factors such as noise and illumination in the extraction process are eliminated, and the target image can be accurately and effectively detected. Therefore, the object detection method and the object detection system based on the digital image of the medical test can solve the problem of accurately and effectively detecting the object in the digital image of the medical test.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the application provides a digital image target detection method based on medical examination. The subject of execution of the method for detecting a target of a digital image based on medical examination includes, but is not limited to, at least one of a server, a terminal, etc. capable of being configured to execute the method provided by the embodiments of the present application. In other words, the method of object detection of a digital image based on medical examination may be performed by software or hardware installed at a terminal device or a server device, the software may be a blockchain platform. The service end includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Referring to fig. 1, a flowchart of a digital image object detection method based on medical examination according to an embodiment of the present invention is shown. In this embodiment, the digital image target detection method based on medical examination includes:
s1, acquiring a digital image of medical examination, performing image decomposition on the digital image by using a preset decomposition algorithm to obtain a decomposition image, and generating a wavelet pyramid according to the decomposition image.
In the embodiment of the present invention, the decomposition algorithm is expressed as:
;
wherein,,indicate->The corresponding +.>Line->Column pixels>Indicate->Digital image corresponding +.>Line->Column pixels>Representing preset high-pass filter coefficients, < >>Representing preset low pass filter coefficients.
In the embodiment of the invention, the medical test refers to the test of microbiological, immunological, biochemical, genetic, hematological, biophysical, cytological and other aspects of materials taken from human body; the digital image is also called as a digital image, and is an image represented in a two-dimensional array (matrix) form, wherein the image is formed by discretizing a continuous actual object plane in terms of space coordinates and energy amplitude.
In the embodiment of the invention, a discrete wavelet transformation mode is adopted to carry out image decomposition on the digital image by using a Mallat decomposition algorithm to obtain a decomposition image; further, when decomposing the digital images with different scale frequency bands, the Mallat decomposition algorithm can be uniformly adopted by the decomposition algorithm, and the high-pass filter coefficient and the low-pass filter coefficient are constant, so that the digital images can be decomposed into four decomposed images with four frequency bands, namely, a horizontal low frequency and a vertical low frequency are first frequency bands; the horizontal low frequency and the vertical high frequency are the second frequency band; the horizontal high frequency and the vertical low frequency are the third frequency band; the horizontal high frequency and the vertical high frequency are the fourth frequency band.
In an embodiment of the present invention, the generating a wavelet pyramid according to the decomposed image includes:
acquiring the frequency of the decomposed image, and judging whether the frequency is larger than a preset target threshold value or not;
when the frequency is not greater than the target threshold, judging that the frequency is low frequency, carrying out weight assignment on the decomposed image to obtain decomposed weight, and carrying out fusion processing on the decomposed image based on the decomposed weight to obtain a first fusion image;
when the frequency is larger than the target threshold, judging that the frequency is high frequency, and performing fusion processing on the decomposed image to obtain a second fusion image;
and integrating according to the first fused image and the second fused image to obtain a wavelet pyramid.
In the embodiment of the invention, after wavelet decomposition is performed on the digital image, the digital image comprises 3N decomposition images of high frequency bands and one low frequency band, wherein the frequency band refers to the bandwidth occupied by a signal, namely the frequency range; the target threshold refers to a preset frequency, for example, the target threshold is set to 300Hz, and when the frequency is less than 300Hz, that is, the frequency is a low frequency; when the frequency is greater than 300Hz, i.e. the frequency is high frequency.
In the embodiment of the invention, for the decomposed image with the low frequency: and calculating local variance according to pixel points of the decomposed image corresponding to the frequency, carrying out weight assignment on the decomposed image according to the local variance to obtain decomposed weight, and carrying out normalization calculation on the decomposed image according to the decomposed weight, namely carrying out fusion treatment on the decomposed image to obtain a first fusion image.
In the embodiment of the present invention, for the decomposed image with the high frequency: the edge extraction can be carried out on each high-frequency component by using a canny operator to obtain an edge image, then the local variance is calculated on each element of the edge image, the edge image corresponding to the local variance with the largest absolute value is selected, and fusion calculation is carried out on the edge image by using a fusion operator to obtain a second fusion image; and finally, overlapping the first fusion image and the second fusion image according to the image resolution from bottom to top to obtain a fusion image, and performing wavelet inverse transformation on the fusion image to obtain a wavelet pyramid.
S2, selecting a basic image from the wavelet pyramid, extracting features of the basic image to obtain image features, and calculating the optical flow of the basic image.
In the embodiment of the invention, the resolution of the decomposition image of the wavelet pyramid from top to bottom is gradually improved, and the decomposition image of the bottommost layer of the wavelet pyramid is closest to the original digital image, so that the decomposition image of the bottommost layer in the wavelet pyramid can be selected as the basic image.
Referring to fig. 2, in an embodiment of the present invention, the feature extraction of the base image to obtain an image feature includes:
s21, carrying out graying treatment on the basic image to obtain a gray image;
s22, carrying out convolution and pooling treatment on the gray level image to obtain pooling characteristics;
s23, carrying out normalization processing on the pooled features to obtain image features.
In the embodiment of the present invention, the performing a graying process on the base image to obtain a gray image includes:
obtaining color components in the basic image, and carrying out averaging treatment on the color components by using a preset standard averaging method to obtain gray values;
and updating the basic image by using the gray value to obtain a gray image.
In the embodiment of the present invention, the standard average method is expressed as:
;
wherein,,representing the gray value +_>Representing the red component of said color components, -a red component of said color components>Representing the green component of said color components, a +.>Representing the blue component of the color components.
In the embodiment of the invention, the color components comprise a red component, a green component and a blue component; and carrying out averaging treatment on the color components by using the standard averaging method to enable the gray value to reach a standard gray value, and replacing the gray value in the basic image by using the gray value so as to update the basic image and obtain a gray image.
In the embodiment of the invention, in order to eliminate the influence of phenomena such as blurring, distortion and the like on the image quality, the basic image is subjected to graying treatment to obtain a gray image; vector conversion is carried out on the gray level image, the gray level vector obtained through the vector conversion is divided into a plurality of vector blocks with the same size, and a plurality of convolution values are obtained by multiplying the vector blocks with a preset convolution kernel; superposing the convolution values to obtain characteristic values, establishing an average pooling cache according to the characteristic values, and calculating the characteristic values to obtain pooling characteristics; and carrying out normalization processing on the pooled features by using a K-means algorithm to obtain image features.
In an embodiment of the present invention, the calculating the optical flow of the base image includes:
acquiring a center coordinate and a basic gray value of the basic image, and respectively calculating a transverse optical flow and a longitudinal optical flow of the basic image according to the center coordinate and the basic gray value;
generating an optical flow of the base image from the lateral optical flow and the longitudinal optical flow.
In the embodiment of the invention, the basic image is placed in a preset rectangular coordinate system, the coordinate of the central point of the basic image is obtained as the central coordinate, the gray value of the transverse coordinate and the gray value of the longitudinal coordinate of the basic image are recorded, the average value of the gray values of a plurality of transverse coordinates and the gray value of the longitudinal coordinate are calculated, and the calculated transverse average gray value and longitudinal average gray value are used as the basic gray value.
In the embodiment of the present invention, the calculating the transverse optical flow and the longitudinal optical flow of the base image according to the center coordinate and the base gray value includes:
the lateral optical flow and the longitudinal optical flow are calculated by using the following formula:
;
;
wherein,,representing the lateral optical flow->Representing the longitudinal optical flow->An abscissa representing said central coordinate +.>Corresponding basic gray value, ">An ordinate representing said center coordinate +.>Corresponding base gray values.
In the embodiment of the invention, the optical flow of the basic image is generated by using the following formula:
;
wherein,,representing the optical flow->Representing the lateral optical flow->Representing the longitudinal optical flow.
And S3, estimating a background motion vector of the basic image based on the optical flow, matching the image characteristics with the background motion vector, and carrying out registration image transformation on the basic image according to a matching result to obtain a differential image.
In the embodiment of the present invention, the estimating the background motion vector of the base image based on the optical flow includes:
randomly selecting a frame image from the basic image based on the optical flow, and calculating gradient values of pixels of the frame image;
calculating an optical flow field value of the frame image according to the gradient value and the optical flow, and judging whether the optical flow field value is consistent with a preset real field value or not;
returning to the step of randomly selecting a frame image from the base image based on the optical flow when the optical flow field value is inconsistent with the real field value;
and when the optical flow field value is consistent with the real field value, carrying out vector conversion on the frame image to obtain a background motion vector.
In the embodiment of the invention, the frame images with the same optical flow can be randomly selected from the basic images; calculating the gradient value of each pixel of the frame image by using a Sobel operator, obtaining a pixel matrix, respectively calculating a horizontal gradient value in the horizontal direction and a vertical gradient value in the vertical direction according to the pixel matrix, and integrating the horizontal gradient value and the vertical gradient value to obtain a gradient value, wherein the integration is carried out by using the following formula:
;
wherein,,representing the gradient value,/->Representing the horizontal gradient value,/->Representing the vertical gradient value.
In an embodiment of the present invention, the optical flow field value of the frame image is calculated using the following formula:
;
wherein,,representing the optical flow field value,/->Representing the gradient value,/->Representing the optical flow.
In the embodiment of the invention, the real field value refers to a preset standard field value; and carrying out vector conversion on the frame image by using a diffusion curve method to obtain a background motion vector, specifically, carrying out image segmentation on the frame image to obtain a segmented image, carrying out edge detection on the segmented image, carrying out curve fitting on the detected segmented image, storing curves and filling information in a vector file form, and finally carrying out iterative diffusion on colors on the diffusion curve by using a Poisson equation to obtain the background motion vector.
In an embodiment of the present invention, the matching the image feature and the background motion vector includes:
judging whether the image features are consistent with the background motion vectors or not;
when the image features are inconsistent with the background motion vectors, the background motion vectors cannot be used as registration images;
and when the image features are consistent with the background motion vectors, taking the background motion vectors corresponding to the vector features as registration images.
In the embodiment of the invention, when the image feature is inconsistent with the background motion vector, the background motion vector is not in the range of the target feature, so the background motion vector cannot be used as a registration image; when the image feature is consistent with the background motion vector, the background motion vector can be used as a registration image, and registration image transformation can be performed on the base image based on the registration image.
Referring to fig. 3, in the embodiment of the present invention, performing registration map transformation on the base image according to the matching result to obtain a differential image includes:
s31, acquiring a basic gradient value and an image gray value of the basic image, and acquiring a registration gray value of a corresponding registration image according to a matching result;
s32, carrying out threshold calculation according to the basic gradient value, the image gray value and the registration gray value to obtain a standard threshold;
and S33, adjusting the basic image according to the standard threshold value to obtain a differential image.
In the embodiment of the invention, the threshold value calculation is performed by using the following formula:
;
wherein,,representing the standard threshold,/->Representing the gray value of said image,>representing the registration gray value,/or->Representing the basal gradient value,/->Representing a preset control factor.
In the embodiment of the invention, the basic gradient value refers to the numerical value change of the basic image per unit distance in the direction of the fastest change; the image gray value refers to the brightness value of the pixel in the basic image; the registration gray value refers to a brightness value of a pixel in the registration image; when the contrast of the basic image is higher, a target with overlarge threshold value and weaker omission can be generated; when the contrast of the basic image is lower, too little threshold value can be generated to introduce too much interference information, so that the contrast of the basic image is in the standard threshold value through the basic gradient value, the image gray value and the registration gray value to calculate the standard threshold value, the omission of weaker targets and the avoidance of too much interference information can be avoided, and the differential image is closer to the target image.
S4, extracting the maximum connected region from the differential image to serve as a potential target, and performing pipeline filtering processing on the differential image based on the target to obtain a target image.
In the embodiment of the invention, a preset region growing algorithm is adopted to extract a moving target slice from the differential image, wherein the moving target slice refers to a connected region in the differential image, specifically, the region growing algorithm is a classical serial image segmentation algorithm, in order to improve the real-time performance of algorithm calculation, binarization processing is carried out on the differential image to obtain a binarized image, seed points are sub-sampled and searched from the binarized image, the seed points with the value of 1 are connected, so that the largest connected region in the whole binarized image is searched, and the largest connected region is used as a potential target.
In the embodiment of the present invention, the performing pipeline filtering processing on the differential image based on the target to obtain a target image includes:
acquiring a potential target position of the target, and inputting the potential target position into the differential image as a pipeline to obtain a pipeline differential image;
denoising the pipeline differential image to obtain a denoised image;
and carrying out segmentation processing on the denoising image to obtain a target image.
In the embodiment of the invention, the potential target position refers to the position of the communication area of the target in the differential image; marking in the differential image according to the potential target position, and taking the marked differential image as a pipeline differential image; denoising the pipeline differential image by adopting a mean value filtering method to obtain a denoised image, namely replacing the value of the original pixel of the pipeline differential image by using the mean value of a template consisting of a plurality of adjacent pixels of the pipeline differential image; due to factors such as noise, illumination change and the like, the stray points must be further filtered and removed to extract the accurate position of the target, so that a horizontal projection algorithm is utilized to segment the image according to the denoising image, interference factors in the extraction process are removed, and a target image is obtained.
According to the embodiment, the digital image is subjected to image decomposition, and a wavelet pyramid with a higher hierarchy can be generated according to the decomposed digital image; by selecting a basic image from the wavelet pyramid and extracting the characteristics of the basic image, the image characteristics can be accurately obtained; the background motion vector of the basic image can be estimated more accurately through the optical flow; matching is carried out through image features and background motion vectors, registration image transformation is carried out on a basic image according to a matching result, weak targets and excessive interference information can be prevented from being omitted, and a differential image can be accurately obtained; the maximum communication area is extracted from the differential image to serve as a potential target, and pipeline filtering processing is carried out on the differential image based on the target, so that interference factors such as noise and illumination in the extraction process are eliminated, and the target image can be accurately and effectively detected.
FIG. 4 is a functional block diagram of a digital image object detection system based on medical examination according to an embodiment of the present invention.
The medical verification-based digital image object detection system 400 may be installed in an electronic device. Depending on the functionality implemented, the medical-verification-based digital-image object detection system 400 may include a wavelet pyramid generation module 401, an optical flow calculation module 402, a differential image generation module 403, and an object image generation module 404. The module of the invention, which may also be referred to as a unit, refers to a series of computer program segments, which are stored in the memory of the electronic device, capable of being executed by the processor of the electronic device and of performing a fixed function.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the wavelet pyramid generation module 401 is configured to obtain a digital image for medical examination, perform image decomposition on the digital image by using a preset decomposition algorithm to obtain a decomposed image, and generate a wavelet pyramid according to the decomposed image;
the optical flow calculation module 402 is configured to select a base image from the wavelet pyramid, perform feature extraction on the base image to obtain an image feature, and calculate an optical flow of the base image;
the differential image generating module 403 is configured to estimate a background motion vector of the base image based on the optical flow, match the image feature with the background motion vector, and perform registration map transformation on the base image according to a matching result to obtain a differential image;
the target image generating module 404 is configured to extract a maximum connected region from the differential image as a potential target, and perform pipeline filtering processing on the differential image based on the target, so as to obtain a target image.
In detail, each module in the medical-inspection-based digital image object detection system 400 in the embodiment of the present invention adopts the same technical means as the medical-inspection-based digital image object detection method in the drawings, and can produce the same technical effects, which are not described herein.
An embodiment of the invention provides an electronic device for realizing a target detection method of a digital image based on medical examination.
The electronic device may comprise a processor, a memory, a communication bus and a communication interface, and may further comprise a computer program stored in the memory and executable on the processor, such as the above-described medical verification-based digital image object detection method.
The memory-stored digital image object detection program based on medical examination in the electronic device is a combination of instructions that, when executed in the processor, may implement:
acquiring a digital image of medical examination, performing image decomposition on the digital image by using a preset decomposition algorithm to obtain a decomposition image, and generating a wavelet pyramid according to the decomposition image;
selecting a basic image from the wavelet pyramid, extracting features of the basic image to obtain image features, and calculating the optical flow of the basic image;
estimating a background motion vector of the basic image based on the optical flow, matching the image characteristics with the background motion vector, and carrying out registration image transformation on the basic image according to a matching result to obtain a differential image;
and extracting the maximum connected region from the differential image as a potential target, and performing pipeline filtering processing on the differential image based on the target to obtain a target image.
The present invention also provides a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device, can implement:
acquiring a digital image of medical examination, performing image decomposition on the digital image by using a preset decomposition algorithm to obtain a decomposition image, and generating a wavelet pyramid according to the decomposition image;
selecting a basic image from the wavelet pyramid, extracting features of the basic image to obtain image features, and calculating the optical flow of the basic image;
estimating a background motion vector of the basic image based on the optical flow, matching the image characteristics with the background motion vector, and carrying out registration image transformation on the basic image according to a matching result to obtain a differential image;
and extracting the maximum connected region from the differential image as a potential target, and performing pipeline filtering processing on the differential image based on the target to obtain a target image.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.