CN114820357A - X-ray image processing method and device, electronic equipment and storage medium - Google Patents

X-ray image processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114820357A
CN114820357A CN202210386537.0A CN202210386537A CN114820357A CN 114820357 A CN114820357 A CN 114820357A CN 202210386537 A CN202210386537 A CN 202210386537A CN 114820357 A CN114820357 A CN 114820357A
Authority
CN
China
Prior art keywords
gray
source data
image
gray value
image source
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.)
Granted
Application number
CN202210386537.0A
Other languages
Chinese (zh)
Other versions
CN114820357B (en
Inventor
胡成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Mingrui Ideal Technology Co ltd
Original Assignee
Shenzhen Magic Ray Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Magic Ray Technology Co ltd filed Critical Shenzhen Magic Ray Technology Co ltd
Priority to CN202210386537.0A priority Critical patent/CN114820357B/en
Publication of CN114820357A publication Critical patent/CN114820357A/en
Application granted granted Critical
Publication of CN114820357B publication Critical patent/CN114820357B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/94Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04845Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration using histogram techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10116X-ray image

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Apparatus For Radiation Diagnosis (AREA)

Abstract

The application relates to an X-ray image processing method, an X-ray image processing device, an electronic device and a storage medium, wherein the method comprises the following steps: acquiring image source data, a contrast adjustment graphical user interface and a result image graphical user interface; acquiring a gray level histogram and segmentation points corresponding to image source data based on the image source data; adjusting the initial position of the segmentation point according to the gray level histogram to obtain the target position of the segmentation point; obtaining a gray value of image source data of a contrast adjustment graphical user interface; and performing piecewise linear transformation calculation on the gray value of the image source data according to the target position of the segmentation point to obtain a transformed gray value, obtaining a gray image corresponding to the transformed gray value, and rendering the gray image on the result image graphical user interface in real time. The method can enhance the contrast of the target area, solve the problem of blockage of real-time refreshing in the contrast adjusting process, and is beneficial to a user to check the image of the target area.

Description

X-ray image processing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an X-ray image processing method and apparatus, an electronic device, and a storage medium.
Background
The X-ray image can obtain an image of internal tissues in a non-invasive way, important technical support is provided for the industrial field or medical research, a large number of system components or structural tissues which are difficult to observe by naked eyes can be taken as reference through the X-ray image, and in the current medical and industrial diagnosis, although the performance of an X-ray imaging device is continuously improved, the definition is greatly improved compared with the definition of the image in the past, because some parts are tiny and difficult to observe, the important characteristic part image in the image is highlighted, and the contrast between the important characteristic image and a peripheral image is enhanced, so that the X-ray image has important significance for the medical and industrial diagnosis.
Disclosure of Invention
The technical problem mainly solved by the embodiments of the present application is to provide an X-ray image processing method, an X-ray image processing apparatus, an electronic device, and a storage medium, which aim to enhance the contrast of a target area and solve the problem of real-time refresh stuck in the contrast adjustment process.
In a first aspect, an embodiment of the present application provides an X-ray image processing method, including: acquiring image source data, a contrast adjustment graphical user interface and a result image graphical user interface; acquiring a gray level histogram and segmentation points corresponding to the image source data based on the image source data; adjusting the initial position of the segmentation point according to the gray level histogram to obtain the target position of the segmentation point; obtaining a gray value of the image source data of the contrast adjustment graphical user interface; and performing piecewise linear transformation calculation on the gray value of the image source data according to the target position of the segmentation point to obtain a transformed gray value, obtaining a gray image corresponding to the transformed gray value, and rendering the gray image on the result image graphical user interface in real time.
Optionally, the adjusting the initial position of the segmentation point according to the gray histogram to obtain the target position of the segmentation point includes: acquiring an initial position of a segmentation point; selecting a target area according to the gray level histogram; performing gray scale range compression or gray scale range stretching on the target region by adjusting the slope of a connecting line between the segmentation points of the initial position; and determining the target position of the segmentation point according to the result of the gray scale range compression or the gray scale range stretching.
Optionally, the performing gray scale range compression or gray scale range stretching on the target region by adjusting a slope of a connecting line between the segment points at the initial position includes: monitoring corresponding mouse events during the initial position adjustment of the segmentation point, wherein the mouse events comprise a left mouse button pressing event, a mouse moving event and a left mouse button bouncing event; and based on the mouse left key pressing event, the mouse moving event and the mouse left key bouncing event, realizing the gray scale range compression or the gray scale range stretching of the target area.
Optionally, the monitoring a mouse event corresponding to the initial position adjustment of the segment point includes: acquiring a position attribute value of the segmentation point; when the position attribute value is changed, issuing an asynchronous event stream; and subscribing the asynchronous event stream, and filtering the asynchronous event stream to acquire the mouse event.
Optionally, the subscribing to the asynchronous event stream, and filtering the asynchronous event stream to obtain the mouse event include: acquiring a preset first time interval; when the asynchronous event stream determined according to the first time interval comprises a plurality of asynchronous event streams, selecting one asynchronous event stream from the plurality of asynchronous event streams, and acquiring the mouse event according to the selected asynchronous event stream.
Optionally, the performing piecewise linear transformation calculation on the gray value of the image source data according to the target position of the segmentation point includes: performing piecewise linear transformation calculation on the gray value of the image source data according to the following formula to obtain the gray value of the image source data after gray value transformation; the formula includes:
F(X)=K n ×X+B n (X n-1 <<X<X n ) (ii) a Wherein the initial coordinate is (0, 0) and the end coordinate is (X) n ,Y n ),(X n-1 ,Y n-1 ) The target position of each segmentation point is n which is A +1, and A is the number of the segmentation points; f (X) is the gray value of the image source data after gray value transformation; x is the gray value of image source data; k n =(Y n -Y n-1 )/(X n -X n-1 );K n Is X n Point sum X n-1 The slope of the line in which the point is located; y is n Is X n Corresponding gray values; y is n-1 Is X n-1 Corresponding gray values; x n The gray value of X corresponding to the nth point; x n-1 Is the gray value of X corresponding to the n-1 point; b is n =Y n -K n ×X n ;B n Is (X) n ,Y n ) And (X) n-1 ,Y n-1 ) Intercept of a straight line on which the point lies, and B 1 =0。
Optionally, the method further includes: establishing an array table, wherein the array table is used for storing an array of target gray values, and the array comprises an initial gray value of an image data source and a converted gray value; and when the gray value of the image source data is subjected to piecewise linear transformation calculation, inquiring the transformed gray value according to the array table.
In a second aspect, an embodiment of the present application provides an X-ray image processing apparatus, including: the first acquisition module is used for acquiring image source data, a contrast adjustment graphical user interface and a result image graphical user interface; the second acquisition module is used for acquiring a gray level histogram and segmentation points corresponding to the image source data based on the image source data; the adjusting module is used for adjusting the initial position of the segmentation point according to the gray level histogram so as to obtain the target position of the segmentation point; a third obtaining module, configured to obtain a gray value of the image source data of the contrast adjustment gui; and the calculation module is used for performing piecewise linear transformation calculation on the gray value of the image source data according to the target position of the segmentation point to acquire a transformed gray value, acquiring a gray image corresponding to the transformed gray value and rendering the gray image on the result image graphical user interface in real time.
In a third aspect, an embodiment of the present application provides an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any of the X-ray image processing methods described above.
In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are configured to cause a computer to execute any one of the above-mentioned X-ray image processing methods.
Different from the prior art, the X-ray image processing method provided by the application has the beneficial effects that:
the application relates to an X-ray image processing method, an X-ray image processing device, an electronic device and a storage medium, wherein an image source data, a contrast adjustment graphical user interface and a result image graphical user interface are obtained; acquiring a gray level histogram and segmentation points corresponding to image source data based on the image source data; adjusting the initial position of the segmentation point according to the gray level histogram to obtain the target position of the segmentation point; obtaining a gray value of image source data of a contrast adjustment graphical user interface; and performing piecewise linear transformation calculation on the gray value of the image source data according to the target position of the segmentation point to acquire a transformed gray value, acquiring a gray image corresponding to the transformed gray value, and rendering the gray image on the result image graphical user interface in real time. Therefore, the contrast of the target area can be enhanced, the calculated amount in the image processing process is reduced, and the problem of real-time refreshing blockage in the contrast adjusting process is solved.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
One or more embodiments are illustrated in drawings corresponding to, and not limiting to, the embodiments, in which elements having the same reference number designation may be represented as similar elements, unless specifically noted, the drawings in the figures are not to scale.
Fig. 1 is an application scenario of an X-ray image processing method provided in an embodiment of the present application;
FIG. 2 is a schematic flow chart of an X-ray image processing method according to an embodiment of the present disclosure;
FIG. 3 is a schematic view of the sub-flow of S3 in FIG. 2 according to the embodiment of the present application;
FIG. 4 is a schematic view of the sub-flow of S33 in FIG. 3 according to the embodiment of the present application;
FIG. 5 is a schematic view of the sub-flow of S331 in FIG. 4 according to an embodiment of the present application;
fig. 6 is a schematic diagram illustrating a scenario of an asynchronous event stream de-jitter method according to an embodiment of the present application;
FIG. 7 is a graph of a gray scale value piecewise linear transformation calculation provided by an embodiment of the present application;
fig. 8 is a schematic structural diagram of an X-ray image processing apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It should be noted that, if not conflicted, the individual features of the embodiments of the present application can be combined with one another within the scope of protection of the present application. Additionally, while functional block divisions are performed in the device diagrams, with logical sequences shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than the block divisions in the device diagrams, or the flowcharts.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
The method for processing the X-ray image according to the embodiment of the application can be applied to the application scene shown in FIG. 1. The scene includes a graphical user interface 1, where the graphical user interface 1 includes a result image graphical user interface 11 and a contrast adjustment graphical user interface 12, the contrast adjustment graphical user interface 12 may be divided into two layers, a bottom layer is a gray histogram layer 122, a top layer is a segmentation point layer 121, and the segmentation point layer 121 includes a connection line 1212 between a segmentation point 1211 and a segmentation point 1211.
Specifically, after the X-ray image source data is imported into the apparatus, the contrast adjustment gui 12 displays the grayscale histogram layer 122 and the segmentation point layer 121, in a default state, the segmentation point 1211 is equally divided into straight lines where coordinate points (0, 0) and (16384, 255) in the contrast adjustment gui 12 are located, a target area on the grayscale histogram 122 is selected, the segmentation point 1211 is located on both sides of the grayscale histogram 122, the contrast of the target area is enhanced by adjusting the position of the segmentation point 1211, in the process of adjusting the segmentation point 1211 to the target position, the grayscale value of the image source data is subjected to piecewise linear transformation calculation to obtain a transformed grayscale value, and the transformed grayscale image is rendered in the result image gui 11 in real time according to the grayscale image corresponding to the transformed grayscale value.
An embodiment of the present application provides an X-ray image processing method, please refer to fig. 2, the method includes:
step S1: image source data, a contrast adjustment graphical user interface, and a result image graphical user interface are obtained.
The image source data is X-ray image source data, and the X-ray image source data is initial data of a 14-bit gray level image.
The contrast adjustment graphical user interface is a computer operation user interface displayed in the process of changing and adjusting an original image, and can be divided into 2 layers, wherein the bottom layer is a gray level histogram layer of an X-ray image, and the top layer is a segmentation point layer.
The GUI is a computer operation User Interface displayed in a Graphical manner, and is an Interface display format for human-computer communication, which allows a User to use an input device such as a mouse to manipulate icons or menu options on a screen to select commands, call files, start programs, or perform other daily tasks. The graphical user interface may be divided into a right portion contrast adjustment GUI and a left portion result image GUI.
The histogram layer is a bottom layer of the contrast adjusting GUI and is obtained through calculation according to X-ray image source data, the gray value range of histogram statistics is 0-16384, 16384 is the maximum pixel value of a 14-bit image, the number of intervals is set according to the width of the contrast adjusting GUI, the height of the contrast adjusting GUI is normalized according to the contrast, and the normalized histogram layer is rendered on the histogram layer.
The segmentation point layer is a top layer of the contrast adjustment GUI, and the segmentation point layer includes a connection line between segmentation points and points, where the number of the segmentation points may be any number, and in a default case, the segmentation points are on a straight line connecting coordinates (0, 0) and (16384, 255), and are equally divided on the straight line, so as to obtain positions of the initial segmentation points.
The result image graphical user interface is a computer operation user interface which obtains a target image by transforming an original image and displays the target image in real time.
Step S2: and acquiring a gray level histogram and segmentation points corresponding to the image source data based on the image source data.
The method comprises the steps of importing X-ray image source data into a device, wherein the device can calculate a gray level histogram according to the image source data, the gray level histogram is displayed on a histogram layer, a target area is selected according to a characteristic area of the gray level histogram, segmentation points are displayed on a segmentation point layer, adjacent segmentation points are connected, and the segmentation points can move on the gray level histogram according to the selected target area.
Step S3: and adjusting the initial position of the segmentation point according to the gray level histogram to obtain the target position of the segmentation point.
The target position of the segmentation point is the position of the segmentation point with the best contrast effect in the selected gray level histogram target area, and taking two segmentation points as an example, after the gray level histogram target area is selected, the two segmentation points respectively move to the left side and the right side of the target area, move the segmentation points on the left side and the right side, and determine the target position of the segmentation point according to the contrast adjustment effect.
Step S4: obtaining a gray value of the image source data of the contrast adjustment graphical user interface.
Step S5: and performing piecewise linear transformation calculation on the gray value of the image source data according to the target position of the segmentation point to acquire a transformed gray value, acquiring a gray image corresponding to the transformed gray value, and rendering the gray image on the result image graphical user interface in real time.
In the process that the segmentation point moves from the initial position to the target position, the system carries out segmentation linear transformation calculation according to the gray value of the segmentation point image source data to obtain a transformed gray value, the gray image corresponding to the transformed gray value is an 8-bit gray image, the gray image is rendered in a result image GUI in real time, the contrast of the transformed gray image is enhanced, and the picture in the result image GUI is more beneficial for a user to check the target position.
According to the method, the gray level histogram and the segmentation points are obtained according to the image source data, the target area on the gray level histogram is selected, the initial position of the segmentation points is adjusted according to the target area on the gray level histogram, in the process that the segmentation points are moved to the target position, the gray level of the image source data is subjected to piecewise linear transformation calculation, the image corresponding to the transformed gray level is rendered on the result image GUI, and the contrast of the target area can be enhanced through the method, so that a user can check the image of the target area.
In some embodiments, as shown in fig. 3, the adjusting the initial position of the segmentation point according to the gray histogram to obtain the target position of the segmentation point includes:
step S31: acquiring an initial position of a segmentation point;
step S32: selecting a target area according to the gray level histogram;
step S33: performing gray scale range compression or gray scale range stretching on the target area by adjusting the slope of a connecting line between the segmentation points of the initial position;
step S34: and determining the target position of the segmentation point according to the result of the gray scale range compression or the gray scale range stretching.
The initial position of the segmentation point is the position automatically selected by the system in the default state, the characteristic area on the gray level histogram is selected as the target area, two segmentation points are divided at two sides of the target area of the gray level histogram by taking two segmentation points as an example, by adjusting the slope of the connecting line of the two segmentation points, when the slope is increased, the gray level range of the target area is stretched, and the gray level range of the background and the non-target area is compressed, so that the contrast of the target area is enhanced, and when the slope is reduced, the gray level range of the target area is compressed, and the contrast of the target area is weakened.
The X-ray image processing method provided by the embodiment of the invention can enhance the contrast of the target area, is simple in operation process and is beneficial to a user to observe the target area.
In some embodiments, as shown in fig. 4, the performing gray scale compression or gray scale stretching on the target region by adjusting the slope of the connecting line between the segment points at the initial position includes:
step S331: monitoring corresponding mouse events during the initial position adjustment of the segmentation point, wherein the mouse events comprise a left mouse button pressing event, a mouse moving event and a left mouse button bouncing event;
step S332: and based on the mouse left key pressing event, the mouse moving event and the mouse left key bouncing event, realizing the gray scale range compression or the gray scale range stretching of the target area.
The mouse event is a state of a mouse representative event, such as an element in which the event occurs, a state of a keyboard button, a position of the mouse, and a state of a mouse button.
The method comprises the steps of selecting a segmentation point corresponding to a left mouse button pressing event, moving a segmentation point corresponding to a mouse moving event, determining a segmentation point corresponding to a left mouse button popping event, selecting a gray histogram target area after the left mouse button pressing event selects the segmentation point, dragging the selected segmentation point to move by the left mouse button moving event, stretching or compressing a gray range of the gray histogram target area by the left mouse button moving event, and determining a target position of the segmentation point by the left mouse button popping event.
In some embodiments, as shown in fig. 5, the monitoring the mouse event corresponding to the initial position adjustment of the segmentation point includes:
step S3311: acquiring a position attribute value of the segmentation point;
step S3312: when the position attribute value is changed, issuing an asynchronous event stream;
step S3313: and subscribing the asynchronous event stream, and filtering the asynchronous event stream to acquire the mouse event.
The position attribute value is a feature or parameter of the position of the segment point, for example, a coordinate of the position of the segment point, a creation time of the position of the segment point, and the like.
The asynchronous event flow means that when a mouse event is executed, the state of other processes is ignored, the following operation is continuously executed, when a message returns, the system informs the processes to process, and the asynchronous event flow is obtained by sequencing the processes according to a certain sequence.
It is understood that when the mouse movement event is triggered, the position attribute value of the segment point is observed, the position attribute value may be time, coordinate value or other parameter value, when the position attribute value of the segment point is found to be changed, an asynchronous event stream is published, the asynchronous event stream is subscribed to, and the asynchronous event stream is filtered, the filtering mode may be referred to as debounce, the filtering condition may be time, coordinate value or other parameter value, and the filtered event is a mouse event.
The method has the advantages that in the operation process of dragging the segmentation point by the mouse, the mouse moving event is frequently triggered, the position of the segmentation point is changed, the change of the position of the segmentation point can refresh the conversion result in real time, in the process of moving the segmentation point by the mouse, the gray value linear conversion calculation and the rendering of the result image GUI can be synchronously processed, the gray value linear conversion calculation is a time-consuming process, researches show that the accumulated time spent on the gray value linear conversion calculation and the rendering of the result image GUI is about 20ms, which far exceeds the trigger frequency cycle of the mouse moving event by 1-2 ms, so that the blocking phenomenon can occur, the mouse event with the position changed too fast can be ignored by filtering the asynchronous event stream, the method not only ensures the real-time of the conversion result refreshing, but also can relieve the blocking phenomenon.
In some embodiments, said subscribing to the asynchronous event stream, filtering the asynchronous event stream to obtain the mouse event, comprises: acquiring a preset first time interval; when the asynchronous event stream determined according to the first time interval comprises a plurality of asynchronous event streams, selecting one asynchronous event stream from the plurality of asynchronous event streams, and acquiring the mouse event according to the selected asynchronous event stream.
A plurality of asynchronous event streams are arranged on the time line adjacently, one asynchronous event stream in a preset time interval is screened and reserved according to the preset time interval, and a mouse event is determined according to the asynchronous event stream. For example, referring to fig. 6, fig. 6 provides a schematic view of a scenario of an asynchronous event stream de-jitter method, where a preset time interval is 10ms, and 1, 2, 3, 4, 5, and 6 asynchronous event streams are located on a timeline, where the time interval between 2, 3, 4, and 5 is not more than 10ms, and the screening condition of the asynchronous event streams is that only the last event stream within 10ms of the preset time interval is retained, that is, the asynchronous event streams 2, 3, and 4 are filtered out, and the asynchronous event streams 1, 5, and 6 are finally retained on the timeline.
The screening condition may be various, for example, only the first asynchronous event stream within a preset time interval is reserved, or the second asynchronous event stream within a preset time interval is reserved, and the like.
In some embodiments, if there is only one asynchronous event stream within a preset time interval, no filtering of the asynchronous event stream is required.
In some embodiments, said performing a piecewise linear transform calculation on a gray value of said image source data according to said target position of said segmentation point comprises:
performing piecewise linear transformation calculation on the gray value of the image source data according to the following formula to obtain the gray value of the image source data after gray value transformation; the formula includes:
F(X)=K n ×X+B n (X n-1 <<X<X n );
wherein the initial coordinate is (0, 0) and the end coordinate is (X) n ,Y n ),(X n-1 ,Y n-1 ) The target position of each segmentation point is n which is A +1, and A is the number of the segmentation points;
f (X) is the gray value of the image source data after gray value transformation;
x is the gray value of image source data;
K n =(Y n -Y n-1 )/(X n -X n-1 );
K n is X n Point sum X n-1 The slope of the line in which the point is located;
Y n is X n Corresponding gray values;
Y n-1 is X n-1 Corresponding gray values;
X n the gray value of X corresponding to the nth point;
X n-1 is the gray value of X corresponding to the n-1 point;
B n =Y n -K n ×X n
B n is (X) n ,Y n ) And (X) n-1 ,Y n-1 ) Intercept of a straight line on which the point lies, and B 1 =0;
It will be appreciated that, as shown in FIG. 7, FIG. 7 provides a graph of gray scale value piecewise linear transformation calculations wherein the coordinates of the upper right-most corner of the contrast adjustment GUI (16384, 255) can be viewed as (X) in the graph as shown in FIG. 7 n ,Y n ),(X 1 ,Y 1 ) To (X) n-1 ,Y n-1 ) For each segment point position, X-axis coordinates represent gray scale values of image source data, Y-axis coordinates represent gray scale values of image source data after gray scale value transformation, L n Is a connecting line between two adjacent segmentation points;
wherein, K 1 =Y 1 /X 1
K 2 =(Y 2 -Y 1 )/(X 2 -X 1 );
K 3 =(Y 3 -Y 2 )/(X 3 -X 2 );
K n =(Y n -Y n-1 )/(X n -X n-1 );
B 1 =0;
B 2 =Y 2 -K 2 ×X 2
B 3 =Y 3 -K 3 ×X 3
B n =Y n -K n ×X n
F(X)=K 1 ×X+B 1 (0<<X<X 1 );
F(X)=K 2 ×X+B 2 (X 1 <<X<X 2 );
F(X)=K 3 ×X+B 3 (X 2 <<X<X 3 );
F(X)=K n ×X+B n (X n-1 <<X<X n );
Thus, a calculation formula of the gradation value f (x) after the gradation value conversion of the image source data can be derived, and any gradation value of the image source data can be calculated according to the calculation formula so as to correspond to the converted gradation value.
In some embodiments, the X-ray image processing method further comprises: establishing an array table, wherein the array table is used for storing an array of target gray values, and the array comprises an initial gray value of an image data source and a converted gray value; and when the gray value of the image source data is subjected to piecewise linear transformation calculation, inquiring the transformed gray value according to the array table.
It can be understood that, in the process of moving the dragging segmentation point of the mouse, if gray value piecewise linear transformation calculation is performed in real time, a large amount of calculation is caused, data processing is slow, corresponding to the transformed gray value through the gray value of the image source data calculated in advance ranging from 0 to 16384, the corresponding transformed gray value is stored by using an array, and in the process of moving the dragging segmentation point of the mouse, query is directly performed according to the array table to obtain the gray value of the image source data corresponding to the transformed gray value.
According to the X-ray image processing method provided by the embodiment of the invention, the gray value of each image source data and the corresponding transformed gray value are stored in advance through the array table, so that the calculated amount in the moving process of the segmentation point is reduced, and the pause phenomenon in the contrast adjusting process is relieved.
Fig. 8 is a schematic structural diagram of an X-ray image processing apparatus according to an embodiment of the present disclosure, please refer to fig. 8, in which an X-ray image processing apparatus 100 of the present embodiment includes a first obtaining module 101, a second obtaining module 102, an adjusting module 103, a third obtaining module 104, and a calculating module 105.
The first acquisition module 101 is configured to acquire image source data, a contrast adjustment graphical user interface, and a result image graphical user interface;
a second obtaining module 102, configured to obtain, based on the image source data, a grayscale histogram and segmentation points corresponding to the image source data;
an adjusting module 103, configured to adjust an initial position of the segmentation point according to the gray histogram to obtain a target position of the segmentation point;
a third obtaining module 104, configured to obtain a gray value of the image source data of the contrast adjustment gui;
the calculating module 105 is configured to perform piecewise linear transformation calculation on the gray value of the image source data according to the target position of the segmentation point to obtain a transformed gray value, obtain a gray image corresponding to the transformed gray value, and render the gray image on the result image graphical user interface in real time.
The X-ray image processing apparatus can execute the X-ray image processing method provided by the embodiment of the present application, and has functional modules and beneficial effects corresponding to the execution method. For technical details which are not described in detail in the embodiments of the X-ray image processing device, reference may be made to the X-ray image processing method provided in the embodiments of the present application.
Fig. 9 is an electronic device according to an embodiment of the present application, please refer to fig. 9, where the electronic device 200 includes: at least one processor 201, and a memory 202 communicatively connected to the at least one processor, in fig. 9, taking the at least one processor 201 as an example, the memory 202 stores instructions executable by the at least one processor 201, and the instructions are executed by the at least one processor 201, so that the at least one processor 201 can execute the above-mentioned X-ray image processing method. The processor 201 and the memory 202 may be connected by a bus or other means, and fig. 9 illustrates the connection by a bus as an example.
The memory 202 is a readable storage medium and can be used for storing software programs, executable programs, and modules, such as program instructions/modules corresponding to the X-ray image processing method in the embodiment of the present application, for example, the modules shown in fig. 8. The processor 201 executes various functional applications of the server and data processing by running software programs, instructions, and modules stored in the memory 202, that is, implements the X-ray image processing method in the above-described embodiments.
The memory 202 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the license plate detection device, and the like. The memory 202 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, the memory 202 may optionally include memory located remotely from the processor 201, which may be connected to the shelf over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The one or more modules are stored in the memory 202 and, when executed by the one or more processors 201, perform the X-ray image processing method in any of the above-described method embodiments, e.g., performing the method steps of fig. 2, 3, 4, and 5 described above, implementing the functionality of the modules in fig. 8.
The embodiment of the present application further provides a non-volatile computer-readable storage medium, which stores computer-executable instructions, and when the computer-executable instructions are executed by an electronic device, the X-ray image processing method in the above embodiment is implemented. For example, the method steps of fig. 2, 3, 4, and 5 described above are performed to implement the functionality of the modules in fig. 8.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, and the computer program can be stored in a readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; within the context of the present application, also features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other permutations of different aspects of the present application as described above, which are not provided in detail for the sake of brevity; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. An X-ray image processing method, characterized in that the method comprises:
acquiring image source data, a contrast adjustment graphical user interface and a result image graphical user interface;
acquiring a gray level histogram and segmentation points corresponding to the image source data based on the image source data;
adjusting the initial position of the segmentation point according to the gray level histogram to obtain the target position of the segmentation point;
obtaining a gray value of the image source data of the contrast adjustment graphical user interface;
and performing piecewise linear transformation calculation on the gray value of the image source data according to the target position of the segmentation point to obtain a transformed gray value, obtaining a gray image corresponding to the transformed gray value, and rendering the gray image on the result image graphical user interface in real time.
2. The method according to claim 1, wherein said adjusting the initial position of the segmentation point according to the gray histogram to obtain the target position of the segmentation point comprises:
acquiring an initial position of a segmentation point;
selecting a target area according to the gray level histogram;
performing gray scale range compression or gray scale range stretching on the target region by adjusting the slope of a connecting line between the segmentation points of the initial position;
and determining the target position of the segmentation point according to the result of the gray scale range compression or the gray scale range stretching.
3. The method according to claim 2, wherein said performing gray scale compression or gray scale stretching on the target region by adjusting the slope of the line between the segmentation points of the initial position comprises:
monitoring corresponding mouse events during the initial position adjustment of the segmentation point, wherein the mouse events comprise a left mouse button pressing event, a mouse moving event and a left mouse button bouncing event;
and based on the mouse left key pressing event, the mouse moving event and the mouse left key bouncing event, realizing the gray scale range compression or the gray scale range stretching of the target area.
4. The method according to claim 3, wherein the monitoring of the mouse event corresponding to the initial position adjustment of the segmentation point comprises:
acquiring a position attribute value of the segmentation point;
when the position attribute value is changed, issuing an asynchronous event stream;
and subscribing the asynchronous event stream, and filtering the asynchronous event stream to acquire the mouse event.
5. The X-ray image processing method of claim 4, wherein subscribing to the asynchronous event stream, filtering the asynchronous event stream to obtain the mouse event, comprises:
acquiring a preset first time interval;
when the asynchronous event streams determined according to the first time interval comprise a plurality of asynchronous event streams, selecting one asynchronous event stream from the plurality of asynchronous event streams, and acquiring the mouse event according to the selected asynchronous event stream.
6. The method of any of claims 1 to 5, wherein said performing a piecewise linear transform computation of a gray value of said image source data based on said target locations of said segmentation points comprises:
performing piecewise linear transformation calculation on the gray value of the image source data according to the following formula to obtain the gray value of the image source data after gray value transformation;
the formula includes:
F(X)=K n ×X+B n (X n-1 <<X<X n );
wherein the initial coordinate is (0, 0) and the end coordinate is (X) n ,Y n ),(X n-1 ,Y n-1 ) The target position of each segmentation point is n which is A +1, and A is the number of the segmentation points;
f (X) is the gray value of the image source data after gray value transformation;
x is the gray value of image source data;
K n =(Y n -Y n-1 )/(X n -X n-1 );
K n is X n Point sum X n-1 The slope of the line in which the point is located;
Y n is X n Corresponding gray values;
Y n-1 is X n-1 Corresponding gray values;
X n the gray value of X corresponding to the nth point;
X n-1 is the gray value of X corresponding to the n-1 point;
B n =Y n -K n ×X n
B n is (X) n ,Y n ) And (X) n-1 ,Y n-1 ) Intercept of a straight line on which the point lies, and B 1 =0。
7. The X-ray image processing method according to claim 6, characterized in that the method further comprises:
establishing an array table, wherein the array table is used for storing an array of target gray values, and the array comprises an initial gray value of an image data source and a converted gray value;
and when the gray value of the image source data is subjected to piecewise linear transformation calculation, inquiring the transformed gray value according to the array table.
8. An X-ray image processing apparatus, characterized in that the apparatus comprises:
a first acquisition module for acquiring image source data, a contrast adjustment graphical user interface and a result image graphical user interface;
the second acquisition module is used for acquiring a gray level histogram and segmentation points corresponding to the image source data based on the image source data;
the adjusting module is used for adjusting the initial position of the segmentation point according to the gray level histogram so as to obtain the target position of the segmentation point;
a third obtaining module, configured to obtain a gray value of the image source data of the contrast adjustment gui;
and the calculation module is used for performing piecewise linear transformation calculation on the gray value of the image source data according to the target position of the segmentation point to acquire a transformed gray value, acquiring a gray image corresponding to the transformed gray value and rendering the gray image on the result image graphical user interface in real time.
9. An electronic device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor;
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of X-ray image processing of any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer-executable instructions for causing a computer to perform the X-ray image processing method according to any one of claims 1 to 7.
CN202210386537.0A 2022-04-11 2022-04-11 X-ray image processing method and device, electronic equipment and storage medium Active CN114820357B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210386537.0A CN114820357B (en) 2022-04-11 2022-04-11 X-ray image processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210386537.0A CN114820357B (en) 2022-04-11 2022-04-11 X-ray image processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114820357A true CN114820357A (en) 2022-07-29
CN114820357B CN114820357B (en) 2023-05-05

