0% found this document useful (0 votes)
6 views

Image Filter Design and Implementation Based On API

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Image Filter Design and Implementation Based On API

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

2011 International Conference on Intelligence Science and Information Engineering

Image Filter Design and Implementation Based on API

Yurong Guan Fen Zhou


Department of Mathematics and Computer Science Department of Mathematics and Computer Science
Huanggang Normal University Huanggang Normal University
Hubei, China Hubei, China
[email protected] [email protected]

Abstract—In this paper, Visual Basic development platform to Windows systems combined experience of more directly to
implement the general professional image software can only be the power of API functions.
used to complete the image filter processing, the main In practice, in order to obtain a more accurate color
application the power of Windows API functions, on the one image filter processing used, simply, that is to see the image
hand improve the ability of VB's advanced application through a color change in the color image processing to
programming, the other hand, image processing also a new achieve some special effects, often used in cell analysis ,
understanding of the field. In fact, the Visual Basic program blood tests and other medical fields, with photography and
development environment through the use of API Viewer is other aspects of digital photography and the everyday life of
simple and convenient way to call the API function, not only
sunglasses and other simple products. Therefore, the use of
provides a completely different programming approach in the
Windows environment, but also the user into the core of
filter handle situations is very extensive analysis of the
operating system for advanced programming a way, it shows process it is very necessary, and most people are accustomed
the VB language specific features and attributes of other to using image processing professional image processing
programming language can not be completed. The design is software such as PhotoShop, few people can think of VB to
based on API functions GetPixel and SetPixel features and accomplish this same work, which can be seen not only the
functions, first introduced the general principles of VB design of the VB language advanced applications, but also
interface design, and the image filter interface design in detail broaden people's ideas to solve the problem, and the image
of the VB form; then combined GetPixel and SetPixel API filter processing a more thorough understanding.
functions are introduced in detail statement and call the
method; then introduces the VB method in the basic color II. FORMS INTERFACE DESIGN
settings, and preparation of the corresponding event procedure Visual Basic by dragging the mouse controls on the form
code to implement a variety of monochrome images and mixed the way for the creation of user interface provides a very
color filter processing; the system user-friendly, readable, easy way, form design and planning not only affect the
concise efficient, the last run result is correct, to achieve design appearance of its own can watch, but also the operability of
goals, VB platform allows users to experience the powerful
the application there is also a important role[2]. Therefore,
function of Windows API programming skills and capability.
the interface design can begin, first form to be designed to
Keywords-API Function;vb Advanced Applications; Image draw a draft on paper, and then consider what control is
filter; DLL library needed, the link between the control and end up in handy.
A. Drag the position of the control arrangements
I. INTRODUCTION Controls the positioning of the more important position
Application Programming Interface (API) is a major in the clear, important and requires frequent access controls
group of pre-written with C language functions and should be in a prominent position, the secondary should be in
procedures.in the Dynamic-Link Libraries(DLL). Usually control is a secondary position. Appropriate controls and
when you install Windows operating system, these functions elements of the group is also very important, and generally in
and processes to be installed, therefore, use the API accordance with the control in the functional link them
functions on various platforms, not only can fully tap the together, than in the visual effects are also scattered them
potential of its Windows operating system, and be able to around the screen much better.
develop powerful applications to the various Show each
B. Control the size and consistency of layout
platform-specific features and attributes. This article for
Visual Basic, the most simple way is to use a predefined API Reasonable to set the size of the control to achieve
provided a statement to declare the DLL as long as the consistency in interface design is one of the important issues,
external procedure or function, you can call the same as its consistency, appearance will reflect the application of
internal processes and implemented[1]. Of course, the main coordination. If the lack of consistency will make the
use in the design and SetPixel GetPixel two colors on the interface confusing and chaotic, so the interface will make
API function of the image pixels, and then be able to achieve the application look confusing and not strict, not only on the
the relevant set of monochrome image or a combination of user's inconvenience, or even the user that the application is
color filters, allowing users to VB perfect platform and not reliable.

978-0-7695-4480-9/11 $26.00 © 2011 IEEE 239


DOI 10.1109/ISIE.2011.89
C. Rational use of space and to maintain the simplicity of has been added to the project Module1 module, you can call
the interface the two API functions. Module1 code module as follows:
Fair use in the user interface form controls and between x Public Declare Function GetPixel Lib "gdi32" Alias
controls help to highlight the blank area around the role of "GetPixel" (ByVal hdc As Long, ByVal x As Long,
control, Consistent spacing between the controls and the ByVal y As Long) As Long
vertical and horizontal alignment of the controls can make x Public Declare Function SetPixel Lib "gdi32" Alias
the design more clear, orderly ranks, line spacing consistent, "SetPixel" (ByVal hdc As Long, ByVal x As Long,
neatly arranged interface will make it easier to read. ByVal y As Long, ByVal crColor As Long) As Long

D. Rational use of color and display to achieve the unity of B. API Function Call
content and form As long as the API function is declared, then the function
According to the experience of many programmers, call approach is very simple and convenient. Function call
applications should try to limit the types of color and tone with the Visual Basic function call within the function is
should be consistent. In addition, the use of images and icons similar, you can call directly in the expression. The format is:
can also increase the visual impact of the application, a Process name <parameter list>
reasonable choice of a variety of user interface display, but x Function procedure returns a value.
also to express a specific design intent. x If you sometimes do not need to process the return
The emergence of Visual Basic simplifies the design of value, Function can also be written as the Sub
Windows programming interface,it is very easy to design procedure call as a separate statement, the call
and implement standards and consistent with the general format: Call procedure name [(parameter list)] or
characteristics of the interface. According to the design procedure name [parameter list].
requirements, first start VB6.0 application and automatically First of all here in course of the incident by Rgbp =
create a name in the project form as Form1; and then, in its GetPixel (PicHdc, i, j) statement GetPixel function call to
form to add a PictureBox control, one control groups that complete to obtain a point in the image pixel RGB value;
contains three TextBox, one control group contains three then the red, green, blue three primary colors of a point pixel
HScrollBar and two CommandButton controls, the interface color filter processing of various colors, have a point the new
design shown in Figure 1, of course, also need to modify the RGB pixel values; Finally SetPixel PicHdc, i, j, Rgbp
form and the control of the property value in the Properties statement SetPixel function of procedure call, set the value
window; Finally, add a public module named Module1 to with the new RGB pixel color of a point complete the
project. corresponding color image filter.
IV. SYSTEM IMPLEMENTATION AND RUN

