CN111242879A - Image processing method, apparatus, electronic device, and medium - Google Patents

Image processing method, apparatus, electronic device, and medium Download PDF

Info

Publication number
CN111242879A
CN111242879A CN202010056778.XA CN202010056778A CN111242879A CN 111242879 A CN111242879 A CN 111242879A CN 202010056778 A CN202010056778 A CN 202010056778A CN 111242879 A CN111242879 A CN 111242879A
Authority
CN
China
Prior art keywords
histogram
edge
image
segment
segments
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
CN202010056778.XA
Other languages
Chinese (zh)
Other versions
CN111242879B (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.)
Zhengzhou University
Original Assignee
Zhengzhou University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou University filed Critical Zhengzhou University
Priority to CN202010056778.XA priority Critical patent/CN111242879B/en
Publication of CN111242879A publication Critical patent/CN111242879A/en
Application granted granted Critical
Publication of CN111242879B publication Critical patent/CN111242879B/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/40Image enhancement or restoration using histogram techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)
  • Studio Devices (AREA)

Abstract

本公开提供了一种图像处理方法,包括:获取原始图像,其中,所述原始图像包括原始直方图;处理所述原始图像,得到边缘图像和非边缘图像;分别处理所述边缘图像和所述非边缘图像,得到所述边缘图像的边缘直方图和所述非边缘图像的非边缘直方图;处理所述边缘直方图和所述非边缘直方图,得到融合直方图;以及基于所述融合直方图处理所述原始直方图,得到经处理直方图,以便根据所述经处理直方图得到经处理图像,其中,所述经处理图像的对比度高于所述原始图像的对比度。本公开还提供了一种图像处理装置、一种电子设备以及一种计算机可读存储介质。

Figure 202010056778

The present disclosure provides an image processing method, including: acquiring an original image, wherein the original image includes an original histogram; processing the original image to obtain an edge image and a non-edge image; processing the edge image and the edge image respectively a non-edge image, obtaining an edge histogram of the edge image and a non-edge histogram of the non-edge image; processing the edge histogram and the non-edge histogram to obtain a fusion histogram; and based on the fusion histogram The original histogram is processed to obtain a processed histogram to obtain a processed image from the processed histogram, wherein the contrast of the processed image is higher than the contrast of the original image. The present disclosure also provides an image processing apparatus, an electronic device, and a computer-readable storage medium.

Figure 202010056778

Description

图像处理方法、装置、电子设备以及介质Image processing method, apparatus, electronic device, and medium

技术领域technical field

本公开涉及一种图像处理方法、一种图像处理装置、一种电子设备以及一种计算机可读存储介质。The present disclosure relates to an image processing method, an image processing apparatus, an electronic device, and a computer-readable storage medium.

背景技术Background technique

医学成像系统在临床工作中占据举足轻重的地位,提升医学图像质量对帮助医生获取更多患者信息至关重要。通常情况下,由于操作员缺乏专业知识、图像捕获设备参差不齐、光线不均匀等原因,导致图像质量显著降低,例如图像较暗或者图像对比度较低等。Medical imaging systems play an important role in clinical work, and improving the quality of medical images is crucial to helping doctors obtain more patient information. Often times, image quality is significantly reduced, such as darker images or lower image contrast, due to lack of operator expertise, uneven image capture equipment, uneven lighting, etc.

发明内容SUMMARY OF THE INVENTION

本公开的一个方面提供了一种图像处理方法,包括:获取原始图像,其中,所述原始图像包括原始直方图,处理所述原始图像,得到边缘图像和非边缘图像,分别处理所述边缘图像和所述非边缘图像,得到所述边缘图像的边缘直方图和所述非边缘图像的非边缘直方图,处理所述边缘直方图和所述非边缘直方图,得到融合直方图,基于所述融合直方图处理所述原始直方图,得到经处理直方图,以便根据所述经处理直方图得到经处理图像,其中,所述经处理图像的对比度高于所述原始图像的对比度。One aspect of the present disclosure provides an image processing method, including: acquiring an original image, wherein the original image includes an original histogram, processing the original image to obtain an edge image and a non-edge image, and processing the edge image respectively and the non-edge image, obtain the edge histogram of the edge image and the non-edge histogram of the non-edge image, process the edge histogram and the non-edge histogram to obtain a fusion histogram, based on the The fusion histogram processes the original histogram to obtain a processed histogram to obtain a processed image from the processed histogram, wherein the contrast of the processed image is higher than the contrast of the original image.

可选地,上述处理所述边缘直方图和所述非边缘直方图,得到融合直方图包括:分别对所述边缘直方图和所述非边缘直方图进行分段处理,得到所述边缘直方图的M个片段以及所述非边缘直方图的N个片段,其中,M为大于1的整数,N为大于1的整数,分别对M个片段进行处理,得到经处理边缘直方图,分别对N个片段进行处理,得到经处理非边缘直方图,融合所述经处理边缘直方图和所述经处理非边缘直方图,得到所述融合直方图。Optionally, the above-mentioned processing of the edge histogram and the non-edge histogram to obtain a fusion histogram includes: segmenting the edge histogram and the non-edge histogram respectively to obtain the edge histogram The M segments of , and the N segments of the non-edge histogram, where M is an integer greater than 1, and N is an integer greater than 1, and the M segments are processed respectively to obtain the processed edge histogram. Each segment is processed to obtain a processed non-edge histogram, and the processed edge histogram and the processed non-edge histogram are fused to obtain the fused histogram.

可选地,上述分别对M个片段进行处理,得到经处理边缘直方图包括:确定所述M个片段中每个片段的片段移位距离,得到M个片段移位距离,基于所述M个片段移位距离分别对所述M个片段进行移位处理,依次确定所述M个片段中的每一个片段作为第一片段,其中,所述第一片段中包括m个灰度值,所述m个灰度值中的每个灰度值均具有相应的像素个数,m为大于等于1的整数,确定所述m个灰度值中的每个灰度值的灰度值移位距离,得到m个灰度值移位距离,基于所述m个灰度值移位距离分别对所述m个灰度值进行移位处理,得到所述经处理边缘直方图。Optionally, the above-mentioned processing of the M segments respectively to obtain the processed edge histogram includes: determining the segment shift distance of each segment in the M segments, and obtaining M segment shift distances, based on the M segment shift distances. The segment shift distance performs shift processing on the M segments respectively, and sequentially determines each segment in the M segments as a first segment, wherein the first segment includes m grayscale values, and the Each gray value in the m gray values has a corresponding number of pixels, m is an integer greater than or equal to 1, and the gray value shift distance of each gray value in the m gray values is determined , to obtain m gray value shift distances, and respectively perform shift processing on the m gray value values based on the m gray value shift distances to obtain the processed edge histogram.

可选地,上述分别对N个片段进行处理,得到经处理非边缘直方图包括:确定所述N个片段中每个片段的片段移位距离,得到N个片段移位距离,基于所述N个片段移位距离分别对所述N个片段进行移位处理,依次确定所述N个片段中的每一个片段作为第二片段,其中,所述第二片段中包括n个灰度值,所述n个灰度值中的每个灰度值均具有相应的像素个数,n为大于等于1的整数,确定所述n个灰度值中的每个灰度值的灰度值移位距离,得到n个灰度值移位距离,基于所述n个灰度值移位距离分别对所述n个灰度值进行移位处理,得到所述经处理非边缘直方图。Optionally, the above-mentioned processing of the N segments respectively to obtain the processed non-edge histogram includes: determining the segment shift distance of each segment in the N segments to obtain N segment shift distances, based on the N segment shift distances. Perform shift processing on the N segments respectively by the segment shift distances, and sequentially determine each segment in the N segments as a second segment, wherein the second segment includes n grayscale values, so Each gray value in the n gray values has a corresponding number of pixels, n is an integer greater than or equal to 1, and the gray value shift of each gray value in the n gray values is determined. distance, to obtain n gray value shift distances, and respectively perform shift processing on the n gray value values based on the n gray value shift distances to obtain the processed non-edge histogram.

可选地,上述确定所述M个片段中每个片段的片段移位距离包括:根据M个片段中每个片段中的像素个数、所述边缘直方图的片段个数M、所述边缘直方图的像素总个数,计算得到所述M个片段中每个片段的片段移位距离。所述确定所述m个灰度值中的每个灰度值的灰度值移位距离包括:根据m个灰度值中每个灰度值的像素个数、所述第一片段的灰度值个数m、所述第一片段的像素总个数,计算得到所述m个灰度值中的每个灰度值的灰度值移位距离。Optionally, the above-mentioned determining the fragment shift distance of each of the M fragments includes: according to the number of pixels in each of the M fragments, the number of fragments M of the edge histogram, the edge The total number of pixels in the histogram is calculated to obtain the segment shift distance of each segment in the M segments. The determining the gray value shift distance of each gray value in the m gray values includes: according to the number of pixels of each gray value in the m gray values, the gray value of the first segment The number m of degree values and the total number of pixels of the first segment are calculated to obtain the gray value shift distance of each gray value in the m gray values.

可选地,上述确定所述N个片段中每个片段的片段移位距离包括:根据N个片段中每个片段中的像素个数、所述边缘直方图的片段个数N、所述边缘直方图的像素总个数,计算得到所述N个片段中每个片段的片段移位距离。所述确定所述n个灰度值中的每个灰度值的灰度值移位距离包括:根据n个灰度值中每个灰度值的像素个数、所述第一片段的灰度值个数n、所述第一片段的像素总个数,计算得到所述n个灰度值中的每个灰度值的灰度值移位距离。Optionally, the above-mentioned determining the fragment shift distance of each of the N fragments includes: according to the number of pixels in each of the N fragments, the number of fragments N of the edge histogram, the edge The total number of pixels in the histogram is calculated to obtain the segment shift distance of each segment in the N segments. The determining the gray value shift distance of each gray value in the n gray values includes: according to the number of pixels of each gray value in the n gray values, the gray value of the first segment The number of degree values n and the total number of pixels of the first segment are calculated to obtain the gray value shift distance of each gray value in the n gray values.

