BMP图像处理软件的设计和实现(中英文翻译)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
译文
BMP图像处理软件的设计与实现
摘要
随着时代的发展,科技的进步,一些简单的图片已经不能满足人们的需求。
图像运用的扩大与对图像本身的精益求精,使人们越来越依赖于各种图像处理软件,各种图像处理软件也越来越完善,普及程度不断的提高。
C++是可视化的快速应用程序开发语言,它提供了可视化的集成开发环境,这一环境为应用程序设计人员提供了一系列灵活而先进的工具,可以广泛地用于种类应用程序设计。
在Visual C++的集成开发环境中,用户可以设计程序代码、运行程序、进行程序错误的调试等,可视化的开发方法降低了应用程序开发的难度。
Visual C++的基础编程语言是具有面向对象特性的C++语言,C++具有代码稳定、可读性好、编译速度快,效率高等优点,并将面向对象的概念得到充分的发挥,使这种语言有了全新的发展空间。
文章用Visual C++作为开发工具,设计了一个BMP图像处理软件。
本图像处理软件实现对BMP图像的基本操作,如图像的打开,关闭,保存,图像的基本处理,如图像放大、缩小、旋转、转置、二值化处理、中值滤波、边缘检测、直方图、图像的腐蚀与膨胀以及马赛克效果等等。
BMP是bitmap的缩写,即为位图图片。
位图图片是用一种称作“像素”的单位存贮图像信息的。
这些“像素”其实就是一些整齐排列的彩色(或黑白)点,如果这些点被慢慢放大,就会看到一个个的“像素”中添充着自己的颜色,这些“像素”整齐地排列起来,就成为了一幅BMP图片,并以.bmp(.rle,.dib等)为扩展名。
BMP(Bitmap-File)图形文件是Windows采用的图形文件格式,在Windows 环境下运行的所有图象处理软件都支持BMP图象文件格式。
BMP:Windows位图可以用任何颜色深度(从黑白到24位颜色)存储单个光栅图像。
Windows 位图文件格式与其他Microsoft Windows 程序兼容。
它不支持文件压缩,也不适用于Web 页。
从总体上看,Windows 位图文件格式的缺点超过了它的优点。
图像处理方法的研究源于两个主要应用领域:其一是为了便于人们分析而对图像信息进行改进;其二是为使机器自动理解而对图像数据进行存储、传输及显示。
一幅图像可定义为一个二维函数f(x,y),这里x和y是空间坐标,而在任何一对空间坐标(x,y)上的幅值f称为该点图像的强度或灰度。
当x,y和幅值f为有限的、离散的数值时,称该图像为数字图像。
数字图像处理是指借用数字计算机处理数字图像,值得提及的是数字图像是由有限的元素组成的,每一个元素都有一个特定的位置和幅值,这些元素称为图像元素、画面元素或像素。
像素是广泛用于表示数字图像元素的词汇。
图像处理涉及的范畴或其他相关领域(例如,图像分析和计算机视觉)的界定在初创人之间并没有一致的看法。
有时用处理的输入和输出内容都是图像这一
特点来界定图像处理的范围。
我们认为这一定义仅是人为界定和限制。
例如,在这个定义下,甚至最普通的计算一幅图像灰度平均值的工作都不能算做是图像处理。
另一方面,有些领域(如计算机视觉)研究的最高目标是用计算机去模拟人类视觉,包括理解和推理并根据视觉输入采取行动等。
这一领域本身是人工智能的分支,其目的是模仿人类智能。
人工智能领域处在其发展过程中的初期阶段,它的发展比预期的要慢的多,图像分析(也称为图像理解)领域则处在图像处理和计算机视觉两个学科之间。
1.图像处理涉及的领域:
图像获取是第一步处理。
注意到获取与给出一幅数字形式的图像一样简单,通常,图像获取包括如设置比例尺等预处理。
图像增强是图像处理最简单和最有吸引力的领域。
基本上,增强技术后面的思路是显现那些被模糊了的细节,或简单地突出一幅图像中感兴趣的特征。
图像复原也是改进图像外貌的一个处理领域。
然而,不像增强,图像增强是主观的,而图像复原是客观的。
在某种意义上说,复原技术倾向于以图像退化的数学或概率模型为基础,另一方面,增强以怎样构成好的增强效果的主观偏爱为基础。
彩色图像处理已经成为一个重要领域,因为基于互联网的图像处理应用在不断增长。
就使得在彩色模型、数字域的彩色处理方面涵盖了大量基本概念,在后续发展,彩色还是图像中感兴趣特征被提取的基础。
小波是在各种分辨率下描述图像的基础。
特别是在应用中,这些理论被用于图像数据压缩及金字塔描述方法。
在这里,图像被成功地细分为较小的区域,压缩,正如其名称所指的意思,所涉及的技术是减少图像的存储量,或者在传输图像时降低频带。
形态学处理设计提取图像元素的工具,它在表现和描述形状方面非常有用,从输出图像处理到输出图像特征处理的转换。
分割过程将一幅图像划分为组成部分或目标物。
通常,自主分割是数字图像处理中最为困难的任务之一,复杂的分割过程导致成功解决要求物体被分别识别出来的成像问题需要大量处理工作。
另一方面,不健壮且不稳定的分割算法几乎总是会导致最终失败。
通常,分割越准确,识别越成功。
2.图像处理功能模块中涉及的某些重要算法:
中值滤波:中值滤波是一种非线性数字滤波器的信号并且能够保持锋利变化,在去除脉冲噪声方面非常有效(或椒盐噪声)。
较高的脉冲噪声的灰度低,它不同于附近点。
线性过滤器没有能力去除这种噪声没有影响区分的特征信号,中位数过滤器有显著优势在这个特定类型的噪声线性过滤器。
因此,中值滤波器在数字信号和图像/视频处理应用程序方面应用非常广泛。
标准中值操作由滑动窗口实现起一个图像的大小。
在每个窗口位置信号的采样值中排序并且用样品的中值作为输出,取代了样本中心的窗口。
中值滤波的主要问题是它的高计算成本(排序N像素,时间复杂度是0(N log N),即是最有效的排序算法),在中值滤波进行了实时软件实现的过程中,通用处理器通常不会给出好的结果。
中值滤波器的初始版本是使用VC++语言编程,所以它的操作是可以验证的,其结果能跟硬件版本相比较,后线代表中值滤波器的伪代码。
形态学运算:形态学图像处理是指一个类的算法应用于一个图像的几何结构,还可以用于二进制和形态灰度图像,还应用于许多图像处理的领域,如骨架化、边缘检测、修复和纹理分析。
形态学算子使用结构化元素来处理一个图片。
结构元素是在一个图像窗口上扫描,这种类似的使用的中值滤波器结构元素可以是任何大小像素窗口,但3 x3和5 x5的大小是最常见的。
当结构元素扫描一个元素的形象,构建元素符合或
不符合图,演示了合适的结构元素的概念,而不是关联在一个图像对象中。
最基本的许多形态运算是侵蚀和构建块扩张。
侵蚀顾名思义是萎缩或侵蚀一个对象在一个图像,扩张是另一方面生长图像对象,依赖于这两个对象结化元素以及它的对象。
例如,如果侵蚀二进制图像,合成图像是有每个前景像素的中心像素,其结构化元素适合其形象,如果应用扩张,将输出每个前景像素点的结构元素。
其中重要的操作就像打开和关闭一个图像可以通过执行侵蚀和扩张来进行,如果侵蚀后面接着扩张,由此产生的操作被称为开放,关闭操作扩张侵蚀。
这两个次级形态操作可用于图像恢复,和他们进一步迭代使用能产生最佳的结果等,就像输入图像的骨架化。
边缘检测:图像中边缘的地方,有很强的边缘强度对比。
通常发生在图像代表对象边界的位置,它广泛应用于边缘检测代表图像的边缘图像分割,具有更大的优势的数据量显著降低,同时保持图像的大部分信息。
可以应用傅里叶检测到边缘域中的高通滤波器频率或缠绕的图像与一个合适的内核空间域。
在实践中,边缘检测是在空间域执行的,因为它在计算上更少,也昂贵,但是往往会产生更好的结果,因为边缘对应于强烈的照明图像的梯度,比如衍生品用于计算边缘。
精明的边缘检测算法被认为是一种“标准方法”,它是许多研究人员所使用的,因为它设计的是一个最优检测器和边缘薄。
精明的边缘检测工作内核使用线性滤波和高斯平滑噪声,然后计算每个像素的强度和方向平滑图像的优势,这是通过在两个正交方向和梯度计算作为根级平方和的衍生品,以便用来该方法区分图像,梯度方向计算使用衍生品的比率的反正切。
候选边缘像素确认为生存的像素变薄过程称为“无最大值的裁剪”,在这个过程中,每个候选边缘像素的边缘强度设置为0,如果其优势强度并不同于边缘强度两个相邻像素的梯度方向。
然后做阈值以便减少边缘图像级数,滞后两个边缘强度阈值。
所有候选边缘像素没有边缘值低于低阈值,和上面的像素值高阈值被认为是作为明确的边缘。
以上所有像素低阈值,通过连接到任何一个像素高阈值作为上边缘像素,精明的边缘检测的示意图如图所示。
外文原文
Design and Implementation of BMP Image Processing System Abstract
With the development of science, the simple pictures couldn’t meet people’s demand. The magnification of picture’s usage and the ever delicate image of picture itself, has made people more and more rely on several of picture-processing software. And the popularization of these software are going higher and higher, with the progress made by themselves.
C++ is a rapid application development of visual language, and it provides a visual integrated development environment, the environment for the application designer provides a series of flexible and advanced tools, can be widely used in the design of type application.In Visual C++integrated development environment, the user can design the program code, run the program, program error of debugging, etc., the development of visualization method reduces the difficulty of the application development.Visual C++ programming language is the basis of the object-oriented C++ language.With C++ code stability, good readability and compilation speed, higher efficiency, and the object-oriented concepts are fully play, make the language a new space for development.
The essay use Visual C++ development to build software which is used to deal with BMP images. This software can carry out some base operations of BMP images, such as open, close and save;some base processes of BMP images, such as magnify, shrink, rotate, binary process, mid-value filter, edge-detect, cauterization of pictures and the mosaic effect.
BMP is the abbreviation of bitmap, as bitmap images.Bitmap images are in a unit called "pixel" storage of image information.These "pixel" is actually some neat color or black and white points, if these points are slowly zoom in, you'll see one by one "pixel" in charge of his own color, these "pixel" neatly lined up and became a BMP images, and with. BMP (, rle, dib, etc.) for the extension.BMP Bitmap - File) graphics File format that is used by the graphics File is Windows in Windows environment running all image processing software supports BMP image File format.BMP: Windows bitmap can use any color depth (from black and white to 24-bit color) to store a single raster image.Windows bitmap file format compatible with other Microsoft Windows programs.It does not support file compression, and does not apply to a Web page.Overall, Windows bitmap file format the disadvantages outweigh its advantages.
Interest in digital image processing methods stems from two principal applicant- ion areas: improvement of pictorial information for human interpretation; and
processing of image data for storage, transmission, and representation for au- tenuous machine perception.
An image may be defined as a two-dimensional function, f(x, y), where x and y are spatial (plane) coordinates, and the amplitude of f at any pair of coordinates (x, y) is called the intensity or gray level of the image at that point. When x, y, and the amplitude values of f are all finite, discrete quantities, we call the image a digital image. The field of digital image processing refers to processing digital images by means of a digital computer. Note that a digital image is composed of a finite number of elements, each of which has a particular location and value. These elements are referred to as picture elements, image elements, peels, and pixels. Pixel is the term most widely used to denote the elements of a digital image.
There is no general agreement among authors regarding where image processing stops and other related areas, such as image analysis and computer vi-son, start. Sometimes a distinction is made by defining image processing as a discipline in which both the input and output of a process are images. We believe this to be a limiting and somewhat artificial boundary. For example, under this definition, even the trivial task of computing the average intensity of an image (which yields a single number) would not be considered an image processing operation. On the other hand, there are fields such as computer vision whose ultimate goal is to use computers to emulate human vision, including learning and being able to make inferences and take actions based on visual inputs. This area itself is a branch of artificial intelligence (AI) whose objective is to emulate human intelligence. The field of AI is in its earliest stages of infancy in terms of development, with progress having been much slower than originally anticipated. The area of image analysis (also called image understanding) is in be- teen image processing and computer vision.
1.Image processing areas
Image acquisition is the first process. Note that acquisition could be as simple as being given an image that is already in digital form. Generally, the image acquisition stage involves processing, such as scaling.
Image enhancement is among the simplest and most appealing areas of digital image processing. Basically, the idea behind enhancement techniques is to bring out detail that is obscured, or simply to highlight certain features of interest in an image. Image acquisition is the first process. Note that acquisition could be as simple as being given an image that is already in digital form. Generally, the image acquisition stage involves processing, such as scaling.
Image restoration is an area that also deals with improving the appearance of an image. However, unlike enhancement, which is subjective, image restoration is objective, in the sense that restoration techniques tend to be based on mathematical or
probabilistic models of image degradation. Enhancement, on the other hand, is based on human subjective preferences regarding what constitutes a “good” enhancement result.
Color image processing is an area that has been gaining in importance because of the significant increase in the use of digital images over the Internet. It covers a number of fundamental concepts in color models and basic color processing in a digital domain. Color is used also in later chapters as the basis for extracting features of interest in an image.
Wavelets are the foundation for representing images in various degrees of resolution. In particular, this material is used in this book for image data compression and for pyramidal representation, in which images are subdivided successively into smaller pression, as the name implies, deals with techniques for reducing the storage required saving an image, or the bandwidth required transmitting it.
Morphological processing deals with tools for extracting image components that are useful in the representation and description of shape. It begins a transition from processes that output images to processes that output image attributes.
Segmentation procedures partition an image into its constituent parts or objects. In general, autonomous segmentation is one of the most difficult tasks in digital image processing. A rugged segmentation procedure brings the process a long way toward successful solution of imaging problems that require objects to be identified individually. On the other hand, weak or erratic segmentation algorithms almost always guarantee eventual failure. In general, the more accurate the segmentation, the more likely recognition is to succeed.
2.Involved in the image processing function module of some important algorithms
A Median filter:A Median filter is a non-linear digital filter which is able to preserve sharp signal changes and is very effective in removing impulse noise (or salt and pepper noise).
An impulse noise has a gray level with higher low that is different from the neighborhood point. Linear filters have no ability to remove this type of noise without affecting the distinguishing characteristics of the signal;median filters have remarkable advantages over linear filters for this particular type of noise. Therefore median filter is very widely used in digital signal and image/video processing applications.
A standard median operation is implemented by sliding a window of odd size (e.g3x3 window) over an image. At each window position the sampled values of signal image are sorted, and the median value of the samples is taken as the output that replaces the sample in the center of the window.
The main problem of the median filter is its high computational cost (for sorting N pixels, the time complexity is 0(N log N), even with the most efficient sorting algorithms). When the median filter is carried out in real time, the software implementation in general-purpose processors does not usually give good results.
The initial version of the median filter is programmed using Visual C++ on PC, so that its operation could be verified and its results could be compared to the hardware version.
Morphological Operators:The term morphological image processing refers to a class of algorithms that is interested in the geometric structure of an image. Morphology can be used on binary and gray scale images, and is useful in many areas of image processing, such as skeletonization, edge detection, restoration and texture analysis.
A morphological operator uses a structuring element to process an image. The structuring element is a window scanning over an image, which is similar to the pixel window used in the median filter. The structuring element can be of any size,but 3x3 and 5x5 sizes are common. When the structuring element scans over an element in the image, either the structuring element fits or does not fit demonstrates the concept of a structuring element fitting and not fitting inside an image object.
The most basic building blocks for many morphological operators are erosion and dilation. Erosion as the name suggests is shrinking or eroding an object in an image.Dilation on the other hand grows the image object. Both of these objects depend on the structuring element and how it fits within the object. For example, if erosion is applied to an binary image, the resultant image is one where there is a foreground pixel for every center pixel where its structuring element fit within an image. If dilation is applied, the output will be a foreground pixel for every point in the structuring element.
Important operations like opening and closing of an image can be derived by performing erosion and dilation in different order. If the erosion is followed by dilation, the resulting operation is called an opening. Closing operation is dilation followed by erosion. These two secondary morphological operations can be useful in image restoration, and their iterative use can yield further interesting results such as; skeletonization of an input image.
Edge Detection:Edges are places in the image with strong intensity contrast. Edges often occur at image locations representing object boundaries; edge detection is extensively used in image segmentation. Representing an image by its edges has the further advantage that the amount of data is reduced significantly while retaining most of the image information.
Edges can be detected by applying a high pass frequency filter in the Fourier domain or by involving the image with an appropriate kernel in the spatial domain. In practice,edge detection is performed in the spatial domain, because it is computationally less expensive and often yields better results. Since edges correspond to strong illumination gradients, the derivatives of the image are used for calculating the edges.
The Canny edge detection algorithm is considered a "standard method" and it is used by many researchers, because it was designed to be an optimal edge detector and thin edges. The Canny operator works in a multi-stage process. Canny edge detection uses linear filtering with a Gaussian kernel to smooth noise and then computes the edge strength and direction for each pixel of the smoothed image. This is done by differentiating the image in two orthogonal directions and computing the gradient magnitude as the root sum of squares of the derivatives. The gradient direction is computed using the ratio of the derivatives. Candidate edge pixels are identified as the pixels that survive a thinning process called non-maximal suppression.In this process,
the edge strength of each candidate edge pixel is set to zero if its edge strength is not larger than the edge strength of the two adjacent pixels in the gradient direction. Thresholding is then done on the thinned edge magnitude image using hysteresis. In hysteresis, two edge strength thresholds are used. All candidate edge pixel values below the lower threshold are labeled as non-edges, and the pixels values above the high threshold are considered as definite edges. All pixels above low threshold that be connected to any pixel above the high threshold through a chain are labeled as edge pixels. The schematic of the canny edge detection is shown below.。