A. Color settings method


In Visual Basic platform, forms, controls, graphics, and
text messages can be displayed in different colors. Common
method to set the color palette and the use of color
parameters. Palette can be used in the design phase to set the
color of a form or control. If you want to set the program
Figure 1. Image Filter Interface
running the color of an object, you must use the color
parameters[4]. In fact, Visual Basic system, all of the color
property by a long integer value that set in with the color
III. API DECLARATION AND CALL palette within the Visual Basic will also be represented as a
The design need to call the two API functions GetPixel color parameter.
and SetPixel, which GetPixel function for the specified When the program runs the 4 way Specified the color
device to get a scene pixel RGB values, SetPixel function for parameter value: Use the RGB function; use QBColor
the specified device to set a scene pixel RGB values[3]. function; using Visual Basic color constants; direct input
color values.
A. API Function Declaration x RGB color function that the principle is the nature of
In accordance with the VB function is called the principle any color can be red, green, and blue colors
of first use of declaration, first click the "Add" menu "Add- constitute the three basic. RGB function returns a
In Manager" command key, open the "Add Manager" dialog Long integer that represents an RGB color value.
box, double-click the "VB 6 API Viewer" to load ; then open Format: RGB (red, green, blue), which, red, green,
"API Browser" window, click "File" menu, "Load Text File" blue these 3 colors, the range of 0 to 255, indicating
command key, the "Win32api.txt" file can be loaded in the that the value of color brightness, 0 minimum
"Available items" option and double-click GetPixel SetPixel brightness, while the maximum brightness of 255.
function; the final declaration of the function copy the code x QBColor function is used in QuickBasic 16
predefined colors. QBColor function returns a Long
integer that represents the RGB color value

240
corresponding to the color code. Format: QBColor
(color), which, color parameter is a sector in an
integer from 0 to 15, representing 16 kinds of colors.
x Long integer to directly specify the color, and often
expressed in hexadecimal. Format: & HBBGGRR,
of which, BB specify the value of the blue color, GG
specified the value of the green color, RR specified
the value of the red color. Each color value is a
hexadecimal number by two, the range of 00 ~ FF. Figure 3. Yellow Filter
x In the Visual Basic system has been pre-defined
color constants commonly used colors, a common
color constants (ColorConstants) and the colors used V. CONCLUSION
in Windows Control Panel (SystemColorConstants). API is used to control the Windows operating system
Through the "View" menu in the "Object Browser" appearance and behavior of the various components of a pre-
check list of common color constants. defined functions. If the associated application can directly
B. Implementation and Performance call the API function is to provide the service using the
First, write code in Form_Load event procedure, set the system, which will make it run more streamlined and
form's ScaleMode property value, set the PictureBox's efficient, especially in Visual Basic language in this area
ScaleMode, AutoRedraw and AutoRedraw property value, very well, by using the API Viewer that is simpler The
set the TextBox's Text property value[4]. And then in the method provides programming in the Windows environment,
process of writing code HS1_Change event, able to represent a completely different approach. The design of this by
the three colors of the scroll bar value of the rolling block is calling GetPixel and SetPixel 2 API functions to achieve a
displayed in the appropriate TextBox. Then write in the variety of monochrome images and mixed color filter,
Cmd2_Click event procedure code to call the API function allowing users to further experience the VB platform
can be achieved in the picture on the PictureBox filter out. powerful programming capabilities.
The last event in the process of writing code Cmd1_Click REFERENCES
PictureBox in the picture on the color recovery.
[1] Weijiang Jiang and Shaojing Lin, Visual Basic API programming
This design can be respectively red, green, blue and other hundred cases pass, Science Press, October 2001, pp.10-13
color filters to achieve complete, such as running a red drag [2] “VB in the user interface design principles” June 2008, Source: enet,
the horizontal scroll bar to the maximum, the corresponding http://www.searchdatabase.com.cn/ShowContent_8823.htm
TextBox shows a red 100%, then click the Filter command [3] API Function Descriptions, http://www.programfan.com/vbapi.asp
button the picture box image to the red filter, run the results [4] Dingxue Wu, Visual Basic Programming, Science Press, February
shown in Figure 2. 2008, pp.56-59
[5] “An image filter processing”, http://www.chinavb.net

Figure 2. Red Filter

Of course, to complete a variety of different colors mixed


filter, click the Reset command button to restore image
colors, If the red horizontal scrolling Article and green
horizontal scroll bar is dragged to the maximum, then the
picture of the picture box at this time can be yellow filter,
operating results shown in Figure 3. Which results from the
operation of the system is fully able to realize the image
colors filter, and the operation is very simple and easy, so in
real life there are many useful, Take the doctor, in a
comparative analysis of the human body part of the organ
when you can focus on certain organs filter, this will come to
a clearer conclusion, of course, there are many situations
require the application of the image filter is not need to one
by one example of the it.

241

You might also like