可选地,上述分别对所述边缘直方图和所述非边缘直方图进行分段处理,得到所述边缘直方图的M个片段以及所述非边缘直方图的N个片段包括:计算所述边缘直方图的第一稀疏值和所述非边缘直方图的第二稀疏值,其中,所述第一稀疏值用于表征所述边缘直方图中各像素个数的偏差程度,所述第二稀疏值用于表征所述非边缘直方图中各像素个数的偏差程度,确定所述边缘直方图中与像素个数小于所述第一稀疏值对应的p个灰度值,其中,p为大于等于1的整数,确定所述非边缘直方图中与像素个数小于所述第二稀疏值对应的q个灰度值,其中,q为大于等于1的整数,将所述p个灰度值作为断点,对所述边缘直方图进行分段处理得到的M个片段,将所述q个灰度值作为断点,对所述非边缘直方图进行分段处理得到的N个片段。Optionally, performing segmentation processing on the edge histogram and the non-edge histogram respectively, and obtaining M segments of the edge histogram and N segments of the non-edge histogram includes: calculating the The first sparse value of the edge histogram and the second sparse value of the non-edge histogram, wherein the first sparse value is used to represent the degree of deviation of the number of pixels in the edge histogram, the second sparse value The sparse value is used to characterize the degree of deviation of the number of pixels in the non-edge histogram, and determine p gray values corresponding to the number of pixels in the edge histogram that are smaller than the first sparse value, where p is an integer greater than or equal to 1, determine the q grayscale values corresponding to the number of pixels in the non-edge histogram less than the second sparse value, where q is an integer greater than or equal to 1, and the p grayscale values The value is used as a breakpoint, and M segments are obtained by segmenting the edge histogram, and the q gray values are used as a breakpoint, and N segments are obtained by segmenting the non-edge histogram.

可选地,上述基于所述融合直方图处理所述原始直方图,得到经处理直方图包括:确定所述融合直方图的累积分布函数,确定所述原始直方图的累积分布函数,计算所述融合直方图的累积分布函数和所述原始直方图的累积分布函数,得到灰度值变化关系,其中,所述灰度值变化关系包括与所述原始直方图中的各个灰度值对应的增强灰度值,基于所述灰度值变化关系,将所述原始直方图中各个灰度值移动到对应的增强灰度值,得到经处理直方图。Optionally, the above-mentioned processing of the original histogram based on the fusion histogram to obtain the processed histogram includes: determining the cumulative distribution function of the fusion histogram, determining the cumulative distribution function of the original histogram, and calculating the fusing the cumulative distribution function of the histogram and the cumulative distribution function of the original histogram to obtain a gray value change relationship, wherein the gray value change relationship includes an enhancement corresponding to each gray value in the original histogram Gray value, based on the gray value change relationship, moving each gray value in the original histogram to the corresponding enhanced gray value to obtain a processed histogram.

可选地,上述处理所述原始图像,得到边缘图像和非边缘图像包括:计算所述原始图像中每个像素的梯度值,确定所述梯度值大于预设梯度值的像素作为所述边缘图像中的像素,确定所述梯度值小于或等于所述预设梯度值的像素作为所述非边缘图像中的像素。Optionally, the above-mentioned processing of the original image to obtain an edge image and a non-edge image includes: calculating the gradient value of each pixel in the original image, and determining that the pixel whose gradient value is greater than a preset gradient value is used as the edge image. and determine the pixels whose gradient value is less than or equal to the preset gradient value as the pixels in the non-edge image.

可选地,上述方法还包括:在处理所述原始图像,得到边缘图像和非边缘图像之前,利用高斯滤波方式对所述原始图像进行滤波处理,以便于去除所述原始图像中的至少部分噪声信息。Optionally, the above method further includes: before processing the original image to obtain an edge image and a non-edge image, filtering the original image by using a Gaussian filtering method, so as to remove at least part of the noise in the original image information.

本公开的另一个方面提供了一种图像处理装置,包括:获取模块、第一处理模块、第二处理模块、第三处理模块以及第四处理模块。其中,获取模块,获取原始图像,其中,所述原始图像包括原始直方图。第一处理模块,处理所述原始图像,得到边缘图像和非边缘图像。第二处理模块,分别处理所述边缘图像和所述非边缘图像,得到所述边缘图像的边缘直方图和所述非边缘图像的非边缘直方图。第三处理模块,处理所述边缘直方图和所述非边缘直方图,得到融合直方图。第四处理模块,基于所述融合直方图处理所述原始直方图,得到经处理直方图,以便根据所述经处理直方图得到经处理图像,其中,所述经处理图像的对比度高于所述原始图像的对比度。Another aspect of the present disclosure provides an image processing apparatus, including: an acquisition module, a first processing module, a second processing module, a third processing module, and a fourth processing module. Wherein, the acquiring module acquires an original image, wherein the original image includes an original histogram. The first processing module processes the original image to obtain an edge image and a non-edge image. The second processing module processes the edge image and the non-edge image respectively to obtain an edge histogram of the edge image and a non-edge histogram of the non-edge image. The third processing module processes the edge histogram and the non-edge histogram to obtain a fusion histogram. a fourth processing module that processes the original histogram based on the fused histogram to obtain a processed histogram to obtain a processed image from the processed histogram, wherein the processed image has a higher contrast than the Contrast of the original image.

可选地,上述处理所述边缘直方图和所述非边缘直方图,得到融合直方图包括:分别对所述边缘直方图和所述非边缘直方图进行分段处理,得到所述边缘直方图的M个片段以及所述非边缘直方图的N个片段,其中,M为大于1的整数,N为大于1的整数,分别对M个片段进行处理,得到经处理边缘直方图,分别对N个片段进行处理,得到经处理非边缘直方图,融合所述经处理边缘直方图和所述经处理非边缘直方图,得到所述融合直方图。Optionally, the above-mentioned processing of the edge histogram and the non-edge histogram to obtain a fusion histogram includes: segmenting the edge histogram and the non-edge histogram respectively to obtain the edge histogram The M segments of , and the N segments of the non-edge histogram, where M is an integer greater than 1, and N is an integer greater than 1, and the M segments are processed respectively to obtain the processed edge histogram. Each segment is processed to obtain a processed non-edge histogram, and the processed edge histogram and the processed non-edge histogram are fused to obtain the fused histogram.

可选地,上述分别对M个片段进行处理,得到经处理边缘直方图包括:确定所述M个片段中每个片段的片段移位距离,得到M个片段移位距离,基于所述M个片段移位距离分别对所述M个片段进行移位处理,依次确定所述M个片段中的每一个片段作为第一片段,其中,所述第一片段中包括m个灰度值,所述m个灰度值中的每个灰度值均具有相应的像素个数,m为大于等于1的整数,确定所述m个灰度值中的每个灰度值的灰度值移位距离,得到m个灰度值移位距离,基于所述m个灰度值移位距离分别对所述m个灰度值进行移位处理,得到所述经处理边缘直方图。Optionally, the above-mentioned processing of the M segments respectively to obtain the processed edge histogram includes: determining the segment shift distance of each segment in the M segments, and obtaining M segment shift distances, based on the M segment shift distances. The segment shift distance performs shift processing on the M segments respectively, and sequentially determines each segment in the M segments as a first segment, wherein the first segment includes m grayscale values, and the Each gray value in the m gray values has a corresponding number of pixels, m is an integer greater than or equal to 1, and the gray value shift distance of each gray value in the m gray values is determined , to obtain m gray value shift distances, and respectively perform shift processing on the m gray value values based on the m gray value shift distances to obtain the processed edge histogram.

可选地,上述分别对N个片段进行处理,得到经处理非边缘直方图包括:确定所述N个片段中每个片段的片段移位距离,得到N个片段移位距离,基于所述N个片段移位距离分别对所述N个片段进行移位处理,依次确定所述N个片段中的每一个片段作为第二片段,其中,所述第二片段中包括n个灰度值,所述n个灰度值中的每个灰度值均具有相应的像素个数,n为大于等于1的整数,确定所述n个灰度值中的每个灰度值的灰度值移位距离,得到n个灰度值移位距离,基于所述n个灰度值移位距离分别对所述n个灰度值进行移位处理,得到所述经处理非边缘直方图。Optionally, the above-mentioned processing of the N segments respectively to obtain the processed non-edge histogram includes: determining the segment shift distance of each segment in the N segments to obtain N segment shift distances, based on the N segment shift distances. Perform shift processing on the N segments respectively by the segment shift distances, and sequentially determine each segment in the N segments as a second segment, wherein the second segment includes n grayscale values, so Each gray value in the n gray values has a corresponding number of pixels, n is an integer greater than or equal to 1, and the gray value shift of each gray value in the n gray values is determined. distance, to obtain n gray value shift distances, and respectively perform shift processing on the n gray value values based on the n gray value shift distances to obtain the processed non-edge histogram.

可选地,上述确定所述M个片段中每个片段的片段移位距离包括:根据M个片段中每个片段中的像素个数、所述边缘直方图的片段个数M、所述边缘直方图的像素总个数,计算得到所述M个片段中每个片段的片段移位距离。所述确定所述m个灰度值中的每个灰度值的灰度值移位距离包括:根据m个灰度值中每个灰度值的像素个数、所述第一片段的灰度值个数m、所述第一片段的像素总个数,计算得到所述m个灰度值中的每个灰度值的灰度值移位距离。Optionally, the above-mentioned determining the fragment shift distance of each of the M fragments includes: according to the number of pixels in each of the M fragments, the number of fragments M of the edge histogram, the edge The total number of pixels in the histogram is calculated to obtain the segment shift distance of each segment in the M segments. The determining the gray value shift distance of each gray value in the m gray values includes: according to the number of pixels of each gray value in the m gray values, the gray value of the first segment The number m of degree values and the total number of pixels of the first segment are calculated to obtain the gray value shift distance of each gray value in the m gray values.

可选地,上述确定所述N个片段中每个片段的片段移位距离包括:根据N个片段中每个片段中的像素个数、所述边缘直方图的片段个数N、所述边缘直方图的像素总个数,计算得到所述N个片段中每个片段的片段移位距离。所述确定所述n个灰度值中的每个灰度值的灰度值移位距离包括:根据n个灰度值中每个灰度值的像素个数、所述第一片段的灰度值个数n、所述第一片段的像素总个数,计算得到所述n个灰度值中的每个灰度值的灰度值移位距离。Optionally, the above-mentioned determining the fragment shift distance of each of the N fragments includes: according to the number of pixels in each of the N fragments, the number of fragments N of the edge histogram, the edge The total number of pixels in the histogram is calculated to obtain the segment shift distance of each segment in the N segments. The determining the gray value shift distance of each gray value in the n gray values includes: according to the number of pixels of each gray value in the n gray values, the gray value of the first segment The number of degree values n and the total number of pixels of the first segment are calculated to obtain the gray value shift distance of each gray value in the n gray values.