Family

ID=82537005

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210386537.0A Active CN114820357B (en) 2022-04-11 2022-04-11 X-ray image processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114820357B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102566867A (en) * 2010-12-24 2012-07-11 北京普源精电科技有限公司 Method and device for treating mouse drawn wave
CN102693531A (en) * 2012-01-11 2012-09-26 河南科技大学 Adaptive double-platform based infrared image enhancement method
CN103402435A (en) * 2011-03-03 2013-11-20 株式会社日立医疗器械 Medical image processing device and medical image processing method
CN104102913A (en) * 2014-07-15 2014-10-15 无锡优辰电子信息科技有限公司 Wrist vein certification system
CN108805829A (en) * 2018-05-25 2018-11-13 浙江科澜信息技术有限公司 Video data processing method, device, equipment and computer readable storage medium
CN109584191A (en) * 2018-12-06 2019-04-05 纳米视觉(成都)科技有限公司 A kind of method for adaptive image enhancement and terminal based on histogram
CN111476760A (en) * 2020-03-17 2020-07-31 平安科技(深圳)有限公司 Medical image generation method and device, electronic equipment and medium
CN112329553A (en) * 2020-10-16 2021-02-05 福瑞泰克智能***有限公司 Lane line marking method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102566867A (en) * 2010-12-24 2012-07-11 北京普源精电科技有限公司 Method and device for treating mouse drawn wave
CN103402435A (en) * 2011-03-03 2013-11-20 株式会社日立医疗器械 Medical image processing device and medical image processing method
CN102693531A (en) * 2012-01-11 2012-09-26 河南科技大学 Adaptive double-platform based infrared image enhancement method
CN104102913A (en) * 2014-07-15 2014-10-15 无锡优辰电子信息科技有限公司 Wrist vein certification system
CN108805829A (en) * 2018-05-25 2018-11-13 浙江科澜信息技术有限公司 Video data processing method, device, equipment and computer readable storage medium
CN109584191A (en) * 2018-12-06 2019-04-05 纳米视觉(成都)科技有限公司 A kind of method for adaptive image enhancement and terminal based on histogram
CN111476760A (en) * 2020-03-17 2020-07-31 平安科技(深圳)有限公司 Medical image generation method and device, electronic equipment and medium
CN112329553A (en) * 2020-10-16 2021-02-05 福瑞泰克智能***有限公司 Lane line marking method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘筱霞等: "图像灰度变换在Photoshop中实现方法的研究", 《包装工程》 *
姚海根: "图像的灰度变换与层次校正", 《中国印刷》 *

