CN111787183B - Image processing method, device and storage medium for endoscope - Google Patents
Image processing method, device and storage medium for endoscope Download PDFInfo
- Publication number
- CN111787183B CN111787183B CN202010770530.XA CN202010770530A CN111787183B CN 111787183 B CN111787183 B CN 111787183B CN 202010770530 A CN202010770530 A CN 202010770530A CN 111787183 B CN111787183 B CN 111787183B
- Authority
- CN
- China
- Prior art keywords
- image
- endoscope
- information
- frame
- blocks
- 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
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 27
- 230000002194 synthesizing effect Effects 0.000 claims abstract description 8
- 230000003068 static effect Effects 0.000 claims description 57
- 238000004364 calculation method Methods 0.000 claims description 28
- 230000001133 acceleration Effects 0.000 claims description 27
- 238000000034 method Methods 0.000 claims description 26
- 238000001356 surgical procedure Methods 0.000 description 11
- 238000010586 diagram Methods 0.000 description 10
- 239000011159 matrix material Substances 0.000 description 7
- 238000004891 communication Methods 0.000 description 6
- 230000007246 mechanism Effects 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 6
- 230000009466 transformation Effects 0.000 description 6
- 238000009826 distribution Methods 0.000 description 5
- 230000009471 action Effects 0.000 description 3
- 238000001727 in vivo Methods 0.000 description 3
- 238000005192 partition Methods 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 239000002131 composite material Substances 0.000 description 2
- 230000004069 differentiation Effects 0.000 description 2
- 238000006073 displacement reaction Methods 0.000 description 2
- 238000002372 labelling Methods 0.000 description 2
- 230000008094 contradictory effect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 238000002324 minimally invasive surgery Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N3/00—Scanning details of television systems; Combination thereof with generation of supply voltages
- H04N3/10—Scanning details of television systems; Combination thereof with generation of supply voltages by means not exclusively optical-mechanical
- H04N3/14—Scanning details of television systems; Combination thereof with generation of supply voltages by means not exclusively optical-mechanical by means of electrically scanned solid-state devices
- H04N3/15—Scanning details of television systems; Combination thereof with generation of supply voltages by means not exclusively optical-mechanical by means of electrically scanned solid-state devices for picture signal generation
- H04N3/155—Control of the image-sensor operation, e.g. image processing within the image-sensor
- H04N3/1568—Control of the image-sensor operation, e.g. image processing within the image-sensor for disturbance correction or prevention within the image-sensor, e.g. biasing, blooming, smearing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/50—Image enhancement or restoration using two or more images, e.g. averaging or subtraction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/73—Deblurring; Sharpening
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
- H04N19/136—Incoming video signal characteristics or properties
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/17—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
- H04N19/172—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/17—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
- H04N19/176—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/222—Studio circuitry; Studio devices; Studio equipment
- H04N5/2224—Studio circuitry; Studio devices; Studio equipment related to virtual studio applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N9/00—Details of colour television systems
- H04N9/12—Picture reproducers
- H04N9/31—Projection devices for colour picture display, e.g. using electronic spatial light modulators [ESLM]
- H04N9/3141—Constructional details thereof
- H04N9/3173—Constructional details thereof wherein the projection device is specially adapted for enhanced portability
- H04N9/3176—Constructional details thereof wherein the projection device is specially adapted for enhanced portability wherein the projection device is incorporated in a camera
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10068—Endoscopic image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20021—Dividing image into blocks, subimages or windows
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20172—Image enhancement details
- G06T2207/20201—Motion blur correction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20212—Image combination
- G06T2207/20221—Image fusion; Image merging
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
The invention discloses an image processing method of an endoscope, which comprises the following steps: acquiring motion information of an operating arm of a surgical robot and parameter information of an endoscope, calculating to obtain a first virtual projection image, dividing image blocks to obtain a plurality of first image blocks, and determining corresponding first attributes; acquiring an image frame sequence, and dividing image blocks to obtain a second image block corresponding to the first image block and a second attribute; performing secondary division on a second image block with a second attribute of a moving state to obtain a third image block; acquiring the characteristic values and the image information of the second image block and the third image block, and determining a third attribute of the third image block; determining the weighting parameter group of the second image block and the third image block which are not divided secondarily in each frame of image according to the second attribute and the third attribute respectively; and according to the weighting parameter group and the image information, carrying out weighted average and synthesizing the target image frame. The invention also discloses a device and a medium. The invention can prevent the trailing phenomenon of the image.
Description
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image processing method and an image processing apparatus for an endoscope, and a computer-readable storage medium.
Background
Endoscopes are widely used in the medical field and the industrial field. For example, in an endoscope system in the medical field, a doctor endoscopically inspects or performs a minimally invasive surgery on a patient through an image acquired by an endoscope. In an endoscope system in the industrial field, an observer inspects the interior of various machines, devices, and the like through images acquired by an endoscope without detaching or damaging an object to be detected.
The image sensor used in the endoscope is subject to various environmental restrictions and strict temperature requirements, which may result in a low signal-to-noise ratio of the original image. In order to solve the problem, the conventional scheme generally adopts a filter to filter the image, but since noise points are randomly distributed in the image, when a plurality of frames of images are weighted and averaged, although the noise points are reduced, when a moving object with a high moving speed exists in the image, the image can generate a serious trailing phenomenon.
Disclosure of Invention
The invention mainly aims to provide an image processing method, an image processing device and a computer readable storage medium of an endoscope, and aims to solve the technical problem that when a moving object with a high moving speed exists in an image acquired by the existing endoscope, the image is seriously trailing.
In order to achieve the above object, the present invention provides an image processing method of an endoscope, comprising:
acquiring motion information of an operating arm of a surgical robot and parameter information of an endoscope of the surgical robot;
calculating to obtain a first virtual projection image of the operation arm relative to the endoscope according to the motion information of the operation arm and the parameter information of the endoscope, wherein the first virtual projection image comprises a projection image of the operation arm;
dividing the first virtual projection image to obtain a plurality of first image blocks, and determining first attributes of the plurality of first image blocks according to the motion information;
reading an image frame sequence which is acquired by the endoscope and comprises a plurality of frames of images, dividing each frame of image in the image frame sequence to obtain a plurality of second image blocks corresponding to the first image blocks, and matching the first image blocks with the second image blocks to obtain second attributes of the plurality of second image blocks in each frame of image and the first attributes;
performing secondary division on the second image block with the second attribute in the moving state to obtain a plurality of third image blocks;
acquiring the characteristic value and the image information of each second image block and each third image block of each frame image, and determining the third attribute of each third image block according to the characteristic value of each third image block;
determining the weighting parameters of each second image block and each third image block which are not divided secondarily in each frame of image according to the second attribute and the third attribute, and obtaining a weighting parameter group according to the weighting parameters of the image blocks of the plurality of frames of images which are located at the same position;
according to the weighting parameter group and the image information of the image blocks of the multi-frame images, which are positioned at the same position, carrying out weighted average calculation to obtain target image information of the target image blocks corresponding to the same position;
and synthesizing the target image information of the image blocks into a target image frame.
Preferably, the image processing method of an endoscope further includes:
and when the projection image of the operation arm is obtained, enlarging the projection image of the operation arm by a preset proportion to obtain the first virtual projection image containing the enlarged projection image of the operation arm.
Preferably, the step of enlarging the projection image by a preset scale includes:
the method comprises the steps of obtaining a plurality of joint characteristic points of a projected image of the operating arm, using each joint characteristic point as an origin point, using a corresponding preset radius as a circle to obtain a plurality of characteristic circles, obtaining common tangents of two adjacent characteristic circles, and connecting the common tangents to obtain an expanded projected image of the operating arm.
Preferably, the step of acquiring the motion information of the operation arm of the surgical robot includes:
acquiring motion sensor information of the operating arm, and acquiring motion state, motion speed, motion acceleration and position information of the operating arm according to the motion sensor information;
acquiring a base coordinate system of the surgical robot, and constructing a first motion equation of the operating arm relative to the base coordinate system and a second motion equation of the endoscope relative to the base coordinate system according to the position information;
and calculating the pose information of the operating arm relative to the endoscope according to the first motion equation and the second motion equation.
Preferably, the step of calculating a first virtual projection image of the operation arm with respect to the endoscope based on the motion information of the operation arm and the parameter information of the endoscope includes:
constructing an endoscope projection model according to the parameter information of the endoscope to obtain a virtual projection plane of the endoscope;
obtaining a visible area and an invisible area of the operating arm relative to the virtual projection plane according to the motion information of the operating arm and the endoscope projection model;
and projecting the visible region to the virtual projection plane to obtain the first virtual projection image containing the visible region.
Preferably, the determining, according to the second attribute and the third attribute, a weighting parameter of each second image block and each third image block in each frame of image, which are not divided twice, and obtaining the weighting parameter set according to the weighting parameters of the image blocks of the multiple frames of images located at the same position includes:
determining a second attribute of the second image block of each frame of image in the image frame sequence according to the characteristic values of the plurality of second image blocks;
giving the third image block with the third attribute in a static state, obtaining a weighting parameter set { K) according to the weighting parameter of the image block at the same position in the image frame sequence and the weighting parameter in each image frame sequence1(M,N),K2(M,N),……,Kn(M,N)In which K is1(M,N)=K2(M,N)=……=K(n-1)(M,N)=Kn(M,N)=1/n,Kn(M,N)Representing weighting parameters of said third image block (M, N) in an nth frame image,Kn(M,N)∈[0,1];
giving the third image block with the third attribute in a static state, obtaining a weighting parameter set { K 'according to the weighting parameter of the image block located at the same position in the image frame sequence in each frame image'1(M’,N’),K’2(M’,N’),……,K’n(M’,N’)Wherein, K'1(M’,N’)=K’2(M’,N’)=……K’(n-1)(M,N)=K’n(M,N)=1/n,K’n(M’,N’)Representing a weighting parameter, K ', of said third image block (M', N ') in the N-th frame image'n(M’,N’)∈[0,1];
Giving the second image block with the second attribute in a moving state, obtaining a weighting parameter set { K 'according to the weighting parameter of the image block located at the same position in the image frame sequence in the weighting parameter in each frame image'1(M,N),K’2(M,N),……,K’n(M,N)Wherein, K'1(M,N)<K’2(M,N)<……<K’n(M,N)Or K'1(M,N)=K’2(M,N)=……=K’(n-1)(M,N)<K’n(M,N),K’n(M,N)Representing a weighting parameter, K ', of the second image block (M', N ') in the N-th frame image'n(M,N)∈[0,1]。
Preferably, the K'1(M,N)=K’2(M,N)=……=K’(n-1)(M,N)<K’n(M,N)Of (1), K'1(M,N)=K’2(M,N)=……=K2(n-1)(M,N)=0,Kn(M,N)=1。
Preferably, the parameter information includes at least one of a field angle, a focal length, and an offset amount of the endoscope.
Preferably, the motion information includes at least one of motion state, motion speed, motion acceleration, and pose information.
Preferably, the step of performing weighted average calculation to obtain target image information of target image blocks corresponding to the same position according to the weighting parameter group and the image information of image blocks located at the same position in the multi-frame image includes:
calculating the product of the image information of the image block at the same position in different image frames and the corresponding weighting parameters in the weighting parameter group according to the weighting parameter group, the image information of the second image block which is not secondarily divided and is positioned at the same position and the image information of the plurality of third image blocks positioned at the same position;
and adding the products of each image block to obtain the target image information of the plurality of image blocks.
In order to achieve the above object, the present invention also provides an image processing apparatus including a memory, a processor, and an image processing program of an endoscope stored on the memory and executable on the processor;
the image processing program of the endoscope, when executed by the processor, implements the steps of the method as described above.
To achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon an image processing program of an endoscope, which when executed by a processor, realizes the steps of the image processing method of the image processing apparatus as described above.
The invention provides an image processing method of endoscope, an image processing device and a computer readable storage medium, obtaining a plurality of image blocks by obtaining an image frame sequence comprising a plurality of frames of images and dividing each frame of image in the image frame sequence, then, obtaining the characteristic values and the image information of the image blocks in each frame of image, determining the weighting parameters of each image block in the image blocks in each frame of image according to the attributes, obtaining a weighting parameter group according to the weighting parameters of the image blocks at the same position in the image frame sequence, further performing weighted average calculation according to the weighting parameter group and the image information of the image blocks at the same position in the multi-frame image to obtain target image information of the image blocks, and finally synthesizing the target image information of the image blocks into a target image frame. Therefore, the weighting parameters corresponding to different image frames are given to each image block according to the attributes of the image blocks, and the trailing phenomenon of the image can be prevented when a moving object with higher moving speed exists in the image through the weighted average of the different weighting parameters.
Drawings
Fig. 1 is a schematic diagram of a hardware structure of an image processing apparatus according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating an image processing method of an endoscope according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a first embodiment of image block division according to the present invention;
FIG. 4 is a diagram illustrating a second embodiment of image block division according to the present invention;
FIG. 5 is a diagram illustrating a third embodiment of image block division according to the present invention;
FIG. 6 is a schematic flow chart diagram illustrating a method for processing images of an endoscope in accordance with a further embodiment of the present invention;
FIG. 7 is a schematic view of the surgical robot of the present invention;
FIG. 8 is a partial structural view of a slave manipulator of the surgical robot for single-hole surgery according to the present invention;
FIG. 9 is a partial structural view of a slave manipulator for a multi-hole operation of the surgical robot according to the present invention;
FIG. 10 is a schematic view of the surgical robot of the present invention for constructing a coordinate system from the operating device for single-hole surgery;
FIG. 11 is a schematic view of the surgical robot of the present invention for constructing a coordinate system from the manipulating device for the multi-hole surgery;
FIG. 12 is the virtual projection image of the visible area containing the manipulator arm of the present invention;
FIG. 13 is an enlarged schematic view of the virtual projection image of FIG. 12;
FIG. 14 is a diagram illustrating attribute labeling of image blocks according to the present invention;
FIG. 15 is a schematic diagram of matching a current image frame with an image block of a virtual projection image in an image frame sequence according to the present invention;
FIG. 16 is a schematic illustration of the present invention marking the operating arm;
FIG. 17 is a schematic diagram of the present invention illustrating image block division and attribute labeling for a moving manipulator and a stationary manipulator on a virtual projection image, respectively;
fig. 18 is a flowchart illustrating an image processing method of an endoscope according to still another embodiment of the present invention.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It should be noted that the descriptions relating to "first", "second", etc. in the present invention are for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
As shown in fig. 1, fig. 1 is a schematic diagram of a hardware configuration of an image processing apparatus according to an embodiment of the present invention.
As shown in fig. 1, the image processing apparatus may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used for realizing connection communication among the 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., WI-FI interface); the memory 1005 may be a high-speed RAM memory, or may be a non-volatile memory (e.g., a magnetic disk memory), and optionally, the memory 1005 may be a storage device independent of the processor 1001.
Those skilled in the art will appreciate that the hardware configuration shown in fig. 1 does not constitute a limitation of the image processing apparatus, and may include more or less components than those shown, or combine some components, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and an image processing program.
In the image processing apparatus shown in fig. 1, the network communication module is mainly used for connecting a server and performing data communication with the server; and the processor 1001 may be configured to call up an image processing program stored in the memory 1005 and perform the following operations:
acquiring an image frame sequence comprising a plurality of frames of images, and dividing each frame of image in the image frame sequence to obtain a plurality of image blocks;
acquiring the characteristic values and the image information of the image blocks in each frame of image;
determining the weighting parameter of each image block in the plurality of image blocks in each frame of image according to the attributes, and obtaining a weighting parameter group according to the weighting parameters of the image blocks of the plurality of frames of images at the same position;
performing weighted average calculation according to the weighting parameter group and the image information of the image blocks located at the same position of the multi-frame image to obtain target image information of the plurality of image blocks;
and synthesizing the target image information of the image blocks into a target image frame.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
calculating a characteristic difference value between each image block corresponding to the plurality of image blocks of the current frame image and the previous frame image according to the characteristic values of the plurality of image blocks in each frame image;
when the characteristic difference value is larger than a first preset threshold value, determining that the attribute of the image block is in a moving state;
and when the characteristic difference value is smaller than or equal to the first preset threshold value, determining that the attribute of the image block is in a static state.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
calculating the corresponding average characteristic value of each image block in the plurality of image blocks in the image frame sequence according to the characteristic values of the plurality of image blocks in each frame image;
calculating a characteristic difference value between the characteristic value of each image block in the current frame image and the average characteristic value corresponding to each image block;
when the characteristic difference value is larger than a second preset threshold value, determining that the attribute of the image block is in a moving state;
and when the characteristic difference value is smaller than or equal to the second preset threshold, determining that the attribute of the image block is in a static state.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
when the attribute is in a moving state, giving the weighting parameters of the image blocks with the attribute in the moving state in each frame of image, and obtaining a weighting parameter set { K ] according to the weighting parameters of the image blocks of the plurality of frames of images at the same position1(M,N),K2(M,N),……,Kn(M,N)In which K is1(M,N)<K2(M,N)<……<Kn(M,N)Or K1(M,N)=K2(M,N)=……=K(n-1)(M,N)<Kn(M,N),Kn(M,N)Representing a weighting parameter, K, of the image block (M, N) in the nth frame imagen(M,N)∈[0,1]。
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
giving attribute a static state when the attribute is staticThe weighting parameters of the image blocks in each frame of image are obtained according to the weighting parameters of the image blocks at the same position in the image frame sequence, and the obtained weighting parameter set { K1(M,N),K2(M,N),……,Kn(M,N)In which K is1(M,N)=K2(M,N)=……=K(n-1)(M,N)=Kn(M,N)=1/n。
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
calculating the product of the image information of the image blocks at the same position in different image frames and the corresponding weighting parameters in the weighting parameter group according to the weighting parameter group and the image information of the image blocks at the same position;
and adding the products of the image blocks at the same position to obtain target image information corresponding to the target image blocks at the same position.
The processor 1001 may also be configured to call an image processing program stored in the memory 1005 and perform the following operations:
acquiring motion information of an operating arm of a surgical robot and parameter information of an endoscope of the surgical robot;
calculating to obtain a virtual projection image of the operation arm relative to the endoscope according to the motion information of the operation arm and the parameter information of the endoscope;
dividing the virtual projection image to obtain a plurality of image blocks, and determining first attributes of the image blocks according to the motion information;
reading an image frame sequence which is acquired by the endoscope and comprises a plurality of frames of images, dividing each frame of image in the image frame sequence to obtain a plurality of image blocks, and acquiring characteristic values and image information of the image blocks in each image;
matching the image blocks of the virtual projected image with the image blocks of the multi-frame images to obtain a second attribute corresponding to the first attribute of each image block in each frame of image;
determining the weighting parameter of each image block in the plurality of image blocks in each frame of image according to the second attribute, and obtaining a weighting parameter group according to the weighting parameters of the image blocks of the plurality of frames of images at the same position;
performing weighted average calculation according to the weighting parameter group and the image information of the image blocks located at the same position of the multi-frame image to obtain target image information of the plurality of image blocks;
and synthesizing the target image information of the image blocks into a target image frame.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
acquiring motion sensor information of the operating arm, and acquiring motion state, motion speed, motion acceleration and position information of the operating arm according to the motion sensor information;
acquiring a base coordinate system of the surgical robot, and constructing a first motion equation of the operating arm relative to the base coordinate system and a second motion equation of the endoscope relative to the base coordinate system according to the position information;
and calculating the pose information of the operating arm relative to the endoscope according to the first motion equation and the second motion equation.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
when the motion information is in a motion state, determining a motion operation arm and a static operation arm according to the motion state;
and acquiring a moving image block of the moving operation arm on the virtual projection image, correspondingly marking the attribute of the moving image block as a moving state, acquiring a static image block of the static operation arm on the virtual projection image, and correspondingly marking the attribute of the static image block as a static state.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
when the motion information is the motion speed or the motion acceleration, determining a motion operation arm and a static operation arm according to the motion speed or the motion acceleration;
and acquiring a moving image block of the moving operation arm on the virtual projection image, correspondingly marking the moving speed or the moving acceleration of the moving image block and the attribute of the moving image block as a moving state, acquiring a static image block of the static operation arm on the virtual projection image, and correspondingly marking the attribute of the static image block as a static state.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
calculating the movement speed of the projection point of the operating arm on the virtual projection image according to the movement information;
and correspondingly marking the speed of the image block according to the motion speed, marking the attribute of the image block as a moving state when the motion speed is greater than zero, and marking the attribute of the image block as a static state when the motion speed is equal to zero.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
constructing an endoscope projection model according to the parameter information of the endoscope to obtain a virtual projection plane of the endoscope;
obtaining a visible area and an invisible area of the operating arm relative to the virtual projection plane according to the motion information of the operating arm and the endoscope projection model;
and projecting the visible region to the virtual projection plane to obtain the virtual projection image containing the visible region.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
at the attributeWhen the image blocks are in the moving state, the weighting parameters of the image blocks with the moving attributes in each frame of image are given, and a weighting parameter set { K) is obtained according to the weighting parameters of the image blocks of the plurality of frames of images at the same position1(M,N),K2(M,N),……,Kn(M,N)In which K is1(M,N)<K2(M,N)<……<Kn(M,N)Or K1(M,N)=K2(M,N)=……=K(n-1)(M,N)<Kn(M,N),Kn(M,N)Representing a weighting parameter, K, of the image block (M, N) in the nth frame imagen(M,N)∈[0,1]。
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
when the attribute is in a moving state, giving the weighting parameters of the image blocks with the attribute in the moving state in each frame of image, and obtaining a weighting parameter set { V ] according to the weighting parameters of the image blocks of the plurality of frames of images at the same position1*K1(M,N),V2*K2(M,N),……,Vn*Kn(M,N)In which V1*K1(M,N)+V2*K2(M,N),+……+Vn*Kn(M,N)=1,Kn(M,N)Representing a weighting parameter, K, of the image block (M, N) in the nth frame imagen(M,N)∈[0,1]And Vn denotes a moving speed or acceleration of the image block (M, N) in the nth frame image.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
calculating the product of the image information of the same image block in different image frames and the corresponding weighting parameters in the weighting parameter group according to the weighting parameter group and the image information of the image block at the same position;
and adding the products of the image blocks at the same position to obtain target image information corresponding to the target image blocks at the same position.
The processor 1001 may also be configured to call an image processing program stored in the memory 1005 and perform the following operations:
acquiring motion information of an operating arm of a surgical robot and parameter information of an endoscope of the surgical robot;
calculating to obtain a first virtual projection image of the operation arm relative to the endoscope according to the motion information of the operation arm and the parameter information of the endoscope, wherein the first virtual projection image comprises a projection image of the operation arm;
dividing the first virtual projection image to obtain a plurality of first image blocks, and determining first attributes of the plurality of first image blocks according to the motion information;
reading an image frame sequence which is acquired by the endoscope and comprises a plurality of frames of images, dividing each frame of image in the image frame sequence to obtain a plurality of second image blocks corresponding to the first image blocks, and matching the first image blocks with the second image blocks to obtain second attributes of the plurality of second image blocks in each frame of image and the first attributes;
performing secondary division on the second image block with the second attribute in the moving state to obtain a plurality of third image blocks;
acquiring the characteristic value and the image information of each second image block and each third image block of each frame image, and determining the third attribute of each third image block according to the characteristic value of each third image block;
determining the weighting parameters of each second image block and each third image block which are not divided secondarily in each frame of image according to the second attribute and the third attribute, and obtaining a weighting parameter group according to the weighting parameters of the image blocks of the plurality of frames of images which are located at the same position;
according to the weighting parameter group and the image information of the image blocks of the multi-frame images, which are positioned at the same position, carrying out weighted average calculation to obtain target image information of the target image blocks corresponding to the same position;
and synthesizing the target image information of the image blocks into a target image frame.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
and when the projection image of the operation arm is obtained, enlarging the projection image of the operation arm by a preset proportion to obtain the first virtual projection image containing the enlarged projection image of the operation arm.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
the method comprises the steps of obtaining a plurality of joint characteristic points of a projected image of the operating arm, using each joint characteristic point as an origin point, using a corresponding preset radius as a circle to obtain a plurality of characteristic circles, obtaining common tangents of two adjacent characteristic circles, and connecting the common tangents to obtain an expanded projected image of the operating arm.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
acquiring motion sensor information of the operating arm, and acquiring motion state, motion speed, motion acceleration and position information of the operating arm according to the motion sensor information;
acquiring a base coordinate system of the surgical robot, and constructing a first motion equation of the operating arm relative to the base coordinate system and a second motion equation of the endoscope relative to the base coordinate system according to the position information;
and calculating the pose information of the operating arm relative to the endoscope according to the first motion equation and the second motion equation.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
constructing an endoscope projection model according to the parameter information of the endoscope to obtain a virtual projection plane of the endoscope;
obtaining a visible area and an invisible area of the operating arm relative to the virtual projection plane according to the motion information of the operating arm and the endoscope projection model;
and projecting the visible region to the virtual projection plane to obtain the first virtual projection image containing the visible region.
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
determining a second attribute of the second image block of each frame of image in the image frame sequence according to the characteristic values of the plurality of second image blocks;
giving the second image block with the second attribute in a static state, obtaining a weighting parameter set { K) according to the weighting parameter of the image block at the same position in the image frame sequence and the weighting parameter in each image frame sequence1(M,N),K2(M,N),……,Kn(M,N)In which K is1(M,N)=K2(M,N)=……=K(n-1)(M,N)=Kn(M,N)=1/n,Kn(M,N)Representing a weighting parameter, K, of said second image block (M, N) in the nth frame imagen(M,N)∈[0,1];
Giving the second image block with the second attribute in a static state, obtaining a weighting parameter set { K 'according to the weighting parameter of the image block located at the same position in the image frame sequence in the weighting parameter in each frame image'1(M’,N’),K’2(M’,N’),……,K’n(M’,N’)Wherein, K'1(M’,N’)=K’2(M’,N’)=……K’(n-1)(M,N)=K’n(M,N)=1/n,K’n(M’,N’)Representing a weighting parameter, K ', of the second image block (M', N ') in the N-th frame image'n(M’,N’)∈[0,1];
Giving the second image block with the second attribute in a moving state, obtaining a weighting parameter set { K 'according to the weighting parameter of the image block located at the same position in the image frame sequence in the weighting parameter in each frame image'1(M,N),K’2(M,N),……,K’n(M,N)Wherein, K'1(M,N)<K’2(M,N)<……<K’n(M,N)Or K'1(M,N)=K’2(M,N)=……=K’(n-1)(M,N)<K’n(M,N),K’n(M,N)Representing a weighting parameter, K ', of the second image block (M', N ') in the N-th frame image'n(M,N)∈[0,1]。
Further, the processor 110 may call up the image processing program of the endoscope stored in the memory 109, and also perform the following operations:
calculating the product of the image information of the image block at the same position in different image frames and the corresponding weighting parameters in the weighting parameter group according to the weighting parameter group, the image information of the second image block which is not secondarily divided and is positioned at the same position and the image information of the plurality of third image blocks positioned at the same position;
and adding the products of each image block to obtain the target image information of the plurality of image blocks.
Referring to fig. 2, in a first embodiment, the present invention provides an image processing method of an endoscope, including the steps of:
step S11, acquiring an image frame sequence comprising a plurality of frames of images, and dividing each frame of image in the image frame sequence to obtain a plurality of image blocks;
in this embodiment, the endoscope may be a common monocular endoscope having one camera, may also be a binocular stereo endoscope having two cameras, and may also be a multi-view stereo endoscope having a plurality of cameras. The number of the specific cameras can be reasonably set according to actual needs.
When images of a preset number of frames M are acquired, the images constitute a sequence of image frames. Wherein the selection of the preset number of frames may be related to a noise frequency of the image and an image output frequency. For example, when the noise frequency is higher, the value of M may be increased; when the noise frequency is low, the value of M can be reduced. When the image output frequency is lower, the value of M can be increased; when the image output frequency is high, the value of M can be reduced.
It can be understood that when each frame image is obtained, the image block division of the current frame image is performed; or when images of a part of frames are acquired, image block division can be carried out on the images at the same time; and when images of a preset number of frames are acquired, image block division can be simultaneously carried out on all the images.
The image block division may be equal division or unequal division. As shown in fig. 3, the image may be equally divided into 24 square image blocks of equal size by an equal division method. As shown in fig. 4, the image may be divided into 4 square sub image blocks with the same size by using an unequal division method, and then 12 square sub image blocks with the same size are obtained by continuing the square division method. As shown in fig. 5, a mode combining equal division and unequal division may be adopted, in which an image is first divided into 6 square sub image blocks a with equal size, then 8 square secondary sub image blocks B with equal size are obtained through square block division, and then 2 secondary sub image blocks among the square secondary sub image blocks B are continuously subjected to square block division to obtain 8 secondary sub image blocks C.
The right side of the upper diagram in fig. 5 is a non-square partition, which includes a vertical partition and a horizontal partition. The lower right sub image block is divided horizontally into 1, 2 two sub image blocks and divided vertically into 3, 4, 5 three sub image blocks. The sub image block on the upper right is divided horizontally and vertically into 6 secondary sub image blocks of equal size. The horizontal division means dividing an object to the image frame into a plurality of identical sub image blocks arranged in a horizontal direction; the vertical division refers to dividing the current image block into a plurality of identical sub image blocks arranged in the vertical direction.
It should be understood that the image blocks are not necessarily regular square structures, and may be other regular shapes or irregular shapes.
The plurality of image blocks may be all image blocks of the current frame image, or may be partial image blocks, such as target image blocks.
Step S12, obtaining the characteristic values and the image information of the image blocks in each frame of image;
in this embodiment, the feature value includes at least one of an RGB value, a gray value, a contour distribution, a corner point, an optical flow, and a motion gradient.
The image information is color component information of pixel points on each coordinate position of the corresponding image block, and the color component information is any one of RGB value, HSV value, HSI value, CMYK value, HSL value, HSB value, Ycc value, XYZ value, Lab value and YUV value corresponding to different color models.
It can be understood that a frame of current image may also be obtained, the current image is subjected to image block division to obtain feature values of a plurality of image blocks, and attributes of each image block, such as a moving state and a static state, are determined. Then, correspondingly adjusting the image block division mode of the next frame of image according to the attributes of each image block, wherein the density of the divided image blocks can be increased if the image characteristic information changes rapidly; the density of divided image blocks can be reduced in an area where the image characteristic information changes slowly.
Step S13, determining the attribute of each image block in the plurality of image blocks in each frame image according to the characteristic values;
in this embodiment, the feature difference between each image block corresponding to the plurality of image blocks in the current frame image and the previous frame image may be calculated to determine the motion attribute of each image block in the image corresponding to the image block, then determine the weighting parameter of each image block in each frame image according to the motion attribute, and obtain the weighting parameter group according to the weighting parameters of the image blocks of the plurality of frames of images located at the same position; the method may further include calculating an average feature value corresponding to each image block in the plurality of image blocks in the image frame sequence, calculating a feature difference value between the feature value of each image block in the current frame image and the average feature value corresponding to each image block to determine a motion attribute of each image block in the image corresponding to each image block, then determining a weighting parameter of each image block in each image frame according to the motion attribute, and obtaining a weighting parameter set according to the weighting parameters of the image blocks of the plurality of images located at the same position.
The specific method for determining the attribute of each image block in each frame of image according to the feature value is the same as above, and is not described herein again. Of course, in other embodiments, the attributes of the image blocks may be determined in combination with other parameter values, or by using other reasonable methods.
Step S14, determining the weighting parameter of each image block in the plurality of image blocks in each frame of image according to the attributes, and obtaining a weighting parameter set according to the weighting parameters of the image blocks of the plurality of frames of images at the same position;
in this embodiment, when the attribute is in the moving state, the weighting parameter of the image block with the attribute in the moving state in each frame of image is given, and a weighting parameter set { K ] is obtained according to the weighting parameter of the image block with the attribute in the same position of the plurality of frames of images1(M,N),K2(M,N),……,Kn(M,N)},Kn(M,N)Representing a weighting parameter, K, of the image block (M, N) in the nth frame imagen(M,N)∈[0,1]。
Wherein, K1(M,N)<K2(M,N)<……<Kn(M,N)Namely, the weighting parameter of the image block (M, N) in the 1 st frame image is smaller than that of the image block (M, N) in the 2 nd frame image, the weighting parameter of the image block (M, N) in the 2 nd frame image is smaller than that of the image block (M, N) in the 3 rd frame image, and so on, the weighting parameter of the image block (M, N) in the nth frame image is the largest, and usually the weighting parameter of the current frame image is the largest.
Or K1(M,N)=K2(M,N)=……=K(n-1)(M,N)<Kn(M,N)I.e. the weighting parameter of the image block (M, N) in the 1 st frame image is equal to the weighting parameter of the image block (M, N) in the 2 nd frame image, the weighting parameter of the image block (M, N) in the 2 nd frame image is equal to the weighting parameter of the image block (M, N) in the 3 rd frame image,and the analogy is carried out until the weighting parameter of the image block (M, N) in the (N-1) th frame image is smaller than that of the image block (M, N) in the nth frame image, and the weighting parameter of the image block (M, N) in the nth frame image is the maximum, and the weighting parameter of the current frame image is usually the maximum.
Or said K1(M,N)=K2(M,N)=……=K(n-1)(M,N)=0,Kn(M,N)The image blocks (M, N) directly adopt the feature values of the image of the nth frame, and the feature values of the image blocks corresponding to other image frames are discarded.
When the attribute is in a static state, giving the weighting parameters of the image blocks with the static state in each frame of image, and obtaining a weighting parameter set { K) according to the weighting parameters of the image blocks of the plurality of frames of images at the same position1(M,N),K2(M,N),……,Kn(M,N)In which K is1(M,N)=K2(M,N)=……=K(n-1)(M,N)=Kn(M,N)=1/n。
In this embodiment, when the attribute is in the still state, the weighting parameter of the image block in the still state in each frame of image is given, and a set of weighting parameters is obtained as { K {, where the set of weighting parameters is obtained according to the weighting parameters of the image blocks in the same position of the multiple frames of images1(M,N),K2(M,N),……,Kn(M,N)},Kn(M,N)Representing a weighting parameter, K, of the image block (M, N) in the nth frame imagen(M,N)∈[0,1]。
Wherein, K1(M,N)=K2(M,N)=……=K(n-1)(M,N)=K n(M,N)1/N, namely the weighting parameters of the image blocks (M, N) in the nth frame image are equal.
It can be understood that, when the weighting parameter group of the image blocks located at the same position in the image frame sequence is obtained and the weighted average calculation is performed on the image frame sequence, the specific calculation manner is as follows:
according to the weighting parameter group and the image information of the image blocks at the same position, carrying out weighted average calculation to obtain a pairThe target image information of the target image block corresponding to the same position is F(M,N):
F(M,N)=K1*f(i+1)+K2*f(i+2)+…+Kn*f(i+N);
Wherein f (i + N) represents image information of an image block corresponding to each frame of image; k1、K2… Kn are weighting parameters of image blocks at the same position in different image frames in the image frame sequence, and have a value range of [0, 1%]。
Step S15, carrying out weighted average calculation according to the weighted parameter group and the image information of the image blocks at the same position of the multi-frame image to obtain target image information of the plurality of image blocks;
and step S16, combining the target image information of the plurality of image blocks into a target image frame.
In this embodiment, according to the weighting parameter set and the image information of the image blocks located at the same position, the products of the image information of the image blocks located at the same position in different image frames and the corresponding weighting parameters in the weighting parameter set are calculated, and then the products of the image blocks located at the same position are added to obtain the target image information of the target image block corresponding to the same position. It will be appreciated that other information, such as the location of the image blocks, may also be incorporated when compositing the target image frames.
It is to be understood that the same location as referred to in the present invention refers to an image block with the same coordinates between different image frames in the image frame sequence. Of course, the image blocks located at the same position may have the same size or different sizes. That is, the image block division modes between different images may be the same or approximately the same.
The endoscope image processing method obtains a plurality of image blocks by obtaining an image frame sequence comprising a plurality of frames of images and dividing each frame of image in the image frame sequence, then obtains characteristic values and image information of the image blocks in each frame of image, determines a weighting parameter of each image block in each frame of image according to the attributes, obtains a weighting parameter group according to the weighting parameters of the image blocks at the same position in the image frame sequence, further obtains target image information of the image blocks by carrying out weighted average calculation according to the weighting parameter group and the image information of the image blocks at the same position in the plurality of frames of images, and finally synthesizes the target image information of the image blocks into a target image frame. Therefore, the weighting parameters corresponding to different image frames are given to each image block according to the attributes of the image blocks, and the trailing phenomenon of the image can be prevented when a moving object with higher moving speed exists in the image through the weighted average of the different weighting parameters.
In the second embodiment, based on the first embodiment, the step S131 includes:
step 1311, calculating a feature difference value between each corresponding image block of the plurality of image blocks of the current frame image and the previous frame image according to the feature values of the plurality of image blocks of each frame image;
in this embodiment, any one, two or more than two feature values of RGB values, gray values, contour distributions, corner points, optical flows, and motion gradients may be selected to calculate corresponding feature difference values.
Taking the gray level feature difference value Sy obtained by calculation as an example, Sy ═ Syi-Syi-1And i denotes an ith frame image.
It is to be understood that when two or more feature values are selected, a feature difference value of each of the two or more feature values may be calculated, respectively; it is also possible to calculate the respective feature difference values of two or more feature values, respectively, and then fit the calculated two or more difference values into one composite feature difference value.
Step 1312, when the feature difference is greater than a first preset threshold, determining that the attribute of the image block is in a moving state;
step 1313, when the feature difference is smaller than or equal to the first preset threshold, determining that the attribute of the image block is in a static state.
In this embodiment, when a feature value is selected, comparing the calculated feature difference with a corresponding first preset threshold, and if the feature difference is greater than the first preset threshold, determining that the attribute of the image block is in a moving state; and if the characteristic difference value is smaller than or equal to the first preset threshold, determining that the attribute of the image block is in a static state.
When two or more than two characteristic values are selected, respectively calculating respective characteristic difference values of the two or more characteristic values, and if any one of the characteristic difference values is larger than the corresponding first preset threshold, determining that the attribute of the image block is in a moving state; otherwise, if any of the feature difference values is smaller than or equal to the first preset threshold, determining that the attribute of the image block is in a static state. Or if all the characteristic difference values are larger than the first preset threshold value corresponding to the characteristic difference values, determining that the attribute of the image block is in a moving state; otherwise, if all the feature difference values are smaller than or equal to the first preset threshold value corresponding to each feature difference value, determining that the attribute of the image block is in a static state.
When two or more than two characteristic values are selected and a comprehensive characteristic difference value is obtained through calculation, the comprehensive characteristic difference value obtained through calculation is compared with a corresponding first preset threshold, and if the comprehensive characteristic difference value is larger than the first preset threshold, the attribute of the image block is determined to be in a moving state; and if the comprehensive characteristic difference value is smaller than or equal to the first preset threshold, determining that the attribute of the image block is in a static state.
In the third embodiment, based on the first embodiment, the step S13 includes:
step S133, calculating an average feature value corresponding to each image block in the image frame sequence according to the feature values of the image blocks in each frame of image;
in this embodiment, any one, two or more than two feature values of RGB values, gray values, contour distributions, corner points, optical flows, and motion gradients may be selected to calculate the corresponding average feature difference value.
Taking the calculation of the average characteristic value of the gray scale as an example,i represents the ith frame image.
Step S134, calculating a characteristic difference value between the characteristic value of each image block in the current frame image and the corresponding average characteristic value;
in this embodiment, the gray scale feature difference Sy obtained by calculation is taken as an example, where Sy is Syi-(Syi-1+Syi-2+…Syi-n) And/n, i represents the ith frame image.
It is to be understood that when two or more feature values are selected, a feature difference value of each of the two or more feature values may be calculated, respectively; it is also possible to calculate the respective feature difference values of two or more feature values, respectively, and then fit the calculated two or more difference values into one composite feature difference value.
Step S135, when the characteristic difference value is larger than a second preset threshold value, determining that the attribute of the image block is in a moving state;
step S136, when the feature difference is smaller than or equal to the second preset threshold, determining that the attribute of the image block is in a static state.
In this embodiment, when a feature value is selected, comparing the calculated feature difference with a corresponding second preset threshold, and if the feature difference is greater than the second preset threshold, determining that the attribute of the image block is in a moving state; and if the characteristic difference value is smaller than or equal to the second preset threshold, determining that the attribute of the image block is in a static state.
When two or more than two characteristic values are selected, respectively calculating respective characteristic difference values of the two or more characteristic values, and if any one of the characteristic difference values is larger than the corresponding second preset threshold, determining that the attribute of the image block is in a moving state; otherwise, if any of the feature difference values is smaller than or equal to the second preset threshold, determining that the attribute of the image block is in a static state. Or if all the characteristic difference values are larger than the second preset threshold value corresponding to the characteristic difference values, determining that the attribute of the image block is in a moving state; otherwise, if all the feature difference values are smaller than or equal to the second preset threshold value corresponding to each feature difference value, determining that the attribute of the image block is in a static state.
When two or more than two characteristic values are selected and a comprehensive characteristic difference value is obtained through calculation, the comprehensive characteristic difference value obtained through calculation is compared with a corresponding second preset threshold, and if the comprehensive characteristic difference value is larger than the second preset threshold, the attribute of the image block is determined to be in a moving state; and if the comprehensive characteristic difference value is smaller than or equal to the second preset threshold, determining that the attribute of the image block is in a static state.
Referring to fig. 6, in a fifth embodiment, the present invention also provides an image processing method of an endoscope, including the steps of:
step S21, acquiring motion information of an operation arm of a surgical robot and parameter information of an endoscope of the surgical robot;
in the present embodiment, as shown in fig. 7, the surgical robot generally includes a master console 1 and a slave operation device 2, the master console 1 is configured to send a control command to the slave operation device according to the operation of the doctor to control the slave operation device 2; the slave operation device 2 is used for responding to the control command sent by the master operation table 1 and performing corresponding operation. The slave operation device 2 comprises a mechanical arm 21, a power mechanism 22 arranged on the mechanical arm and an operation arm 23, wherein the operation arm 23 is used for extending into the body under the driving action of the power mechanism 22, performing operation through a terminal instrument at the far end of the operation arm and/or acquiring in-vivo images through an endoscope at the far end of the operation arm. The main console 1 is also used for displaying images acquired by the operating equipment.
As shown in fig. 8 (for single-hole surgery) and fig. 9 (for multi-hole surgery), the distal end of the operation arm 23 is connected with a distal end instrument 25 or an endoscope 26. The motion sensor 27, such as a position sensor, a velocity sensor, a displacement sensor, a magnetic sensor, a force sensor, etc., may acquire motion sensor information of a plurality of motion sensors of the operation arm, and then obtain at least one of motion information of a motion state, a motion velocity, a motion acceleration, position information, and pose information of the operation arm from the motion sensor information. Of course, the motion information may also include: joint information (including joint node coordinates, joint length), movement information, terminal opening and closing information, terminal stress information and the like, and at this time, geometric information, diameter and the like of the operating arm need to be acquired. The parameter information of the endoscope includes at least one of a field angle, a focal length, and an offset amount of the endoscope.
The mode of acquiring the pose information in the motion information may be as follows: and acquiring a base coordinate system of the surgical robot, constructing a first motion equation of the operating arm relative to the base coordinate system and a second motion equation of the endoscope relative to the base coordinate system according to the position information, and calculating the pose information of the operating arm relative to the endoscope according to the first motion equation and the second motion equation. The base coordinate system may be selected from a plurality of positions of the surgical robot, as shown in fig. 10 (suitable for single-hole surgery) and fig. 11 (suitable for multi-hole surgery), a coordinate system { a } may be used as the base coordinate system, or a stationary coordinate system of a structure having no relative motion during motion, such as a coordinate system { B } of a robot arm0Or the coordinate system of the endoscope { Bc }0As the base coordinate system.
Taking the coordinate system { B } as a base coordinate system, and then calculating a coordinate transformation matrix of the operating arm relative to the base coordinate system { B }, so as to obtain the first equation of motion:
wherein,tna coordinate system representing the n-th characteristic point on the operation arm, n representing the characteristic point tnThe number of the link where it is located. In this embodiment, n is 3.
Calculating a coordinate transformation matrix from the coordinate system { C } of the endoscope to the base coordinate system { B }, and obtaining the second motion equation:
wherein,c denotes a coordinate system of the endoscope, and m denotes the number of links on the operation arm.
And then according to the first motion equation and the second motion equation, calculating a coordinate transformation matrix of the operating arm relative to the endoscope to obtain the pose information:
it will be understood that the characteristic points are predetermined characteristic points on the links, typically at or between the joints of the operating arm.
Step S22, calculating to obtain a virtual projection image of the operation arm relative to the endoscope according to the motion information of the operation arm and the parameter information of the endoscope;
in this embodiment, an endoscope projection model may be constructed according to the parameter information of the endoscope, and then a virtual projection image of the operation arm with respect to the endoscope is calculated according to the endoscope projection model and the motion information of the operation arm.
Specifically, the step S22 may further include:
s221, constructing an endoscope projection model according to the parameter information of the endoscope to obtain a virtual projection plane of the endoscope;
in this embodiment, a four-sided pyramid with the position of the endoscope as a vertex may be constructed according to at least one of the parameter information of the endoscope, such as the angle of view, the focal length, and the offset, and the bottom surface of the four-sided pyramid is the virtual projection plane of the endoscope. Of course, in other embodiments, other types of projection models may also be constructed.
Step S222, obtaining a visible area and an invisible area of the operation arm relative to the virtual projection plane according to the motion information of the operation arm and the endoscope projection model;
in this embodiment, the visible region and the invisible region of each joint of the operation arm on the virtual projection plane can be obtained from the coordinates of each joint node with respect to the endoscope. Of course, in other embodiments, the visible area and the invisible area of each joint on the virtual projection plane may be further accurately determined by combining with other information, such as the diameter of the operating arm, the length of the joint, and the like.
Step S223, projecting the visible region to the virtual projection plane to obtain the virtual projection image including the visible region.
In this embodiment, when the visible region of the operation arm is obtained, the visible region of the operation arm is correspondingly projected onto the virtual projection plane, so that the virtual projection image including the visible region is obtained as shown in fig. 12. It should be understood that the virtual projection plane mentioned in the present invention is a blank virtual projection image before the projection of the operation arm, and the virtual projection image including the projection image of the operation arm is formed after the visible region of the operation arm is projected onto the virtual projection plane.
Step S23, dividing the virtual projection image to obtain a plurality of image blocks, and determining first attributes of the image blocks according to the motion information;
in this embodiment, the dividing manner of the virtual projection image may be equal dividing and unequal dividing, and the specific manner is the same as above, and is not described here again.
And determining first attributes of the image blocks according to the motion information, wherein the description of the first attributes can be in a moving state and a static state, can also be in a fast motion state, a slow motion state and a static state, and can also be in a motion speed or acceleration identification mode.
As shown in fig. 14, taking an example that the first attribute includes a moving state and a stationary state, "√" indicates that the first attribute of the image block is a moving state; "x" indicates that the first attribute of the image block is a still state.
Step S24, reading an image frame sequence which is obtained by the endoscope and comprises a plurality of frames of images, dividing each frame of image in the image frame sequence to obtain a plurality of image blocks, and obtaining characteristic values and image information of the plurality of image blocks;
in this embodiment, when images of a preset number of frames M are acquired, the images constitute an image frame sequence. Wherein the selection of the preset number of frames may be related to a noise frequency of the image and an image output frequency. For example, when the noise frequency is higher, the value of M may be increased; when the noise frequency is low, the value of M can be reduced. When the image output frequency is lower, the value of M can be increased; when the image output frequency is high, the value of M can be reduced.
In this embodiment, it should be understood that the image blocks of the image frame sequence are divided in the same manner as the image blocks of the virtual projection image. Of course, in other embodiments, if the image block division manners of the two are partially the same, the image block division manners of the two may also be different. The characteristic value comprises at least one of RGB value, gray value, contour distribution, corner point, optical flow and motion gradient. The image information is color component information of pixel points on each coordinate position of the corresponding image block, and the color component information is any one of RGB value, HSV value, HSI value, CMYK value, HSL value, HSB value, Ycc value, XYZ value, Lab value and YUV value corresponding to different color models.
Step S25, matching the image blocks of the virtual projection image with the image blocks of the multi-frame image to obtain a second attribute corresponding to the first attribute of each image block in each frame image;
in this embodiment, each frame of image in the image frame sequence is subjected to one-to-one attribute matching with the image blocks with the same coordinate position of the virtual projected image. As shown in fig. 15, taking a current frame as an example, attribute one-to-one matching is performed on image blocks of the current frame and the virtual projection image, that is, attributes of the image blocks (M, N) of the current frame are the same as those of the image blocks (M, N) of the virtual projection image.
Step S26, determining a weighting parameter of each image block in the plurality of image blocks in each frame of image according to the second attribute, and obtaining a set of weighting parameters according to the weighting parameters of the image blocks of the plurality of frames of images at the same position;
in this embodiment, taking an example that the second attribute includes a moving state and a static state, when the second attribute is in the moving state, the weighting parameter of the image block with the second attribute in the moving state in each frame of image is given, and the weighting parameter group is { K { (K) } according to the weighting parameter of the image block with the same position in the multiple frames of images1(M,N),K2(M,N),……,Kn(M,N)},Kn(M,N)Representing a weighting parameter, K, of the image block (M, N) in the nth frame imagen(M,N)∈[0,1]。
Wherein, K1(M,N)<K2(M,N)<……<Kn(M,N)Namely, the weighting parameter of the image block (M, N) in the 1 st frame image is smaller than that of the image block (M, N) in the 2 nd frame image, the weighting parameter of the image block (M, N) in the 2 nd frame image is smaller than that of the image block (M, N) in the 3 rd frame image, and so on, the weighting parameter of the image block (M, N) in the nth frame image is the largest, and usually the weighting parameter of the current frame image is the largest.
Or K1(M,N)=K2(M,N)=……=K(n-1)(M,N)<Kn(M,N)That is, the weighting parameter of the image block (M, N) in the 1 st frame image is equal to the weighting parameter of the image block (M, N) in the 2 nd frame image, the weighting parameter of the image block (M, N) in the 2 nd frame image is equal to the weighting parameter of the image block (M, N) in the 3 rd frame image, and so on until the weighting parameter of the image block (M, N) in the (N-1) th frame image is smaller than the weighting parameter of the image block (M, N) in the nth frame image, the weighting parameter of the image block (M, N) in the nth frame image is the largest, usually the weighting parameter of the current frame image is the largest。
Or said K1(M,N)=K2(M,N)=……=K(n-1)(M,N)=0,Kn(M,N)The image blocks (M, N) directly adopt the feature values of the image of the nth frame, and the feature values of the image blocks corresponding to other image frames are discarded.
When the second attribute is in a static state, giving the weighting parameters of the image blocks with the static state as the second attribute in each frame of image, and obtaining a weighting parameter set { K) according to the weighting parameters of the image blocks with the same position in the plurality of frames of images1(M,N),K2(M,N),……,Kn(M,N)In which K is1(M,N)=K2(M,N)=……=K(n-1)(M,N)=Kn(M,N)=1/n。
In this embodiment, when the second attribute is in a static state, the weighting parameter in each frame of image is given to the image block with the second attribute in the static state, and a set of weighting parameters { K ] is obtained according to the weighting parameters of the image blocks of the multiple frames of images at the same position1(M,N),K2(M,N),……,Kn(M,N)},Kn(M,N)Representing a weighting parameter, K, of the image block (M, N) in the nth frame imagen(M,N)∈[0,1]。
Wherein, K1(M,N)=K2(M,N)=……=K(n-1)(M,N)=K n(M,N)1/N, namely the weighting parameters of the image blocks (M, N) in the nth frame image are equal.
Taking the second attribute as the motion speed or the acceleration as an example, the weighting parameter group { V ] of the image block in the image frame sequence is given to the image block1*K1(M,N),V2*K2(M,N),……,Vn*Kn(M,N)In which V1*K1(M,N)+V2*K2(M,N),+……+Vn*Kn(M,N)=1,Kn(M,N)Representing a weighting parameter, K, of the image block (M, N) in the nth frame imagen(M,N)∈[0,1]And Vn denotes a moving speed or acceleration of the image block (M, N) in the nth frame image.
Step S27, carrying out weighted average calculation according to the weighted parameter group and the image information of the image blocks at the same position of the multi-frame image to obtain target image information of the plurality of image blocks;
in this embodiment, according to the weighting parameter set and the image information of the image blocks located at the same position, the products of the image information of the image blocks located at the same position in different image frames and the corresponding weighting parameters in the weighting parameter set are calculated, and then the products of the image blocks located at the same position are added to obtain the target image information of the target image block corresponding to the same position. It will be appreciated that other information, such as the location of the image blocks, may also be incorporated when compositing the target image frames.
When obtaining the weighting parameter group of the image blocks located at the same position in the image frame sequence and performing weighted average calculation on the image frame sequence, the specific calculation method is as follows:
according to the weighting parameter group and the characteristic value of the image block at the same position, carrying out weighted average calculation to obtain target image information F corresponding to the target image block at the same position(M,N):
F(M,N)=K1*f(i+1)+K2*f(i+2)+…+Kn*f(i+N);
Wherein f (i + N) represents image information of an image block corresponding to each frame of image; k1、K2… Kn are weighting parameters of image blocks at the same position in different image frames in the image frame sequence, and have a value range of [0, 1%]。
And step S28, combining the target image information of the plurality of image blocks into a target image frame.
In this embodiment, when obtaining target image information of a plurality of target image blocks, the plurality of target image blocks are combined into a new target image frame. In the embodiment, the weighting parameters corresponding to different image frames are given to each image block according to the image information of the image block, so that when a moving object with a high moving speed exists in the image, the trailing phenomenon of the image can be prevented.
The image processing method of the endoscope comprises the steps of obtaining motion information of an operating arm of the surgical robot and parameter information of the endoscope of the surgical robot, calculating to obtain a virtual projection image of the operating arm relative to the endoscope, dividing the virtual projection image to obtain a plurality of image blocks, determining first attributes of the image blocks according to the motion information, reading an image frame sequence which comprises a plurality of frames of images and is obtained by the endoscope, dividing each frame of image in the image frame sequence to obtain a plurality of image blocks, obtaining characteristic values and image information of the image blocks, matching the image blocks of the virtual projection image with the image blocks of the plurality of frames of images to obtain second attributes of each image block in each frame of image corresponding to the first attributes, and determining a weighting parameter of each image block in the plurality of image blocks in each frame of image according to the second attribute, obtaining a weighting parameter group according to the weighting parameter of the image block of the multi-frame image at the same position, performing weighted average calculation according to the weighting parameter group and the image information of the image block of the multi-frame image at the same position to obtain target image information of the plurality of image blocks, and finally synthesizing the target image information of the plurality of image blocks into a target image frame. Therefore, the weighting parameters corresponding to different image frames are given to each image block according to the attributes of the image blocks, and the trailing phenomenon of the image can be prevented when a moving object with higher moving speed exists in the image through the weighted average of the different weighting parameters.
In the sixth embodiment, based on the fifth embodiment, the step of determining the attributes of the plurality of image blocks according to the motion information in step S23 includes:
step S231, when the motion information is in a motion state, determining a motion operation arm and a static operation arm according to the motion state;
in this embodiment, the motion state includes a moving state and a stationary state. As shown in fig. 16, the moving operation arm and the stationary operation arm may be identified according to the moving state or the stationary state of the operation arm.
Step S232, obtaining a moving image block of the moving operation arm on the virtual projection image, correspondingly marking the attribute of the moving image block as a moving state, obtaining a static image block of the static operation arm on the virtual projection image, and correspondingly marking the attribute of the static image block as a static state.
In this embodiment, as shown in fig. 17, image blocks on the virtual projection image of the moving operation arm are obtained as (1, 1), (1, 2), (2, 2), and (2, 3), respectively, and attributes of these image blocks are correspondingly marked as a moving state, which is represented by "√" in this specification; the image blocks of the static operating arm on the virtual projection image are acquired as (5, 2), (5, 3), (6, 1) and (6, 2), respectively, and the attributes of the image blocks are marked as static states, which are indicated by "x".
In the seventh embodiment, based on the fifth embodiment, the step of determining the attributes of the plurality of image blocks according to the motion information in step S23 includes:
step S233, when the motion information is the motion speed or the motion acceleration, determining a motion operation arm and a static operation arm according to the motion speed or the motion acceleration;
in this embodiment, the moving operation arm and the stationary operation arm may be determined directly according to the movement velocity or the movement acceleration of the operation arm. For example, when the movement speed or the movement acceleration is zero, the operating arm is determined to be a stationary operating arm, and conversely, when the movement speed or the movement acceleration is greater than zero, the operating arm is determined to be a moving operating arm.
Step S234, obtaining an image block of the moving operating arm on the virtual projection image, and correspondingly marking the moving speed or the moving acceleration of the moving image block and the attribute of the moving image block as a moving state, obtaining a stationary image block of the stationary operating arm on the virtual projection image, and correspondingly marking the attribute of the stationary image block as a stationary state.
In this embodiment, as in the above embodiment, image blocks of the moving operating arm on the virtual projection image are obtained, and attributes of the image blocks are correspondingly marked as a moving state, which is represented by "√" shape; and acquiring image blocks of the static operating arm on the virtual projection image, and respectively marking the attributes of the image blocks as static states, wherein the attributes are represented by 'x'.
In other embodiments, the motion speed or the motion acceleration of the image block may be directly marked on the corresponding image block in combination with the magnitude of the motion speed or the motion acceleration, so as to determine the weighting parameter set according to different motion speeds or motion accelerations.
In other embodiments, a movement speed of the projection point of the operating arm on the virtual projection image may also be calculated according to the movement information, and a speed of the image block is correspondingly marked according to the movement speed, and when the movement speed is greater than zero, an attribute of the image block is marked as a moving state, which is represented by "√"; and when the motion speed is equal to zero, marking the attribute of the image block as a static state, and representing by an X. It should be understood that the projection points of the operating arm on the virtual projection plane are multiple, and the projection points corresponding to different positions have different movement speeds. Specifically, the feature point of the operating arm may be preset, the movement speed of the feature point of the operating arm on the virtual projection plane is obtained, and the movement speed of the projection point of the operating arm on the virtual projection image is obtained by calculation according to a position differentiation method. Of course, the method of position differentiation is not limited in other embodiments, and other reasonable methods are also possible.
It is understood that, according to the acquired motion information of the operating arm, the motion speed of the operating arm can be calculated by using a positive kinematic jacobian matrix.
In other embodiments, when the endoscope is detected to move, the virtual projection plane may be considered to be moving, so that all image blocks may be marked as moving; the movement speed of the image block can be correspondingly marked according to the movement speed of the operation arm; the relative motion relationship between the endoscope and the operation arm can also be calculated, and at the moment, different projection points of the operation arm have different motion speeds relative to the virtual projection plane, so that different motion speeds can be marked on corresponding different image blocks.
Referring to fig. 18, in a ninth embodiment, the present invention also provides an image processing method of an endoscope, including the steps of:
step S31, acquiring motion information of an operation arm of a surgical robot and parameter information of an endoscope of the surgical robot;
in the present embodiment, as shown in fig. 7, the surgical robot generally includes a master console 1 and a slave operation device 2, the master console 1 is configured to send a control command to the slave operation device according to the operation of the doctor to control the slave operation device 2; the slave operation device 2 is used for responding to the control command sent by the master operation table 1 and performing corresponding operation. The slave operation device 2 comprises a mechanical arm 21, a power mechanism 22 arranged on the mechanical arm and an operation arm 23, wherein the operation arm 23 is used for extending into the body under the driving action of the power mechanism 22, performing operation through a terminal instrument at the far end of the operation arm and/or acquiring in-vivo images through an endoscope at the far end of the operation arm. The main console 1 is also used for displaying images acquired by the operating equipment.
As shown in fig. 8 (for single-hole surgery) and fig. 9 (for multi-hole surgery), the distal end of the operation arm 23 is connected with a distal end instrument 25 or an endoscope 26. The motion sensor 27, such as a position sensor, a velocity sensor, a displacement sensor, a magnetic sensor, a force sensor, etc., may acquire motion sensor information of a plurality of motion sensors of the operation arm, and then obtain at least one of motion information of a motion state, a motion velocity, a motion acceleration, position information, and pose information of the operation arm from the motion sensor information. Of course, the motion information may also include: joint information (including joint node coordinates, joint length), movement information, terminal opening and closing information, terminal stress information and the like, and at this time, geometric information, diameter and the like of the operating arm need to be acquired. The parameter information of the endoscope includes at least one of a field angle, a focal length, and an offset amount of the endoscope.
The mode of acquiring the pose information in the motion information may be as follows: and acquiring a base coordinate system of the surgical robot, constructing a first motion equation of the operating arm relative to the base coordinate system and a second motion equation of the endoscope relative to the base coordinate system according to the position information, and calculating the pose information of the operating arm relative to the endoscope according to the first motion equation and the second motion equation. The base coordinate system may be selected from a plurality of positions of the surgical robot, as shown in fig. 10 (suitable for single-hole surgery) and fig. 11 (suitable for multi-hole surgery), a coordinate system { a } may be used as the base coordinate system, or a stationary coordinate system of a structure having no relative motion during motion, such as a coordinate system { B } of a robot arm0Or the coordinate system of the endoscope { Bc }0As the base coordinate system.
Taking the coordinate system { B } as a base coordinate system, and then calculating a coordinate transformation matrix of the operating arm relative to the base coordinate system { B }, so as to obtain the first equation of motion:
wherein,tna coordinate system representing the n-th characteristic point on the operation arm, n representing the characteristic point tnThe number of the link where it is located. In this embodiment, n is 3.
Calculating a coordinate transformation matrix from the coordinate system { C } of the endoscope to the base coordinate system { B }, and obtaining the second motion equation:
wherein,c denotes a coordinate system of the endoscope, and m denotes the number of links on the operation arm.
And then according to the first motion equation and the second motion equation, calculating a coordinate transformation matrix of the operating arm relative to the endoscope to obtain the pose information:
it will be understood that the characteristic points are predetermined characteristic points on the links, typically at or between the joints of the operating arm.
Step S32, calculating a first virtual projection image of the operation arm relative to the endoscope according to the motion information of the operation arm and the parameter information of the endoscope, wherein the first virtual projection image comprises a projection image of the operation arm;
in this embodiment, an endoscope projection model may be constructed according to parameter information of the endoscope, and then a first virtual projection image of the operation arm with respect to the endoscope is calculated according to the endoscope projection model and motion information of the operation arm, where the first virtual projection image includes a projection image of the operation arm.
Specifically, the step S32 may further include:
s321, constructing an endoscope projection model according to the parameter information of the endoscope to obtain a virtual projection plane of the endoscope;
in this embodiment, a four-sided pyramid with the position of the endoscope as a vertex may be constructed according to at least one of the parameter information of the endoscope, such as the angle of view, the focal length, and the offset, and the bottom surface of the four-sided pyramid is the virtual projection plane of the endoscope. Of course, in other embodiments, other types of projection models may also be constructed.
Step S322, obtaining a visible area and an invisible area of the operation arm relative to the virtual projection plane according to the motion information of the operation arm and the endoscope projection model;
in this embodiment, the visible region and the invisible region of each joint of the operation arm on the virtual projection plane can be obtained from the coordinates of each joint node with respect to the endoscope. Of course, in other embodiments, the visible area and the invisible area of each joint on the virtual projection plane may be further accurately determined by combining with other information, such as the diameter of the operating arm, the length of the joint, and the like.
Step S323, projecting the visible region to the virtual projection plane to obtain the first virtual projection image including the visible region.
In this embodiment, when the visible region of the operation arm is obtained, the visible region of the operation arm is correspondingly projected onto the first virtual projection plane, so that the first virtual projection image including the visible region is obtained as shown in fig. 12.
Step S33, dividing the first virtual projection image to obtain a plurality of first image blocks, and determining first attributes of the plurality of first image blocks according to the motion information;
in this embodiment, the dividing manner of the first virtual projection image may be equal dividing and unequal dividing, and the specific manner is the same as above, and is not described here again. However, the difference from the previous embodiment is that the size of the plurality of first image blocks is larger than that of the plurality of image blocks in the other embodiments described above, so as to roughly divide the first virtual projection image.
And determining first attributes of the image blocks according to the motion information, wherein the description of the first attributes can be in a moving state and a static state, can also be in a fast motion state, a slow motion state and a static state, and can also be in a motion speed or acceleration identification mode. Taking the first attribute comprising a moving state and a static state as an example, the "√" indicates that the first attribute of the image block is the moving state; "x" indicates that the first attribute of the image block is a still state.
In another embodiment, when obtaining the projection image of the operation arm, the projection image of the operation arm is enlarged by a predetermined ratio to obtain the first virtual projection image including the enlarged projection image of the operation arm. The enlargement of the preset ratio may be:
and amplifying the complete projection image of the operating arm at a preset ratio. As shown in fig. 13, a plurality of joint feature points a, b, c, etc. of the projection image of the operating arm may be acquired, each joint feature point being a joint center point of the operating arm, and then a plurality of feature circles may be obtained by rounding each corresponding preset radius with each joint feature point being an origin, specifically: respectively takes a as the center of a circle and the radius R1Making a circle; using b as the center of circle and radius R2Making a circle; c is taken as the center of a circle, and the radius R is taken3And (5) making a circle to obtain three circles. Then obtaining the common tangent L of two adjacent characteristic circles1And L2A plurality of said common tangents such as L1And L2And connecting to obtain an enlarged projection image of the operating arm. It will be appreciated that each radius R1、R2、R3The proportional relationship between the initial radius R0 and the corresponding characteristic point of each joint1、R02、R03The proportional relationship between the two is equal, for example: if R01:R02:R03When 1:1.2:1.5, then R1:R2:R31:1.2: 1.5. It is understood that a feature point d of the projection image of the operating arm at the boundary of the virtual projection image may also be acquired, and a radius R may be taken from the feature point as a center of a circle4A circle (not shown) is made, then the common tangent of two adjacent characteristic circles is made and connected. Since the present embodiment expands the projection image of the operation arm, the determination of the image block attribute is more accurate compared to the projection image of the operation arm without expansion.
Step S34, reading an image frame sequence which is obtained by the endoscope and comprises a plurality of frames of images, dividing each frame of image in the image frame sequence to obtain a plurality of second image blocks corresponding to the first image blocks, and matching the first image blocks with the second image blocks to obtain second attributes corresponding to the plurality of second image blocks and the first attributes in each frame of image;
in this embodiment, it should be understood that the image block division manner of each frame of image in the image frame sequence is the same as or similar to the second image block division manner of the first virtual projection image. And performing attribute one-to-one matching on the first image blocks of each frame of image and the first virtual projected image, wherein the coordinate positions of the first image blocks of each frame of image are the same, that is, the attributes of the first image block (M, N) of each frame of image are the same as the attributes of the first image block (M, N) of the first virtual projected image. The description of the attribute may be in a moving state and a stationary state, or in a fast moving state, a slow moving state, and a stationary state, or in an identification manner of a moving speed or an acceleration, and the like. The following embodiment is described taking as an example that the second attribute includes a moving state and a stationary state.
In this embodiment, when images of a preset number of frames M are acquired, the images constitute an image frame sequence. Wherein the selection of the preset number of frames may be related to a noise frequency of the image and an image output frequency. For example, when the noise frequency is higher, the value of M may be increased; when the noise frequency is low, the value of M can be reduced. When the image output frequency is lower, the value of M can be increased; when the image output frequency is high, the value of M can be reduced.
Step S35, performing secondary division on the second image block with the second attribute being in the moving state to obtain a plurality of third image blocks;
in this embodiment, when the second attribute of the second image block is in a moving state, the second image block of each frame of image is divided twice, and it can be understood that the second image block may be divided equally or unequally. The specific manner is the same as that of the first embodiment, and is not described herein again. And the other second image blocks with the second attribute of being in the static state are not divided for the second time.
Step S36, obtaining the characteristic value and image information of each second image block and each third image block of each frame of image, and determining the third attribute of each third image block according to the characteristic value of each third image block;
in this embodiment, the feature values of each second image block and each third image block in each frame of image, which are not sub-divided, may include at least one of RGB values, gray values, contour distributions, corner points, optical flows, and motion gradients. Specifically, the image information may be color component information of a pixel point at each coordinate position of the corresponding image block, where the color component information is any one of an RGB value, an HSV value, an HSI value, a CMYK value, an HSL value, an HSB value, a Ycc value, an XYZ value, a Lab value, and a YUV value corresponding to different color models.
Similarly, the description of the third attribute may be a moving state and a stationary state, and may also be a fast moving state, a slow moving state and a stationary state, and may also be an identification of a moving speed or an acceleration, and the like. And will not be described in detail herein.
Step S37, determining, according to the second attribute and the third attribute, a weighting parameter of each second image block and each third image block in each frame of image, which are not divided twice, and obtaining a set of weighting parameters according to the weighting parameters of the image blocks of the multiple frames of images located at the same position;
in this embodiment, a feature difference between each corresponding image block of the plurality of second image blocks or the plurality of third image blocks corresponding to the current frame image and the previous frame image may be calculated to determine a motion attribute of each image block in the image corresponding to the current frame image, then determine a weighting parameter of each image block in each frame image according to the motion attribute, and obtain a weighting parameter set according to the weighting parameters of the image blocks of the plurality of frames of images located at the same position; the method may further include calculating an average feature value corresponding to each of the second image blocks or the third image blocks in the image frame sequence, calculating a feature difference between the feature value of each image block in the current frame image and the average feature value corresponding to each image block to determine a motion attribute of each image block in the image corresponding to each image block, determining a weighting parameter of each image block in each image frame according to the motion attribute, and obtaining a weighting parameter group according to the weighting parameters of the image blocks of the multiple frames of images at the same position.
Specifically, since the attributes of the plurality of second image blocks that are not sub-divided are all in a still state, the weighting parameter set { K } in the image frame sequence may be given to the second image blocks that are not sub-divided1(M,N),K2(M,N),……,Kn(M,N)In which K is1(M,N)=K2(M,N)=……=K(n-1)(M,N)=Kn(M,N)=1/n,Kn(M,N)Representing a weighting parameter, K, of said second image block (M, N) in the nth frame imagen(M,N)∈[0,1]。
When the second attribute of the second image block is in a moving state, a plurality of third image blocks obtained by performing secondary division on the second image block may be different in attribute, such as a partially moving state and a partially stationary state, due to refinement of the second image block.
When the attributes of the plurality of third image blocks are in a static state, giving the weighting parameters of the third image blocks with the attributes in the static state in each frame of image, and obtaining a weighting parameter set { K 'according to the weighting parameters of the image blocks of the plurality of frames of images at the same position'1(M’,N’),K’2(M’,N’),……,K’n(M’,N’)Wherein, K'1(M’,N’)=K’2(M’,N’)=……K’(n-1)(M,N)=K’n(M,N)=1/n,K’n(M’,N’)Representing a weighting parameter, K ', of said third image block (M', N ') in the N-th frame image'n(M’,N’)∈[0,1]。
When the attributes of the plurality of third image blocks are in a moving state, giving the weighting parameters of the third image blocks with the attributes in the moving state in each frame of image, and obtaining a weighting parameter set { K 'according to the weighting parameters of the image blocks of the plurality of frames of images at the same position'1(M’,N’),K’2(M’,N’),……,K’n(M’,N’)},K’n(M’,N’)Representing a weighting parameter, K ', of said third image block (M', N ') in the N-th frame image'n(M’,N’)∈[0,1]。
Wherein, K'1(M’,N’)<K’2(M’,N’)<……<K’n(M’,N’)That is, the weighting parameter of the image block (M ', N') in the 1 st frame image is smaller than the weighting parameter of the image block (M ', N') in the 2 nd frame image, the weighting parameter of the image block (M ', N') in the 2 nd frame image is smaller than the weighting parameter of the image block (M ', N') in the 3 rd frame image, and so on, the weighting parameter of the image block (M ', N') in the nth frame image is the largest, and usually the weighting parameter of the current frame image is the largest.
Or K'1(M’,N’)=K’2(M’,N’)=……=K’(n-1)(M’,N’)<K’n(M’,N’)That is, the weighting parameter of the image block (M ', N') in the 1 st frame image is equal to the weighting parameter of the image block (M ', N') in the 2 nd frame image, the weighting parameter of the image block (M ', N') in the 2 nd frame image is equal to the weighting parameter of the image block (M ', N') in the 3 rd frame image, and so on until the weighting parameter of the image block (M ', N') in the (N-1) th frame image is smaller than the weighting parameter of the image block (M ', N') in the nth frame image, and the weighting parameter of the image block (M ', N') in the nth frame image is the largest, and is usually the weighting parameter of the current frame image is the largest.
Or K 'to'1(M’,N’)=K’2(M’,N’)=……=K’(n-1)(M’,N’)=0,K’n(M’,N’)The image blocks (M ', N') directly adopt the feature values of the image of the nth frame, and the feature values of the image blocks corresponding to other image frames are discarded.
Step S38, according to the weighting parameter group and the image information of the image blocks of the multi-frame images, carrying out weighted average calculation to obtain target image information of the target image blocks corresponding to the same positions;
in this embodiment, according to the weighting parameter set, the products between the image information of the image blocks at the same position in different image frames and the corresponding weighting parameters in the weighting parameter set are calculated according to the image information of the second image block that is not sub-divided and the third image blocks at the same position, and then the products of each image block are added to obtain the target image information of the target image block corresponding to the same position. It will be appreciated that other information, such as the location of the image blocks, may also be incorporated when compositing the target image frames.
According to the weighting parameter group and the image information of the image blocks at the same position, carrying out weighted average calculation to obtain target image information F corresponding to the target image blocks at the same position(M,N):
F(M,N)={K1*f(i+1)+K2*f(i+2)+…+Kn*f(i+N)}+{K’1*f(i+1)+K’2*f(i+2)+…+K’n*f(i+N)};
Wherein f (i + N) represents image information of an image block corresponding to each frame of image; k1、K2… Kn is a weighting parameter corresponding to the second image block for each frame of image frame sequence, and has a value range of [0, 1%];K’1、K’2… K' n is a weighting parameter corresponding to the third image block for each frame of image frame sequence, and has a value range of [0, 1]。
And step S39, combining the target image information of the plurality of image blocks into a target image frame.
In this embodiment, when obtaining target image information of a plurality of target image blocks, the plurality of target image blocks are combined into a new target image frame. Since the image block is divided twice by coarsening and thinning, compared with the scheme of only dividing the image block once, the method can more accurately determine the attribute of the image block, thereby further avoiding the phenomenon of trailing when a moving object with higher moving speed exists in the image.
The invention also provides an image processing device, which comprises a memory, a processor and an image processing program of the endoscope, wherein the image processing program is stored on the memory and can be operated on the processor; the image processing program of the endoscope, when executed by the processor, implements the steps of the method as described above.
In this embodiment, the image processing apparatus may be a general monocular endoscope, a binocular or multi-view stereo endoscope, an apparatus independent from the stereo endoscope, or a surgical robot.
Specifically, as shown in fig. 7, a surgical robot generally includes a master operation table 1 and a slave operation device 2, the master operation table 1 being configured to transmit a control command to the slave operation device according to an operation by a doctor to control the slave operation device 2; the slave operation device 2 is used for responding to the control command sent by the master operation table 1 and performing corresponding operation. The slave operation device 2 comprises a mechanical arm 21, a power mechanism 22 arranged on the mechanical arm and an operation arm 23, wherein the operation arm 23 is used for extending into the body under the driving action of the power mechanism 22, performing operation through a terminal instrument at the far end of the operation arm and/or acquiring in-vivo images through an endoscope at the far end of the operation arm. The main console 1 is also used to display images acquired from the operating equipment.
The present invention also provides a computer-readable storage medium having stored thereon an image processing program of an endoscope, which when executed by a processor, implements the steps of the image processing method of the image processing apparatus as described above.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling an image processing apparatus (e.g., a mobile phone, a computer, a server, a controlled terminal, or a network device) to execute the method according to the embodiments of the present invention.
Claims (11)
1. An image processing method for an endoscope, comprising:
acquiring motion information of an operating arm of a surgical robot and parameter information of an endoscope of the surgical robot;
calculating to obtain a first virtual projection image of the operation arm relative to the endoscope according to the motion information of the operation arm and the parameter information of the endoscope, wherein the first virtual projection image comprises a projection image of the operation arm;
dividing the first virtual projection image to obtain a plurality of first image blocks, and determining first attributes of the plurality of first image blocks according to the motion information;
reading an image frame sequence which is acquired by the endoscope and comprises a plurality of frames of images, dividing each frame of image in the image frame sequence to obtain a plurality of second image blocks corresponding to the first image blocks, and matching the first image blocks with the second image blocks to obtain a plurality of second image blocks in each frame of image and second attributes corresponding to the first attributes;
performing secondary division on the second image block with the second attribute in the moving state to obtain a plurality of third image blocks;
acquiring the characteristic value and the image information of each second image block and each third image block of each frame image, and determining the third attribute of each third image block according to the characteristic value of each third image block;
determining the weighting parameters of each second image block and each third image block which are not divided secondarily in each frame of image according to the second attribute and the third attribute, and obtaining a weighting parameter group according to the weighting parameters of the image blocks of the plurality of frames of images which are located at the same position;
according to the weighting parameter group and the image information of the image blocks of the multi-frame images, which are positioned at the same position, carrying out weighted average calculation to obtain target image information of the target image blocks corresponding to the same position;
synthesizing target image information of the plurality of image blocks into a target image frame; wherein,
the step of determining the weighting parameters of each second image block and each third image block which are not divided twice in each frame of image according to the second attribute and the third attribute, and obtaining the weighting parameter group according to the weighting parameters of the image blocks of the plurality of frames of images which are located at the same position includes:
determining a second attribute of the second image block of each frame of image in the image frame sequence according to the characteristic values of the plurality of second image blocks;
giving the second image block with the second attribute in a static state, obtaining a weighting parameter set { K) according to the weighting parameter of the image block at the same position in the image frame sequence and the weighting parameter in each image frame sequence1(M,N),K2(M,N),……,Kn(M,N)In which K is1(M,N)=K2(M,N)=……=K(n-1)(M,N)=Kn(M,N)=1/n,Kn(M,N)Representing a weighting parameter, K, of said second image block (M, N) in the nth frame imagen(M,N)∈[0,1];
The third attribute is given a static stateThe image blocks are weighted parameters in each frame of image, and a weighted parameter group { K 'is obtained according to the image block weighted parameters at the same position in the image frame sequence'1(M’,N’),K’2(M’,N’),……,K’n(M’,N’)Wherein, K'1(M’,N’)=K’2(M’,N’)=……K’(n-1)(M,N)=K’n(M,N)=1/n,K’n(M’,N’)Representing a weighting parameter, K ', of said third image block (M', N ') in the N-th frame image'n(M’,N’)∈[0,1];
Giving the third image block with the third attribute in a moving state, obtaining a weighting parameter set { K 'according to the weighting parameter of the image block located at the same position in the image frame sequence in each frame image'1(M,N),K’2(M,N),……,K’n(M,N)Wherein, K'1(M,N)<K’2(M,N)<……<K’n(M,N)Or K'1(M,N)=K’2(M,N)=……=K’(n-1)(M,N)<K’n(M,N),K’n(M,N)Representing a weighting parameter, K ', of said third image block (M', N ') in the N-th frame image'n(M,N)∈[0,1]。
2. The image processing method of an endoscope according to claim 1, further comprising:
and when the projection image of the operation arm is obtained, enlarging the projection image of the operation arm by a preset proportion to obtain the first virtual projection image containing the enlarged projection image of the operation arm.
3. The image processing method of an endoscope according to claim 2, wherein said step of enlarging said projection image by a preset ratio comprises:
the method comprises the steps of obtaining a plurality of joint characteristic points of a projected image of the operating arm, using each joint characteristic point as an origin point, using a corresponding preset radius as a circle to obtain a plurality of characteristic circles, obtaining common tangents of two adjacent characteristic circles, and connecting the common tangents to obtain an expanded projected image of the operating arm.
4. The image processing method of an endoscope according to claim 1, wherein said step of acquiring motion information of an operation arm of a surgical robot includes:
acquiring motion sensor information of the operating arm, and acquiring motion state, motion speed, motion acceleration and position information of the operating arm according to the motion sensor information;
acquiring a base coordinate system of the surgical robot, and constructing a first motion equation of the operating arm relative to the base coordinate system and a second motion equation of the endoscope relative to the base coordinate system according to the position information;
and calculating the pose information of the operating arm relative to the endoscope according to the first motion equation and the second motion equation.
5. The image processing method of an endoscope according to claim 1, wherein said step of calculating a first virtual projection image of said manipulation arm with respect to said endoscope based on motion information of said manipulation arm and parameter information of said endoscope comprises:
constructing an endoscope projection model according to the parameter information of the endoscope to obtain a virtual projection plane of the endoscope;
obtaining a visible area and an invisible area of the operating arm relative to the virtual projection plane according to the motion information of the operating arm and the endoscope projection model;
and projecting the visible region to the virtual projection plane to obtain the first virtual projection image containing the visible region.
6. The image processing method of an endoscope according to claim 1, wherein K'1(M,N)=K’2(M,N)=……=K’(n-1)(M,N)<K’n(M,N)Of (1), K'1(M,N)=K’2(M,N)=……=K2(n-1)(M,N)=0,Kn(M,N)=1。
7. The image processing method of an endoscope according to claim 1, wherein said parameter information includes at least one of a field angle, a focal length, and an offset amount of said endoscope.
8. The image processing method of an endoscope according to claim 1, wherein said motion information includes at least one of a motion state, a motion velocity, a motion acceleration, and pose information.
9. The image processing method of an endoscope according to any one of claims 1 to 8, wherein said step of performing a weighted average calculation based on said set of weighting parameters and said image information of co-located image blocks of said multi-frame image to obtain target image information of target image blocks corresponding to said co-located image blocks comprises:
calculating the product of the image information of the image block at the same position in different image frames and the corresponding weighting parameters in the weighting parameter group according to the weighting parameter group, the image information of the second image block which is not secondarily divided and is positioned at the same position and the image information of the plurality of third image blocks positioned at the same position;
and adding the products of the image blocks at the same position to obtain target image information corresponding to the target image blocks at the same position.
10. An image processing apparatus characterized by comprising a memory, a processor, and an image processing program of an endoscope stored on the memory and executable on the processor;
the image processing program of the endoscope, when executed by the processor, implements the steps of the method of any one of claims 1 to 9.
11. A computer-readable storage medium, characterized in that an image processing program of an endoscope which, when executed by a processor, realizes the steps of the image processing method of an endoscope according to any one of claims 1 to 9 is stored thereon.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010770530.XA CN111787183B (en) | 2020-08-04 | 2020-08-04 | Image processing method, device and storage medium for endoscope |
PCT/CN2020/132540 WO2022027878A1 (en) | 2020-08-04 | 2020-11-28 | Image processing method for endoscope |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010770530.XA CN111787183B (en) | 2020-08-04 | 2020-08-04 | Image processing method, device and storage medium for endoscope |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111787183A CN111787183A (en) | 2020-10-16 |
CN111787183B true CN111787183B (en) | 2021-09-03 |
Family
ID=72765109
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010770530.XA Active CN111787183B (en) | 2020-08-04 | 2020-08-04 | Image processing method, device and storage medium for endoscope |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111787183B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2022027878A1 (en) * | 2020-08-04 | 2022-02-10 | 深圳市精锋医疗科技有限公司 | Image processing method for endoscope |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107049492A (en) * | 2017-05-26 | 2017-08-18 | 微创(上海)医疗机器人有限公司 | The display methods of surgical robot system and surgical instrument position |
CN110996825A (en) * | 2017-07-13 | 2020-04-10 | 直观外科手术操作公司 | System and method for switching control authority between multiple instrument arms |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1301118B1 (en) * | 2000-07-14 | 2006-09-06 | Xillix Technologies Corp. | Compact fluorescence endoscopy video system |
US8923650B2 (en) * | 2013-01-07 | 2014-12-30 | Wexenergy Innovations Llc | System and method of measuring distances related to an object |
CN111479072B (en) * | 2020-04-14 | 2021-12-17 | 深圳市道通智能航空技术股份有限公司 | High dynamic range image synthesis method and device, image processing chip and aerial camera |
-
2020
- 2020-08-04 CN CN202010770530.XA patent/CN111787183B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107049492A (en) * | 2017-05-26 | 2017-08-18 | 微创(上海)医疗机器人有限公司 | The display methods of surgical robot system and surgical instrument position |
CN110996825A (en) * | 2017-07-13 | 2020-04-10 | 直观外科手术操作公司 | System and method for switching control authority between multiple instrument arms |
Also Published As
Publication number | Publication date |
---|---|
CN111787183A (en) | 2020-10-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111770243B (en) | Image processing method, device and storage medium for endoscope | |
JP7011472B2 (en) | Information processing equipment, information processing method | |
US11893705B2 (en) | Reference image generation apparatus, display image generation apparatus, reference image generation method, and display image generation method | |
US10430967B2 (en) | Information processing apparatus, method, and program | |
US11985294B2 (en) | Information processing apparatus, information processing method, and program | |
CN111787183B (en) | Image processing method, device and storage medium for endoscope | |
CN112581389A (en) | Virtual viewpoint depth map processing method, equipment, device and storage medium | |
WO2022027878A1 (en) | Image processing method for endoscope | |
JP7006810B2 (en) | 3D measuring device, mobile robot, push wheel type moving device and 3D measurement processing method | |
CN113569896A (en) | Computer-implemented method for 3D positioning of objects based on image and depth data | |
JP4689548B2 (en) | Image processing apparatus, image processing method, recording medium, computer program, semiconductor device | |
JP2002032744A (en) | Device and method for three-dimensional modeling and three-dimensional image generation | |
JP2021009557A (en) | Information processing device, information processing method, and program | |
JP2024016620A (en) | Image processing device, image processing method, and system | |
JP7045103B1 (en) | Data Expansion Devices, Data Expansion Systems, and Data Expansion Programs | |
US11847784B2 (en) | Image processing apparatus, head-mounted display, and method for acquiring space information | |
JP4505616B2 (en) | Eigenspace learning device, eigenspace learning method, and eigenspace program | |
JP2000028354A (en) | Three-dimensional image processing device | |
CN113744364A (en) | Image processing method and device | |
WO2020050222A1 (en) | Image reproduction device, image generation device, image generation method, control program, and recording medium | |
CN113557717A (en) | Information processing apparatus, information processing method, and program | |
JP2001319225A (en) | Three-dimensional input device | |
CN114419949B (en) | Automobile rearview mirror image reconstruction method and rearview mirror | |
US11935182B2 (en) | Information processing apparatus, information processing method, and storage medium | |
WO2023163219A1 (en) | Information processing device, robot control system, and program |
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 |