可选地,上述分别对所述边缘直方图和所述非边缘直方图进行分段处理,得到所述边缘直方图的M个片段以及所述非边缘直方图的N个片段包括:计算所述边缘直方图的第一稀疏值和所述非边缘直方图的第二稀疏值,其中,所述第一稀疏值用于表征所述边缘直方图中各像素个数的偏差程度,所述第二稀疏值用于表征所述非边缘直方图中各像素个数的偏差程度,确定所述边缘直方图中与像素个数小于所述第一稀疏值对应的p个灰度值,其中,p为大于等于1的整数,确定所述非边缘直方图中与像素个数小于所述第二稀疏值对应的q个灰度值,其中,q为大于等于1的整数,将所述p个灰度值作为断点,对所述边缘直方图进行分段处理得到的M个片段,将所述q个灰度值作为断点,对所述非边缘直方图进行分段处理得到的N个片段。Optionally, performing segmentation processing on the edge histogram and the non-edge histogram respectively, and obtaining M segments of the edge histogram and N segments of the non-edge histogram includes: calculating the The first sparse value of the edge histogram and the second sparse value of the non-edge histogram, wherein the first sparse value is used to represent the degree of deviation of the number of pixels in the edge histogram, the second sparse value The sparse value is used to characterize the degree of deviation of the number of pixels in the non-edge histogram, and determine p gray values corresponding to the number of pixels in the edge histogram that are smaller than the first sparse value, where p is an integer greater than or equal to 1, determine the q grayscale values corresponding to the number of pixels in the non-edge histogram less than the second sparse value, where q is an integer greater than or equal to 1, and the p grayscale values The value is used as a breakpoint, and M segments are obtained by segmenting the edge histogram, and the q gray values are used as a breakpoint, and N segments are obtained by segmenting the non-edge histogram.

可选地,上述基于所述融合直方图处理所述原始直方图,得到经处理直方图包括:确定所述融合直方图的累积分布函数,确定所述原始直方图的累积分布函数,计算所述融合直方图的累积分布函数和所述原始直方图的累积分布函数,得到灰度值变化关系,其中,所述灰度值变化关系包括与所述原始直方图中的各个灰度值对应的增强灰度值,基于所述灰度值变化关系,将所述原始直方图中各个灰度值移动到对应的增强灰度值,得到经处理直方图。Optionally, the above-mentioned processing of the original histogram based on the fusion histogram to obtain the processed histogram includes: determining the cumulative distribution function of the fusion histogram, determining the cumulative distribution function of the original histogram, and calculating the fusing the cumulative distribution function of the histogram and the cumulative distribution function of the original histogram to obtain a gray value change relationship, wherein the gray value change relationship includes an enhancement corresponding to each gray value in the original histogram Gray value, based on the gray value change relationship, moving each gray value in the original histogram to the corresponding enhanced gray value to obtain a processed histogram.

可选地,上述处理所述原始图像,得到边缘图像和非边缘图像包括:计算所述原始图像中每个像素的梯度值,确定所述梯度值大于预设梯度值的像素作为所述边缘图像中的像素,确定所述梯度值小于或等于所述预设梯度值的像素作为所述非边缘图像中的像素。Optionally, the above-mentioned processing of the original image to obtain an edge image and a non-edge image includes: calculating the gradient value of each pixel in the original image, and determining that the pixel whose gradient value is greater than a preset gradient value is used as the edge image. and determine the pixels whose gradient value is less than or equal to the preset gradient value as the pixels in the non-edge image.

可选地,上述装置还包括:第五处理模块,在处理所述原始图像,得到边缘图像和非边缘图像之前,利用高斯滤波方式对所述原始图像进行滤波处理,以便于去除所述原始图像中的至少部分噪声信息。Optionally, the above-mentioned apparatus further includes: a fifth processing module, which uses Gaussian filtering to filter the original image before processing the original image to obtain the edge image and the non-edge image, so as to remove the original image. at least part of the noise information in .

本公开的另一个方面提供了一种电子设备,包括:一个或多个处理器;存储器,用于存储一个或多个程序,其中,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器用于实现如上的方法。Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more programs The processor, when executed, causes the one or more processors to implement the method as above.

本公开的另一方面提供了一种非易失性可读存储介质,存储有计算机可执行指令,指令在被执行时用于实现如上的方法。Another aspect of the present disclosure provides a non-volatile readable storage medium storing computer-executable instructions that, when executed, are used to implement the above method.

本公开的另一方面提供了一种计算机可读存储介质,存储有计算机可执行指令,所述指令在被执行时用于实现如上的方法。Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which when executed, are used to implement the above method.

附图说明Description of drawings

为了更完整地理解本公开及其优势,现在将参考结合附图的以下描述,其中:For a more complete understanding of the present disclosure and its advantages, reference will now be made to the following description taken in conjunction with the accompanying drawings, in which:

图1示意性示出了根据本公开实施例的图像处理方法的流程图;FIG. 1 schematically shows a flowchart of an image processing method according to an embodiment of the present disclosure;

图2~图3示意性示出了根据本公开实施例的对边缘直方图进行分段处理的示意图;2 to 3 schematically show schematic diagrams of performing segmentation processing on an edge histogram according to an embodiment of the present disclosure;

图4示意性示出了根据本公开实施例的对M个片段进行移位处理的示意图;FIG. 4 schematically shows a schematic diagram of performing shift processing on M segments according to an embodiment of the present disclosure;

图5示意性示出了根据本公开实施例的对M个片段中每个片段中的灰度值进行移位处理的示意图;FIG. 5 schematically shows a schematic diagram of performing shift processing on grayscale values in each of the M segments according to an embodiment of the present disclosure;

图6示意性示出了根据本公开实施例的图像处理装置的框图;以及FIG. 6 schematically shows a block diagram of an image processing apparatus according to an embodiment of the present disclosure; and

图7示意性示出了根据本公开实施例的用于实现图像处理的计算机系统的方框图。FIG. 7 schematically shows a block diagram of a computer system for implementing image processing according to an embodiment of the present disclosure.

具体实施方式Detailed ways

以下,将参照附图来描述本公开的实施例。但是应该理解,这些描述只是示例性的,而并非要限制本公开的范围。在下面的详细描述中,为便于解释,阐述了许多具体的细节以提供对本公开实施例的全面理解。然而,明显地,一个或多个实施例在没有这些具体细节的情况下也可以被实施。此外,在以下说明中,省略了对公知结构和技术的描述,以避免不必要地混淆本公开的概念。Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood, however, that these descriptions are exemplary only, and are not intended to limit the scope of the present disclosure. In the following detailed description, for convenience of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It will be apparent, however, that one or more embodiments may be practiced without these specific details. Also, in the following description, descriptions of well-known structures and techniques are omitted to avoid unnecessarily obscuring the concepts of the present disclosure.

在此使用的术语仅仅是为了描述具体实施例,而并非意在限制本公开。在此使用的术语“包括”、“包含”等表明了所述特征、步骤、操作和/或部件的存在,但是并不排除存在或添加一个或多个其他特征、步骤、操作或部件。The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the present disclosure. The terms "comprising", "comprising" and the like as used herein indicate the presence of stated features, steps, operations and/or components, but do not preclude the presence or addition of one or more other features, steps, operations or components.

在此使用的所有术语(包括技术和科学术语)具有本领域技术人员通常所理解的含义,除非另外定义。应注意,这里使用的术语应解释为具有与本说明书的上下文相一致的含义,而不应以理想化或过于刻板的方式来解释。All terms (including technical and scientific terms) used herein have the meaning as commonly understood by one of ordinary skill in the art, unless otherwise defined. It should be noted that terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly rigid manner.

在使用类似于“A、B和C等中至少一个”这样的表述的情况下,一般来说应该按照本领域技术人员通常理解该表述的含义来予以解释(例如,“具有A、B和C中至少一个的系统”应包括但不限于单独具有A、单独具有B、单独具有C、具有A和B、具有A和C、具有B和C、和/或具有A、B、C的系统等)。在使用类似于“A、B或C等中至少一个”这样的表述的情况下,一般来说应该按照本领域技术人员通常理解该表述的含义来予以解释(例如,“具有A、B或C中至少一个的系统”应包括但不限于单独具有A、单独具有B、单独具有C、具有A和B、具有A和C、具有B和C、和/或具有A、B、C的系统等)。Where expressions like "at least one of A, B, and C, etc.," are used, they should generally be interpreted in accordance with the meaning of the expression as commonly understood by those skilled in the art (eg, "has A, B, and C") At least one of the "systems" shall include, but not be limited to, systems with A alone, B alone, C alone, A and B, A and C, B and C, and/or A, B, C, etc. ). Where expressions like "at least one of A, B, or C, etc.," are used, they should generally be interpreted in accordance with the meaning of the expression as commonly understood by those skilled in the art (eg, "has A, B, or C, etc." At least one of the "systems" shall include, but not be limited to, systems with A alone, B alone, C alone, A and B, A and C, B and C, and/or A, B, C, etc. ).

附图中示出了一些方框图和/或流程图。应理解,方框图和/或流程图中的一些方框或其组合可以由计算机程序指令来实现。这些计算机程序指令可以提供给通用计算机、专用计算机或其他可编程控制装置的处理器,从而这些指令在由该处理器执行时可以创建用于实现这些方框图和/或流程图中所说明的功能/操作的装置。Some block diagrams and/or flow diagrams are shown in the figures. It will be understood that some of the blocks in the block diagrams and/or flowcharts, or combinations thereof, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer or other programmable control device such that the instructions, when executed by the processor, may be created to implement the functions illustrated in the block diagrams and/or flow diagrams/ operating device.

因此,本公开的技术可以硬件和/或软件(包括固件、微代码等)的形式来实现。另外,本公开的技术可以采取存储有指令的计算机可读介质上的计算机程序产品的形式,该计算机程序产品可供指令执行系统使用或者结合指令执行系统使用。在本公开的上下文中,计算机可读介质可以是能够包含、存储、传送、传播或传输指令的任意介质。例如,计算机可读介质可以包括但不限于电、磁、光、电磁、红外或半导体系统、装置、器件或传播介质。计算机可读介质的具体示例包括:磁存储装置,如磁带或硬盘(HDD);光存储装置,如光盘(CD-ROM);存储器,如随机存取存储器(RAM)或闪存;和/或有线/无线通信链路。Accordingly, the techniques of this disclosure may be implemented in hardware and/or software (including firmware, microcode, etc.). Additionally, the techniques of the present disclosure may take the form of a computer program product on a computer-readable medium having stored instructions for use by or in conjunction with an instruction execution system. In the context of this disclosure, a computer-readable medium can be any medium that can contain, store, communicate, propagate, or transmit instructions. For example, a computer-readable medium may include, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, device, or propagation medium. Specific examples of computer-readable media include: magnetic storage devices, such as magnetic tapes or hard disks (HDDs); optical storage devices, such as compact disks (CD-ROMs); memories, such as random access memory (RAM) or flash memory; and/or wired /Wireless communication link.