Also Published As

Publication number Publication date
CN114820357B (en) 2023-05-05

Similar Documents

Publication Publication Date Title
US9661239B2 (en) System and method for online processing of video images in real time
US10489892B2 (en) Method for signal processing
CN108492287B (en) Video jitter detection method, terminal equipment and storage medium
US8497920B2 (en) Method, apparatus, and computer program product for presenting burst images
US20130016246A1 (en) Image processing device and electronic apparatus
US20170039692A1 (en) Method and System for Analog/Digital Image Simplification and Stylization
CN113055615B (en) Conference all-in-one machine, screen segmentation display method and storage device
US20150358547A1 (en) Image processing apparatus
CN113923350A (en) Video shooting method and device, electronic equipment and readable storage medium
CN112037160A (en) Image processing method, device and equipment
CN105678696B (en) A kind of information processing method and electronic equipment
EP2600312A1 (en) Method and apparatus for visualizing a data set
CN114820357A (en) X-ray image processing method and device, electronic equipment and storage medium
CN112508820A (en) Image processing method and device and electronic equipment
CN109981903B (en) Image processing method and electronic equipment
JP3651943B2 (en) Icon creation method and movie frame creation method
CN111583329A (en) Augmented reality glasses display method and device, electronic equipment and storage medium
CN110738625A (en) Image resampling method, device, terminal and computer readable storage medium
CN115471413A (en) Image processing method and device, computer readable storage medium and electronic device
US20230060988A1 (en) Image processing device and method
WO2013020943A1 (en) Method and apparatus for determining an image detail and initiating image captures by means of a single touch-based gesture
CN111491095B (en) Image blurring method and device and electronic equipment
CN115439386A (en) Image fusion method and device, electronic equipment and storage medium
CN111754417B (en) Noise reduction method for video image, video matting method, device and electronic system
CN113778312A (en) Virtual keyboard display method, device, equipment and computer readable storage medium

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
CP03 Change of name, title or address

Address after: 518000 Floor 5-6, Unit B, Building B4, Guangming Science Park, China Merchants Bureau, Fenghuang Community, Fenghuang Street, Guangming District, Shenzhen, Guangdong

Patentee after: Shenzhen Mingrui Ideal Technology Co.,Ltd.

Country or region after: China

Address before: 518000 floor 6, unit B, building B4, Guangming science and Technology Park, China Merchants Bureau, sightseeing Road, Fenghuang community, Fenghuang street, Guangming District, Shenzhen, Guangdong Province

Patentee before: SHENZHEN MAGIC-RAY TECHNOLOGY Co.,Ltd.

Country or region before: China

CP03 Change of name, title or address