本公开的实施例提供了一种图像处理方法,包括:获取原始图像,其中,原始图像包括原始直方图,处理原始图像,得到边缘图像和非边缘图像。然后,分别处理边缘图像和非边缘图像,得到边缘图像的边缘直方图和非边缘图像的非边缘直方图,并处理边缘直方图和非边缘直方图,得到融合直方图。其后,基于融合直方图处理原始直方图,得到经处理直方图,以便根据经处理直方图得到经处理图像,其中,经处理图像的对比度高于原始图像的对比度。An embodiment of the present disclosure provides an image processing method, including: acquiring an original image, wherein the original image includes an original histogram, and processing the original image to obtain an edge image and a non-edge image. Then, process the edge image and the non-edge image respectively to obtain the edge histogram of the edge image and the non-edge histogram of the non-edge image, and process the edge histogram and the non-edge histogram to obtain the fusion histogram. Thereafter, the original histogram is processed based on the fused histogram, resulting in a processed histogram to obtain a processed image from the processed histogram, wherein the contrast of the processed image is higher than that of the original image.

图1示意性示出了根据本公开实施例的图像处理方法的流程图。FIG. 1 schematically shows a flowchart of an image processing method according to an embodiment of the present disclosure.

如图1所示,该图像处理方法例如包括操作S110~S150。As shown in FIG. 1 , the image processing method includes, for example, operations S110 to S150.

在操作S110,获取原始图像,其中,原始图像包括原始直方图。In operation S110, an original image is obtained, wherein the original image includes an original histogram.

根据本公开实施例,原始图像例如可以是医学图像,在显示医学图像时,往往需要对医学图像进行增强处理,以增大医学图像中不同组织器官之间的差异,从而改善医学图像的视觉效果。According to the embodiment of the present disclosure, the original image may be, for example, a medical image. When displaying a medical image, it is often necessary to perform enhancement processing on the medical image to increase the difference between different tissues and organs in the medical image, thereby improving the visual effect of the medical image. .

根据本公开实施例,在处理原始图像得到边缘图像和非边缘图像之前,可以利用高斯滤波方式对原始图像进行滤波处理,以便于去除原始图像中的至少部分噪声信息。According to the embodiment of the present disclosure, before processing the original image to obtain the edge image and the non-edge image, the original image may be filtered by using a Gaussian filtering method, so as to remove at least part of noise information in the original image.

例如,原始图像包括原始直方图,可以利用二维的高斯函数对原始直方图进行平滑处理,以便消除噪声干扰。其中,噪声干扰例如指在实际应用中,医学图像由于灰度随机波动或非均匀照射的影响而导致图像存在噪声,从而使得图像直方图中产生稀疏的峰和谷。其中,二维的高斯函数例如为公式(1)所示。For example, the original image includes an original histogram, which can be smoothed with a two-dimensional Gaussian function in order to eliminate noise interference. Among them, noise interference, for example, refers to the fact that in practical applications, medical images have noise due to random fluctuations in gray levels or non-uniform illumination, resulting in sparse peaks and valleys in the image histogram. The two-dimensional Gaussian function is, for example, shown in formula (1).

Figure BDA0002371618480000091
Figure BDA0002371618480000091

其中,公式(1)中的x,y表示原始图像中像素的坐标位置,σ表示标准差。在一种实施例中,可以设置高斯卷积核的大小为3x3,标准差σ=0.85。可以理解,本领域技术人员可以根据实际应用情况设置高斯卷积核的大小以及标准差的值。Among them, x and y in formula (1) represent the coordinate position of the pixel in the original image, and σ represents the standard deviation. In one embodiment, the size of the Gaussian convolution kernel may be set to 3×3, and the standard deviation σ=0.85. It can be understood that those skilled in the art can set the size of the Gaussian convolution kernel and the value of the standard deviation according to the actual application.

在操作S120,处理原始图像,得到边缘图像和非边缘图像,具体过程如下描述。In operation S120, the original image is processed to obtain an edge image and a non-edge image, and the specific process is described as follows.

例如,首先计算原始图像中每个像素的梯度值。例如,原始图像的图像函数为f(x,y),定义原始图像的梯度向量为公式(2)。For example, first calculate the gradient value of each pixel in the original image. For example, the image function of the original image is f(x, y), and the gradient vector defining the original image is formula (2).

Figure BDA0002371618480000092
Figure BDA0002371618480000092

其中,Gx表示原始图像中各个像素的横向灰度差分近似值,Gy表示原始图像中各个像素的纵向灰度差分近似值。如公式(3)所示,Gx和Gy可以通过使用一组3x3的滤波器对原始图像进行卷积计算得到,其中,Mg表示原始图像。Among them, G x represents the approximate value of the horizontal grayscale difference of each pixel in the original image, and G y represents the approximate value of the vertical grayscale difference of each pixel in the original image. As shown in formula (3), G x and G y can be calculated by convolving the original image with a set of 3x3 filters, where M g represents the original image.

Figure BDA0002371618480000101
Figure BDA0002371618480000101

然后,针对原始图像中的每一个像素,可以结合每一个像素的横向灰度差分近似值Gx和纵向灰度差分近似值Gy计算得到每一个像素的梯度值G,梯度值G的计算过程如公式(4)所示。Then, for each pixel in the original image, the gradient value G of each pixel can be calculated by combining the horizontal grayscale difference approximation G x and the vertical grayscale difference approximate value G y of each pixel. The calculation process of the gradient value G is as shown in the formula (4).

Figure BDA0002371618480000102
Figure BDA0002371618480000102

最后,可以确定梯度值大于预设梯度值的像素作为边缘图像中的像素,以及确定梯度值小于或等于预设梯度值的像素作为非边缘图像中的像素。其中,在一种实施例中,预设梯度值例如可以为1。如果原始图像中的某一像素的梯度值G>1,则确定该像素为边缘点,如果原始图像中的某一像素的梯度值G≤1,则确定该像素为非边缘点,从而得到边缘图像和非边缘图像。可以理解,本领域技术人员可以根据实际应用情况设置预设梯度值的值。Finally, pixels with gradient values greater than the preset gradient value may be determined as pixels in the edge image, and pixels with gradient values less than or equal to the preset gradient value may be determined as pixels in the non-edge image. Wherein, in an embodiment, the preset gradient value may be 1, for example. If the gradient value G>1 of a pixel in the original image is determined as an edge point, if the gradient value of a pixel in the original image G≤1, then the pixel is determined as a non-edge point, thus obtaining an edge images and non-edge images. It can be understood that those skilled in the art can set the value of the preset gradient value according to the actual application.

在操作S130,分别处理边缘图像和非边缘图像,得到边缘图像的边缘直方图和非边缘图像的非边缘直方图。例如,在得到边缘图像和非边缘图像之后,可以分别处理边缘图像和非边缘图像得到对应的边缘直方图和非边缘直方图。In operation S130, the edge image and the non-edge image are respectively processed to obtain an edge histogram of the edge image and a non-edge histogram of the non-edge image. For example, after the edge image and the non-edge image are obtained, the edge image and the non-edge image can be processed respectively to obtain the corresponding edge histogram and non-edge histogram.

在操作S140,处理边缘直方图和非边缘直方图,得到融合直方图,具体过程如下描述。In operation S140, the edge histogram and the non-edge histogram are processed to obtain a fusion histogram, and the specific process is described as follows.

例如,分别对边缘直方图和非边缘直方图进行分段处理,得到边缘直方图的M个片段以及非边缘直方图的N个片段,M为大于1的整数,N为大于1的整数。For example, the edge histogram and the non-edge histogram are segmented respectively to obtain M segments of the edge histogram and N segments of the non-edge histogram, where M is an integer greater than 1, and N is an integer greater than 1.

图2~图3示意性示出了根据本公开实施例的对边缘直方图进行分段处理的示意图。2 to 3 schematically show schematic diagrams of segmenting an edge histogram according to an embodiment of the present disclosure.

以下结合图2~图3对边缘直方图进行分段处理得到边缘直方图的M个片段进行说明。The following describes the M segments of the edge histogram obtained by segmenting the edge histogram with reference to FIG. 2 to FIG. 3 .

首先,计算边缘直方图的第一稀疏值,第一稀疏值用于表征边缘直方图中各像素个数的偏差程度。其中,第一稀疏值E为:First, the first sparse value of the edge histogram is calculated, and the first sparse value is used to represent the degree of deviation of the number of pixels in the edge histogram. Among them, the first sparse value E is:

Figure BDA0002371618480000111
Figure BDA0002371618480000111

其中,i表示边缘直方图的灰度值,i的取值范围例如为0-255的整数,H(i)表示边缘直方图中灰度值为i的像素个数,

Figure BDA0002371618480000112
表示边缘直方图中各个灰度值对应像素个数的均值。对于边缘直方图来说,
Figure BDA0002371618480000113
表示该边缘直方图的像素的平均值,例如,如果i的取值为0-255,则i=0,1,2,3,……,255分别对应的像素个数为H(0),H(1),H(2),H(3),……,H(255),则
Figure BDA0002371618480000114
Among them, i represents the gray value of the edge histogram, the value range of i is, for example, an integer from 0 to 255, H(i) represents the number of pixels whose gray value is i in the edge histogram,
Figure BDA0002371618480000112
Represents the mean of the number of pixels corresponding to each gray value in the edge histogram. For the edge histogram,
Figure BDA0002371618480000113
Represents the average value of the pixels of the edge histogram. For example, if the value of i is 0-255, the number of pixels corresponding to i=0, 1, 2, 3, ..., 255 is H(0), H(1), H(2), H(3), ..., H(255), then
Figure BDA0002371618480000114

参考图2,确定边缘直方图中与像素个数小于第一稀疏值对应的p个灰度值,p为大于等于1的整数。其中,P个灰度值例如包括灰度值i=5、灰度值i=13、灰度值i=20等等。然后,将p个灰度值作为断点,对边缘直方图进行分段处理得到的M个片段。Referring to FIG. 2 , determine p grayscale values corresponding to the number of pixels in the edge histogram that are smaller than the first sparse value, where p is an integer greater than or equal to 1. The P grayscale values include, for example, grayscale value i=5, grayscale value i=13, grayscale value i=20, and so on. Then, using p gray values as breakpoints, the edge histogram is segmented to obtain M segments.

参考图3,在一种实施例中,可以将p个灰度值所对应的像素个数设置为0。例如,灰度值i=5对应的像素个数为H(5),灰度值i=13对应的像素个数为H(13),灰度值i=20对应的像素个数为H(20),例如设置H(5)=0、H(13)=0、H(20)=0,并分别以灰度值i=5、灰度值i=13、灰度值i=20的末尾作为断点,将边缘直方图划分为M个片段。M个片段例如包括第1个片段、第2个片段、第3个片段、……、第M个片段。Referring to FIG. 3 , in an embodiment, the number of pixels corresponding to the p grayscale values may be set to 0. For example, the number of pixels corresponding to the grayscale value i=5 is H(5), the number of pixels corresponding to the grayscale value i=13 is H(13), and the number of pixels corresponding to the grayscale value i=20 is H( 20), for example, set H(5)=0, H(13)=0, H(20)=0, and use gray value i=5, gray value i=13, gray value i=20 respectively The end is used as a breakpoint to divide the edge histogram into M segments. The M segments include, for example, the 1st segment, the 2nd segment, the 3rd segment, ..., the Mth segment.

类似地,对非边缘直方图进行分段处理得到非边缘直方图的N个片段的具体过程与边缘直方图的处理过程类似,例如计算非边缘直方图的第二稀疏值,第二稀疏值用于表征非边缘直方图中各像素个数的偏差程度。然后,确定非边缘直方图中与像素个数小于第二稀疏值对应的q个灰度值,q为大于等于1的整数,将q个灰度值作为断点,对非边缘直方图进行分段处理得到的N个片段。具体过程在此不再赘述。Similarly, the specific process of segmenting the non-edge histogram to obtain N segments of the non-edge histogram is similar to the processing process of the edge histogram, for example, calculating the second sparse value of the non-edge histogram, the second sparse value using It is used to characterize the degree of deviation of the number of pixels in the non-edge histogram. Then, determine q gray values corresponding to the number of pixels in the non-edge histogram that are less than the second sparse value, where q is an integer greater than or equal to 1, and use the q gray values as breakpoints to classify the non-edge histogram. The N fragments obtained by segment processing. The specific process is not repeated here.

在得到边缘直方图的M个片段之后,分别对M个片段进行处理,得到经处理边缘直方图,具体过程参考如下图4~图5来描述。另外,可以分别对N个片段进行处理,得到经处理非边缘直方图,具体过程与对M个片段进行处理的过程相同或类似,在此不再赘述。最后,融合经处理边缘直方图和经处理非边缘直方图,得到融合直方图。After the M segments of the edge histogram are obtained, the M segments are processed respectively to obtain the processed edge histogram. The specific process is described with reference to the following Figures 4 to 5 . In addition, the N segments may be processed separately to obtain the processed non-edge histogram, and the specific process is the same as or similar to the process of processing the M segments, which will not be repeated here. Finally, the processed edge histogram and the processed non-edge histogram are fused to obtain a fused histogram.

以下将结合图4~图5描述对M个片段进行处理,得到经处理边缘直方图的具体过程。The specific process of processing the M segments to obtain the processed edge histogram will be described below with reference to FIG. 4 to FIG. 5 .

图4示意性示出了根据本公开实施例的对M个片段进行移位处理的示意图。图5示意性示出了根据本公开实施例的对M个片段中每个片段中的灰度值进行移位处理的示意图。FIG. 4 schematically shows a schematic diagram of performing shift processing on M segments according to an embodiment of the present disclosure. FIG. 5 schematically shows a schematic diagram of shifting grayscale values in each of the M segments according to an embodiment of the present disclosure.

如图4所示,对M个片段进行处理的过程例如包括:首先确定M个片段中每个片段的片段移位距离,得到M个片段移位距离。例如,根据M个片段中每个片段中的像素个数、边缘直方图的片段个数M、边缘直方图的像素总个数,计算得到M个片段中每个片段的片段移位距离。具体地,M个片段中每个片段的片段移位距离例如如公式(6)所示。As shown in FIG. 4 , the process of processing the M segments includes, for example, first determining the segment shift distance of each segment in the M segments, and obtaining the M segment shift distances. For example, according to the number of pixels in each of the M segments, the segment number M of the edge histogram, and the total number of pixels of the edge histogram, the segment shift distance of each segment of the M segments is calculated. Specifically, the segment shift distance of each segment in the M segments is, for example, as shown in formula (6).

Figure BDA0002371618480000121
Figure BDA0002371618480000121

其中,j表示片段,M表示边缘直方图的片段总数,D(j)表示第j个片段的片段移位距离,x(j)表示第j个片段包含的像素个数,

Figure BDA0002371618480000122
表示边缘直方图的像素总个数(即M个片段的像素总个数)。Among them, j represents the segment, M represents the total number of segments in the edge histogram, D(j) represents the segment shift distance of the jth segment, x(j) represents the number of pixels contained in the jth segment,
Figure BDA0002371618480000122
Indicates the total number of pixels in the edge histogram (that is, the total number of pixels in M segments).

在得到M个片段中每个片段的片段移位距离之后,基于M个片段移位距离分别对M个片段进行移位处理。即,对M个片段中的每个片段进行重映射,目的是将每一个片段中的灰度值从图像的低灰度值移动到图像的高灰度值。可以理解,每个片段内包含的像素个数越多,片段的重映射(移位)的距离越远。After the segment shift distances of each of the M segments are obtained, the M segments are respectively shifted based on the M segment shift distances. That is, each of the M segments is remapped in order to move the grayscale values in each segment from a low grayscale value of the image to a high grayscale value of the image. It can be understood that the greater the number of pixels contained in each segment, the farther the segment is remapped (shifted).

如图4所示,例如首先确定M个片段中的第1个片段的片段移位距离为D(1),第2个片段的片段移位距离为D(2),第3个片段的片段移位距离为D(3)等等。然后,将第1个片段、第2个片段、第3个片段等等向灰度值高的方向进行移位处理。图4中仅示意性示出了将第1个片段按照片段移位距离为D(1)进行平移的过程。可以理解,第2个片段、第3个片段、……、第M个片段的移位过程与第1个片段的移位过程相同或类似,在此不再赘述。As shown in FIG. 4 , for example, first determine the segment shift distance of the first segment among the M segments as D(1), the segment shift distance of the second segment as D(2), and the segment shift distance of the third segment as D(2). The shift distance is D(3) and so on. Then, the 1st segment, the 2nd segment, the 3rd segment, etc. are shifted in the direction of the higher gray value. FIG. 4 only schematically shows the process of translating the first segment according to the segment shift distance D(1). It can be understood that the shifting process of the second segment, the third segment, ..., the M-th segment is the same as or similar to the shifting process of the first segment, and details are not described herein again.

如图5所示,在将M个片段中的每个片段按照相应的片段移位距离进行移位处理之后,继续处理M个片段中的每个片段。例如依次确定M个片段中的每一个片段作为第一片段,第一片段中包括m个灰度值,m个灰度值中的每个灰度值均具有相应的像素个数,m为大于等于1的整数。As shown in FIG. 5 , after each segment in the M segments is shifted according to the corresponding segment shift distance, processing of each segment in the M segments is continued. For example, each of the M segments is sequentially determined as the first segment, the first segment includes m grayscale values, and each grayscale value in the m grayscale values has a corresponding number of pixels, where m is greater than An integer equal to 1.

根据本公开实施例,例如可以确定第一片段中的m个灰度值中的每个灰度值的灰度值移位距离,得到m个灰度值移位距离。例如,根据m个灰度值中每个灰度值的像素个数、第一片段的灰度值个数m、第一片段的像素总个数,计算得到m个灰度值中的每个灰度值的灰度值移位距离。具体地,m个灰度值中的每个灰度值的灰度值移位距离例如如公式(7)所示:According to the embodiment of the present disclosure, for example, the gray value shift distance of each of the m gray values in the first segment may be determined to obtain m gray value shift distances. For example, according to the number of pixels of each gray value in the m gray values, the number m of gray values of the first segment, and the total number of pixels of the first segment, each of the m gray values is calculated. Gray value shift distance for gray values. Specifically, the gray value shift distance of each gray value in the m gray values is, for example, as shown in formula (7):

Figure BDA0002371618480000131
Figure BDA0002371618480000131

其中,m表示第一片段的宽度(即第一片段的灰度值个数),k=1,2,……,m,k表示m个灰度值中的第k个灰度值,L(k)表示第k个灰度值的变换强度(即第k个灰度值的灰度值移位距离),H(k)表示第k个灰度值对应的像素个数,x(j)表示第j个片段包含的像素个数(参见公式(6)),此处x(j)表示第一片段的像素总个数。Among them, m represents the width of the first segment (that is, the number of grayscale values of the first segment), k=1, 2, ..., m, k represents the kth grayscale value among the m grayscale values, and L (k) represents the transformation intensity of the kth gray value (that is, the gray value shift distance of the kth gray value), H(k) represents the number of pixels corresponding to the kth gray value, x(j ) represents the number of pixels included in the jth segment (see formula (6)), where x(j) represents the total number of pixels in the first segment.

如图5所示,例如确定M个片段中的第1个片段作为第一片段,该第1个片段中例如包括第1个灰度值、第2个灰度值、……、第k个灰度值、……、第m个灰度值。该第1个灰度值、第2个灰度值、……、第k个灰度值、……、第m个灰度值分别对应的灰度值移位距离例如为L(1)、L(2)、……、L(k)、……、L(m),然后将m个灰度值中的每个灰度值根据对应的灰度值移位距离向灰度值高的方向进行移位处理。As shown in FIG. 5 , for example, the first segment among the M segments is determined as the first segment, and the first segment includes, for example, the first gray value, the second gray value, . . . , the kth Gray value, ..., mth gray value. The grayscale value shift distances corresponding to the first grayscale value, the second grayscale value, ..., the kth grayscale value, ..., the mth grayscale value, respectively, are, for example, L(1), L(2), ..., L(k), ..., L(m), and then shift each gray value of the m gray values according to the corresponding gray value shift distance to the gray value of the higher gray value. The direction is shifted.

类似地,可以依次确定M个片段中的第2个片段、第3个片段,……,第M个片段作为第一片段,对该第一片段中多个灰度值中的每个灰度值进行移位的过程与第1个片段中m个灰度值的移位过程相同或类似,在此不再赘述。通过对M个片段中的每个片段所包括的多个进行移位处理之后,得到经处理边缘直方图。Similarly, the second segment, the third segment, . . . , the M-th segment among the M segments can be sequentially determined as the first segment, and for each grayscale of the multiple grayscale values in the first segment The process of shifting the value is the same as or similar to the process of shifting the m grayscale values in the first segment, and details are not repeated here. The processed edge histogram is obtained by performing shift processing on a plurality of segments included in each of the M segments.

本公开实施例通过对边缘直方图的多个片段进行重映射(移位)处理,实现了以每个片段为整体对边缘直方图进行处理,从而增强了不同片段之间的对比度,体现在增强了原始图像中不同部分的对比度,使得原始图像的整体亮度得到了提升。其次,为了获得更清晰的图像,本公开实施例还针对每个片段内部的灰度值进行细分变换来增强图像的对比度。In the embodiment of the present disclosure, by performing remapping (shifting) processing on multiple segments of the edge histogram, the edge histogram is processed by taking each segment as a whole, thereby enhancing the contrast between different segments, which is reflected in the enhanced The contrast of different parts in the original image is improved, so that the overall brightness of the original image is improved. Secondly, in order to obtain a clearer image, the embodiment of the present disclosure also performs subdivision transformation on the gray value inside each segment to enhance the contrast of the image.

根据本公开实施例,对于非边缘直方图的移位处理过程可以包括分别对N个片段进行处理,得到经处理非边缘直方图。具体过程与对边缘直方图的M个片段进行移位处理的过程相同或类似。According to an embodiment of the present disclosure, the process of shifting the non-edge histogram may include processing N segments respectively to obtain the processed non-edge histogram. The specific process is the same as or similar to the process of shifting the M segments of the edge histogram.

例如,确定N个片段中每个片段的片段移位距离,得到N个片段移位距离。即,根据N个片段中每个片段中的像素个数、边缘直方图的片段个数N、边缘直方图的像素总个数,计算得到N个片段中每个片段的片段移位距离。然后,基于N个片段移位距离分别对N个片段进行移位处理。For example, the segment shift distance of each of the N segments is determined to obtain the N segment shift distances. That is, according to the number of pixels in each of the N segments, the segment number N of the edge histogram, and the total number of pixels of the edge histogram, the segment shift distance of each segment in the N segments is calculated. Then, the N segments are respectively shifted based on the N segment shift distances.

其后,依次确定N个片段中的每一个片段作为第二片段,其中,第二片段中包括n个灰度值,n个灰度值中的每个灰度值均具有相应的像素个数,n为大于等于1的整数。确定n个灰度值中的每个灰度值的灰度值移位距离,得到n个灰度值移位距离。Thereafter, each of the N segments is sequentially determined as the second segment, wherein the second segment includes n grayscale values, and each grayscale value in the n grayscale values has a corresponding number of pixels. , where n is an integer greater than or equal to 1. The gray value shift distance of each gray value in the n gray values is determined, and the n gray value shift distances are obtained.

例如,根据n个灰度值中每个灰度值的像素个数、第一片段的灰度值个数n、第一片段的像素总个数,计算得到n个灰度值中的每个灰度值的灰度值移位距离。For example, according to the number of pixels of each gray value in the n gray values, the number n of gray values of the first segment, and the total number of pixels of the first segment, each of the n gray values is calculated. Gray value shift distance for gray values.

最后,基于n个灰度值移位距离分别对n个灰度值进行移位处理,得到经处理非边缘直方图。具体过程可以参考边缘直方图的M个片段进行移位处理的过程,在此不再赘述。Finally, the n gray values are respectively shifted based on the n gray value shift distances, and the processed non-edge histogram is obtained. For the specific process, reference may be made to the process of shifting the M segments of the edge histogram, which will not be repeated here.

在对边缘直方图进行移位处理得到经处理边缘直方图以及对非边缘直方图进行移位处理得到经处理非边缘直方图之后,将经处理边缘直方图和经处理非边缘直方图进行融合,得到融合直方图。然后可以继续执行如下操作S150。After the edge histogram is shifted to obtain the processed edge histogram and the non-edge histogram is shifted to obtain the processed non-edge histogram, the processed edge histogram and the processed non-edge histogram are fused, Get the fusion histogram. Then, the following operation S150 may be continued.

在操作S150,基于融合直方图处理原始直方图,得到经处理直方图,以便根据经处理直方图得到经处理图像,使得经处理图像的对比度高于原始图像的对比度。In operation S150, the original histogram is processed based on the fusion histogram to obtain a processed histogram, so as to obtain a processed image according to the processed histogram, so that the contrast of the processed image is higher than that of the original image.

例如,确定融合直方图的累积分布函数以及确定原始直方图的累积分布函数。然后,基于融合直方图的累积分布函数和原始直方图的累积分布函数进行直方图规定化映射,得到灰度值变化关系。其中,灰度值变化关系例如包括与原始直方图中的各个灰度值对应的增强灰度值。最后,基于灰度值变化关系,将原始直方图中各个灰度值移动到对应的增强灰度值,得到经处理直方图。For example, determine the cumulative distribution function of the fused histogram and determine the cumulative distribution function of the original histogram. Then, based on the cumulative distribution function of the fusion histogram and the cumulative distribution function of the original histogram, the histogram specification mapping is performed to obtain the gray value change relationship. Wherein, the gray value variation relationship includes, for example, the enhanced gray value corresponding to each gray value in the original histogram. Finally, based on the change relationship of gray value, each gray value in the original histogram is moved to the corresponding enhanced gray value, and the processed histogram is obtained.

例如,直方图规定化映射的计算过程如公式(8)和公式(9)所示。For example, the calculation process of the histogram specification mapping is shown in Equation (8) and Equation (9).

Cinput(i)=Cdesired(s) (8)C input (i)=C desired (s) (8)

Figure BDA0002371618480000151
Figure BDA0002371618480000151

其中,i表示原始直方图的灰度值,Cinput(i)表示原始直方图的累积分布函数。s表示融合直方图的灰度值,Cdesired(s)表示融合直方图的累积分布函数。其中,s例如也可以表示增强灰度值,本公开实施例可以将原始直方图中各个灰度值移动到对应的增强灰度值,得到经处理直方图。Among them, i represents the gray value of the original histogram, and C input (i) represents the cumulative distribution function of the original histogram. s represents the gray value of the fusion histogram, and C desired (s) represents the cumulative distribution function of the fusion histogram. Wherein, s may also represent an enhanced gray value, for example, and in the embodiment of the present disclosure, each gray value in the original histogram may be moved to a corresponding enhanced gray value to obtain a processed histogram.

例如,假设原始直方图中灰度值为i=1、2、3分别对应的像素个数为H(1)、H(2)、H(3),计算得到的增强灰度值s例如分别为s=5、7、11。然后,处理原始直方图得到最终的经处理直方图例如具体为:将原始直方图中灰度值为i=1移动到灰度值为5处,使得经处理直方图中灰度值为5对应的像素个数为H(1)。将原始直方图中灰度值为i=2移动到灰度值为7处,使得经处理直方图中灰度值为7对应的像素个数为H(2)。将原始直方图中灰度值为i=3移动到灰度值为11处,使得经处理直方图中灰度值为11对应的像素个数为H(3)。然后,根据经处理直方图得到经处理图像,使得该经处理图像的对比度高于原始图像的对比度,实现了图像的增强效果。For example, assuming that the number of pixels corresponding to the grayscale values i=1, 2, and 3 in the original histogram are H(1), H(2), and H(3), respectively, the calculated enhanced grayscale values s are, for example, respectively For s=5, 7, 11. Then, processing the original histogram to obtain the final processed histogram is, for example, specifically: moving the gray value of i=1 in the original histogram to the gray value of 5, so that the gray value of 5 in the processed histogram corresponds to The number of pixels is H(1). Move the gray value i=2 in the original histogram to the gray value of 7, so that the number of pixels corresponding to the gray value 7 in the processed histogram is H(2). Move the gray value i=3 in the original histogram to the gray value of 11, so that the number of pixels corresponding to the gray value of 11 in the processed histogram is H(3). Then, a processed image is obtained according to the processed histogram, so that the contrast of the processed image is higher than that of the original image, thereby realizing the enhancement effect of the image.

本公开实施例通过拆分原始图像得到边缘图像和非边缘图像,并分别对边缘图像和非边缘图像进行分段处理以及移位处理得到经处理边缘直方图和经处理非边缘直方图。然后,将经处理边缘直方图和经处理非边缘直方图直方图进行融合处理得到融合直方图,再基于融合直方图和原始直方图进行直方图规定化映射,得到增强的原始图像。可以理解,通过本公开实施例的图像处理方法处理医学图像,使得医学图像的曝光度提高,明暗对比更加细腻,图像较暗处细节更加丰富,并且不会出现过度增强以及不会产生额外噪声的情况,大幅度提升了图像品质,使得医疗工作者通过医学图像更容易观察病情、判断病情。The embodiment of the present disclosure obtains an edge image and a non-edge image by splitting the original image, and performs segmentation processing and shift processing on the edge image and the non-edge image respectively to obtain a processed edge histogram and a processed non-edge histogram. Then, the processed edge histogram and the processed non-edge histogram are fused to obtain a fusion histogram, and then histogram specification mapping is performed based on the fusion histogram and the original histogram to obtain an enhanced original image. It can be understood that, by processing the medical image through the image processing method of the embodiment of the present disclosure, the exposure of the medical image is improved, the contrast between light and dark is more delicate, and the details in the darker part of the image are richer, and there will be no excessive enhancement and no extra noise. This greatly improves the image quality, making it easier for medical workers to observe and judge the condition through medical images.

本公开的另一个方面提供了一种电子设备,包括:一个或多个处理器;存储器,用于存储一个或多个程序,其中,当一个或多个程序被一个或多个处理器执行时,使得一个或多个处理器用于执行图1~5中描述的方法。Another aspect of the present disclosure provides an electronic device including: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors , causing one or more processors to perform the methods described in FIGS. 1-5 .

图6示意性示出了根据本公开实施例的图像处理装置的框图。FIG. 6 schematically shows a block diagram of an image processing apparatus according to an embodiment of the present disclosure.

如图6所示,图像处理装置600包括获取模块610、第一处理模块620、第二处理模块630、第三处理模块640以及第四处理模块650。As shown in FIG. 6 , the image processing apparatus 600 includes an acquisition module 610 , a first processing module 620 , a second processing module 630 , a third processing module 640 and a fourth processing module 650 .

获取模块610可以用于获取原始图像,其中,原始图像包括原始直方图。根据本公开实施例,获取模块610例如可以执行上文参考图1描述的操作S110,在此不再赘述。The acquisition module 610 may be used to acquire an original image, wherein the original image includes an original histogram. According to an embodiment of the present disclosure, the obtaining module 610 may, for example, perform the operation S110 described above with reference to FIG. 1 , which will not be repeated here.

第一处理模块620可以用于处理原始图像,得到边缘图像和非边缘图像。根据本公开实施例,第一处理模块620例如可以执行上文参考图1描述的操作S120,在此不再赘述。The first processing module 620 may be used to process the original image to obtain an edge image and a non-edge image. According to an embodiment of the present disclosure, the first processing module 620 may, for example, perform the operation S120 described above with reference to FIG. 1 , which will not be repeated here.

第二处理模块630可以用于分别处理边缘图像和非边缘图像,得到边缘图像的边缘直方图和非边缘图像的非边缘直方图。根据本公开实施例,第二处理模块630例如可以执行上文参考图1描述的操作S130,在此不再赘述。The second processing module 630 may be configured to process the edge image and the non-edge image respectively to obtain the edge histogram of the edge image and the non-edge histogram of the non-edge image. According to an embodiment of the present disclosure, the second processing module 630 may, for example, perform the operation S130 described above with reference to FIG. 1 , which will not be repeated here.

第三处理模块640可以用于处理边缘直方图和非边缘直方图,得到融合直方图。根据本公开实施例,第三处理模块640例如可以执行上文参考图1描述的操作S140,在此不再赘述。The third processing module 640 may be configured to process the edge histogram and the non-edge histogram to obtain a fusion histogram. According to an embodiment of the present disclosure, the third processing module 640 may, for example, perform the operation S140 described above with reference to FIG. 1 , which will not be repeated here.

第四处理模块650可以用于基于融合直方图处理原始直方图,得到经处理直方图,以便根据经处理直方图得到经处理图像,其中,经处理图像的对比度高于原始图像的对比度。根据本公开实施例,第四处理模块650例如可以执行上文参考图1描述的操作S150,在此不再赘述。The fourth processing module 650 may be configured to process the original histogram based on the fusion histogram to obtain a processed histogram to obtain a processed image from the processed histogram, wherein the contrast of the processed image is higher than that of the original image. According to an embodiment of the present disclosure, the fourth processing module 650 may, for example, perform the operation S150 described above with reference to FIG. 1 , which will not be repeated here.

根据本公开的实施例的模块、子模块、单元、子单元中的任意多个、或其中任意多个的至少部分功能可以在一个模块中实现。根据本公开实施例的模块、子模块、单元、子单元中的任意一个或多个可以被拆分成多个模块来实现。根据本公开实施例的模块、子模块、单元、子单元中的任意一个或多个可以至少被部分地实现为硬件电路,例如现场可编程门阵列(FPGA)、可编程逻辑阵列(PLA)、片上系统、基板上的系统、封装上的系统、专用集成电路(ASIC),或可以通过对电路进行集成或封装的任何其他的合理方式的硬件或固件来实现,或以软件、硬件以及固件三种实现方式中任意一种或以其中任意几种的适当组合来实现。或者,根据本公开实施例的模块、子模块、单元、子单元中的一个或多个可以至少被部分地实现为计算机程序模块,当该计算机程序模块被运行时,可以执行相应的功能。Any of the modules, sub-modules, units, sub-units, or at least part of the functions of any of them according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be divided into multiple modules for implementation. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as hardware circuits, such as field programmable gate arrays (FPGA), programmable logic arrays (PLA), A system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or any other reasonable means of hardware or firmware that integrates or packages circuits, or can be implemented in software, hardware, and firmware Any one of these implementations or an appropriate combination of any of them is implemented. Alternatively, one or more of the modules, sub-modules, units, and sub-units according to embodiments of the present disclosure may be implemented at least in part as computer program modules that, when executed, may perform corresponding functions.

例如,获取模块610、第一处理模块620、第二处理模块630、第三处理模块640以及第四处理模块650中的任意多个可以合并在一个模块中实现,或者其中的任意一个模块可以被拆分成多个模块。或者,这些模块中的一个或多个模块的至少部分功能可以与其他模块的至少部分功能相结合,并在一个模块中实现。根据本公开的实施例,获取模块610、第一处理模块620、第二处理模块630、第三处理模块640以及第四处理模块650中的至少一个可以至少被部分地实现为硬件电路,例如现场可编程门阵列(FPGA)、可编程逻辑阵列(PLA)、片上系统、基板上的系统、封装上的系统、专用集成电路(ASIC),或可以通过对电路进行集成或封装的任何其他的合理方式等硬件或固件来实现,或以软件、硬件以及固件三种实现方式中任意一种或以其中任意几种的适当组合来实现。或者,获取模块610、第一处理模块620、第二处理模块630、第三处理模块640以及第四处理模块650中的至少一个可以至少被部分地实现为计算机程序模块,当该计算机程序模块被运行时,可以执行相应的功能。For example, any number of the acquisition module 610, the first processing module 620, the second processing module 630, the third processing module 640, and the fourth processing module 650 may be combined in one module for implementation, or any one of the modules may be implemented by Split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the acquisition module 610 , the first processing module 620 , the second processing module 630 , the third processing module 640 , and the fourth processing module 650 may be implemented at least partially as a hardware circuit, such as an on-site Programmable Gate Array (FPGA), Programmable Logic Array (PLA), System-on-Chip, System-on-Substrate, System-on-Package, Application-Specific Integrated Circuit (ASIC), or any other reasonable It can be realized by hardware or firmware, or by any one of the three implementation modes of software, hardware and firmware, or by any appropriate combination of any of them. Alternatively, at least one of the acquisition module 610, the first processing module 620, the second processing module 630, the third processing module 640, and the fourth processing module 650 may be implemented at least partially as a computer program module when the computer program module is At runtime, the corresponding function can be executed.

图7示意性示出了根据本公开实施例的用于实现图像处理的计算机系统的方框图。图7示出的计算机系统仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。FIG. 7 schematically shows a block diagram of a computer system for implementing image processing according to an embodiment of the present disclosure. The computer system shown in FIG. 7 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.

如图7所示,实现图像处理的计算机系统700包括处理器701、计算机可读存储介质702。该系统700可以执行根据本公开实施例的方法。As shown in FIG. 7 , a computer system 700 for implementing image processing includes a processor 701 and a computer-readable storage medium 702 . The system 700 may perform methods according to embodiments of the present disclosure.

具体地,处理器701例如可以包括通用微处理器、指令集处理器和/或相关芯片组和/或专用微处理器(例如,专用集成电路(ASIC)),等等。处理器701还可以包括用于缓存用途的板载存储器。处理器701可以是用于执行根据本公开实施例的方法流程的不同动作的单一处理单元或者是多个处理单元。Specifically, the processor 701 may include, for example, a general-purpose microprocessor, an instruction set processor and/or a related chipset and/or a special-purpose microprocessor (eg, an application specific integrated circuit (ASIC)), and the like. The processor 701 may also include on-board memory for caching purposes. The processor 701 may be a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.

计算机可读存储介质702,例如可以是能够包含、存储、传送、传播或传输指令的任意介质。例如,可读存储介质可以包括但不限于电、磁、光、电磁、红外或半导体系统、装置、器件或传播介质。可读存储介质的具体示例包括:磁存储装置,如磁带或硬盘(HDD);光存储装置,如光盘(CD-ROM);存储器,如随机存取存储器(RAM)或闪存;和/或有线/无线通信链路。Computer-readable storage medium 702, for example, can be any medium that can contain, store, communicate, propagate, or transmit instructions. For example, a readable storage medium may include, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, device, or propagation medium. Specific examples of readable storage media include: magnetic storage devices, such as magnetic tapes or hard disks (HDDs); optical storage devices, such as compact disks (CD-ROMs); memories, such as random access memory (RAM) or flash memory; and/or wired /Wireless communication link.

计算机可读存储介质702可以包括计算机程序703,该计算机程序703可以包括代码/计算机可执行指令,其在由处理器701执行时使得处理器701执行根据本公开实施例的方法或其任何变形。The computer-readable storage medium 702 may include a computer program 703, which may include code/computer-executable instructions that, when executed by the processor 701, cause the processor 701 to perform methods according to embodiments of the present disclosure or any variation thereof.

计算机程序703可被配置为具有例如包括计算机程序模块的计算机程序代码。例如,在示例实施例中,计算机程序703中的代码可以包括一个或多个程序模块,例如包括703A、模块703B、……。应当注意,模块的划分方式和个数并不是固定的,本领域技术人员可以根据实际情况使用合适的程序模块或程序模块组合,当这些程序模块组合被处理器701执行时,使得处理器701可以执行根据本公开实施例的方法或其任何变形。The computer program 703 may be configured with computer program code comprising, for example, computer program modules. For example, in an example embodiment, the code in computer program 703 may include one or more program modules, eg, including 703A, module 703B, . . . It should be noted that the division method and number of modules are not fixed, and those skilled in the art can use appropriate program modules or combination of program modules according to the actual situation. When these combination of program modules are executed by the processor 701, the processor 701 can A method according to an embodiment of the present disclosure or any variation thereof is performed.

根据本公开的实施例,获取模块610、第一处理模块620、第二处理模块630、第三处理模块640以及第四处理模块650中的至少一个可以实现为参考图7描述的计算机程序模块,其在被处理器701执行时,可以实现上面描述的相应操作。According to an embodiment of the present disclosure, at least one of the acquisition module 610, the first processing module 620, the second processing module 630, the third processing module 640, and the fourth processing module 650 may be implemented as a computer program module described with reference to FIG. 7, When executed by the processor 701, it can implement the corresponding operations described above.

本公开还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的设备/装置/系统中所包含的;也可以是单独存在,而未装配入该设备/装置/系统中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被执行时,实现以上图像处理方法。The present disclosure also provides a computer-readable medium. The computer-readable medium may be included in the device/device/system described in the above embodiments; it may also exist alone without being assembled into the device/device/system. in the system. The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed, the above image processing method is realized.

根据本公开的实施例,计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、有线、光缆、射频信号等等,或者上述的任意合适的组合。According to an embodiment of the present disclosure, the computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In this disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, wireless, wireline, optical fiber cable, radio frequency signals, etc., or any suitable combination of the foregoing.

附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,上述模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图或流程图中的每个方框以及框图或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block in the block diagrams or flowchart illustrations, and combinations of blocks in the block diagrams or flowchart illustrations, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or by special purpose hardware-based systems that perform the specified functions or operations. A combination of hardware and computer instructions is implemented.

本领域技术人员可以理解,本公开的各个实施例和/或权利要求中记载的特征可以进行多种组合和/或结合,即使这样的组合或结合没有明确记载于本公开中。特别地,在不脱离本公开精神和教导的情况下,本公开的各个实施例和/或权利要求中记载的特征可以进行多种组合和/或结合。所有这些组合和/或结合均落入本公开的范围。Those skilled in the art will appreciate that various combinations and/or combinations of features recited in various embodiments and/or claims of the present disclosure are possible, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments of the present disclosure and/or in the claims may be made without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of this disclosure.

尽管已经参照本公开的特定示例性实施例示出并描述了本公开,但是本领域技术人员应该理解,在不背离所附权利要求及其等同物限定的本公开的精神和范围的情况下,可以对本公开进行形式和细节上的多种改变。因此,本公开的范围不应该限于上述实施例,而是应该不仅由所附权利要求来进行确定,还由所附权利要求的等同物来进行限定。Although the present disclosure has been shown and described with reference to specific exemplary embodiments of the present disclosure, those skilled in the art will appreciate that, without departing from the spirit and scope of the present disclosure as defined by the appended claims and their equivalents, Various changes in form and detail have been made in the present disclosure. Therefore, the scope of the present disclosure should not be limited to the above-described embodiments, but should be determined not only by the appended claims, but also by their equivalents.

Claims (13)

1. An image processing method comprising:
acquiring an original image, wherein the original image comprises an original histogram;
processing the original image to obtain an edge image and a non-edge image;
processing the edge image and the non-edge image respectively to obtain an edge histogram of the edge image and a non-edge histogram of the non-edge image;
processing the edge histogram and the non-edge histogram to obtain a fused histogram; and
processing the original histogram based on the fused histogram to obtain a processed histogram, so as to obtain a processed image according to the processed histogram, wherein the contrast of the processed image is higher than that of the original image.
2. The method of claim 1, wherein said processing said edge histogram and said non-edge histogram to obtain a fused histogram comprises:
respectively carrying out segmentation processing on the edge histogram and the non-edge histogram to obtain M segments of the edge histogram and N segments of the non-edge histogram, wherein M is an integer larger than 1, and N is an integer larger than 1;
processing the M segments respectively to obtain processed edge histograms;
processing the N segments respectively to obtain processed non-edge histograms; and
and fusing the processed edge histogram and the processed non-edge histogram to obtain the fused histogram.
3. The method of claim 2, wherein said processing the M segments separately to obtain processed edge histograms comprises:
determining the segment shift distance of each of the M segments to obtain M segment shift distances;
respectively carrying out shift processing on the M segments based on the M segment shift distances;
sequentially determining each of the M segments as a first segment, wherein the first segment comprises M gray values, each gray value of the M gray values has a corresponding pixel number, and M is an integer greater than or equal to 1;
determining the gray value shift distance of each gray value in the m gray values to obtain m gray value shift distances; and
and respectively carrying out shift processing on the m gray values based on the shift distances of the m gray values to obtain the processed edge histogram.
4. The method of claim 2 or 3, wherein the processing the N segments to obtain processed non-edge histograms respectively comprises:
determining the segment shift distance of each segment in the N segments to obtain N segment shift distances;
shifting the N segments based on the N segment shifting distances respectively;
sequentially determining each of the N segments as a second segment, wherein the second segment comprises N gray values, each gray value of the N gray values has a corresponding pixel number, and N is an integer greater than or equal to 1;
determining a gray value shift distance of each gray value in the n gray values to obtain n gray value shift distances; and
and respectively carrying out shift processing on the n gray values based on the shift distances of the n gray values to obtain the processed non-edge histogram.
5. The method of claim 3, wherein:
the determining a segment shift distance for each of the M segments comprises: calculating the segment shift distance of each segment in the M segments according to the number of pixels in each segment in the M segments, the number M of the segments of the edge histogram and the total number of pixels of the edge histogram;
the determining a gray value shift distance for each of the m gray values comprises: and calculating the gray value shift distance of each gray value in the m gray values according to the number of pixels of each gray value in the m gray values, the number m of the gray values of the first segment and the total number of pixels of the first segment.
6. The method of claim 4, wherein:
the determining a segment shift distance for each of the N segments comprises: calculating the segment shift distance of each segment in the N segments according to the number of pixels in each segment in the N segments, the number N of the segments of the edge histogram and the total number of pixels of the edge histogram;
the determining a gray value shift distance for each of the n gray values comprises: and calculating the gray value shift distance of each gray value in the n gray values according to the number of pixels of each gray value in the n gray values, the number n of the gray values of the first segment and the total number of pixels of the first segment.
7. The method of claim 2, wherein the segmenting the edge histogram and the non-edge histogram to obtain M segments of the edge histogram and N segments of the non-edge histogram comprises:
calculating a first sparse value of the edge histogram and a second sparse value of the non-edge histogram, wherein the first sparse value is used for representing the deviation degree of each pixel number in the edge histogram, and the second sparse value is used for representing the deviation degree of each pixel number in the non-edge histogram;
determining p gray values corresponding to the situation that the number of pixels in the edge histogram is smaller than the first sparse value, wherein p is an integer larger than or equal to 1;
determining q gray values corresponding to the situation that the number of pixels in the non-edge histogram is smaller than the second sparse value, wherein q is an integer larger than or equal to 1;
taking the p gray values as breakpoints, and carrying out segmentation processing on the edge histogram to obtain M segments; and
and taking the q gray values as break points, and carrying out segmentation processing on the non-edge histogram to obtain N segments.
8. The method of claim 1, wherein said processing said original histogram based on said fused histogram resulting in a processed histogram comprises:
determining a cumulative distribution function of the fused histogram;
determining a cumulative distribution function of the original histogram;
calculating the cumulative distribution function of the fused histogram and the cumulative distribution function of the original histogram to obtain a gray value change relation, wherein the gray value change relation comprises enhanced gray values corresponding to all gray values in the original histogram; and
and moving each gray value in the original histogram to a corresponding enhanced gray value based on the gray value change relation to obtain a processed histogram.
9. The method of claim 1, wherein the processing the original image to obtain an edge image and a non-edge image comprises:
calculating a gradient value of each pixel in the original image;
determining pixels with gradient values larger than a preset gradient value as pixels in the edge image; and
and determining the pixels with the gradient values smaller than or equal to the preset gradient values as the pixels in the non-edge image.
10. The method of claim 1, further comprising:
before processing the original image to obtain an edge image and a non-edge image, filtering the original image by using a Gaussian filtering mode so as to remove at least part of noise information in the original image.
11. An image processing apparatus comprising:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring an original image, and the original image comprises an original histogram;
the first processing module is used for processing the original image to obtain an edge image and a non-edge image;
the second processing module is used for respectively processing the edge image and the non-edge image to obtain an edge histogram of the edge image and a non-edge histogram of the non-edge image;
the third processing module is used for processing the edge histogram and the non-edge histogram to obtain a fused histogram; and
and the fourth processing module is used for processing the original histogram based on the fused histogram to obtain a processed histogram so as to obtain a processed image according to the processed histogram, wherein the contrast of the processed image is higher than that of the original image.
12. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-10.
13. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 10.
CN202010056778.XA 2020-01-17 2020-01-17 Image processing method, device, electronic device and medium Active CN111242879B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010056778.XA CN111242879B (en) 2020-01-17 2020-01-17 Image processing method, device, electronic device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010056778.XA CN111242879B (en) 2020-01-17 2020-01-17 Image processing method, device, electronic device and medium

Publications (2)

Publication Number Publication Date
CN111242879A true CN111242879A (en) 2020-06-05
CN111242879B CN111242879B (en) 2023-05-16

Family

ID=70872744

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010056778.XA Active CN111242879B (en) 2020-01-17 2020-01-17 Image processing method, device, electronic device and medium

Country Status (1)

Country Link
CN (1) CN111242879B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115631122A (en) * 2022-11-07 2023-01-20 北京拙河科技有限公司 Image optimization method and device for edge image algorithm

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105160682B (en) * 2015-09-11 2018-07-03 四川华雁信息产业股份有限公司 Method for detecting image edge and device
CN108846319A (en) * 2018-05-25 2018-11-20 平安科技(深圳)有限公司 Iris image Enhancement Method, device, equipment and storage medium based on histogram

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115631122A (en) * 2022-11-07 2023-01-20 北京拙河科技有限公司 Image optimization method and device for edge image algorithm

Also Published As

Publication number Publication date
CN111242879B (en) 2023-05-16

Similar Documents

Publication Publication Date Title
CN108805023B (en) Image detection method, device, computer equipment and storage medium
US11410277B2 (en) Method and device for blurring image background, storage medium and electronic apparatus
CN111402146B (en) Image processing method and image processing apparatus
US9697416B2 (en) Object detection using cascaded convolutional neural networks
US8670622B2 (en) Image processing apparatus, image processing method, and computer-readable recording medium
US9928590B2 (en) Image processing apparatus, image processing method, and computer-readable recording device for determining whether candidate region is abnormality or residue
CN110008806B (en) Information processing device, learning processing method, learning device, and object recognition device
CN112183541B (en) Contour extraction method and device, electronic equipment and storage medium
US20150092993A1 (en) Image processing apparatus, image processing method, and computer-readable recording device
US10440241B2 (en) Image processing apparatus, image processing method, and surgical system
US20200342598A1 (en) Image diagnosis support system and image diagnosis support method
US11348349B2 (en) Training data increment method, electronic apparatus and computer-readable medium
US20170294014A1 (en) Image processing used to estimate abnormalities
Wang et al. Variational based smoke removal in laparoscopic images
CN112508816B (en) Infrared image sharpening method, sharpening processing system and terminal equipment
CN110910445B (en) Object size detection method, device, detection equipment and storage medium
CN110570379B (en) Non-local mean value CT image noise reduction method based on structure tensor
CN114494174A (en) Method and device for detecting chip bonding line defects
CN111242879B (en) Image processing method, device, electronic device and medium
CN114429430A (en) Image processing method, electronic device and non-transitory computer readable medium
CN112927151A (en) Image denoising method based on edge enhancement and convolutional neural network
CN111428567B (en) Pedestrian tracking system and method based on affine multitask regression
CN114926448B (en) A method for extracting feature points from capsule endoscope images
CN113657245B (en) Method, device, medium and program product for human face living body detection
Lee et al. A 4K-capable hardware accelerator of haze removal algorithm using haze-relevant features

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