Using the Java 2D ConvolveOp Filter Class to Process Images Los Angeles CA

Learn how to write programs that use the ConvolveOp class of the Java 2D API to perform two-dimensional image convolution. Also, learn about some of the weaknesses of the ConvolveOp class that result from a lack of options for dealing with convolution output values greater than 255 and less than 0.

Local Companies

Moyea Software
92295612365
Hot building, ring street
LA, CA
Interneer Inc.
8005586832 x85
6101 W. Centinela Ave.
Culver City, CA
Cornerstone Concepts Inc
818-247-3909
600 W Broadway
Glendale, CA
Greene Computer Corporation
(818) 956-4961
200 S. Louise Street
Glendale, CA
Corticalx Inc Software Solutions & Technology
818-500-0881
425 E Colorado St
Glendale, CA
Alphatier Systems
818-409-8920
517 Griswold St
Glendale, CA
TimeTECH - Customizable Time and Attendance / Workforce Management Solutions
905-677-7009
7420 Airport Rd 203
Mississauga, CA
Hutchinson & Bloodgood, LLP
(818) 637-5000
101 N. Brand Blvd. #1600
Glendale, CA
Telsoft Solutions
818-545-8680
100 N Brand Blvd
Glendale, CA
Abraxas Technologies Inc
818-502-9100
450 N Brand Blvd
Glendale, CA

provided by: 
Originally published at Internet.com


Java Programming Notes # 460 * Preface * General * Viewing tip * Figures * Listings * Supplementary material * General background information * Constructing images * The framework program named ImgMod05 * ConvolveOp Examples * Preview * Discussion and sample code * Run the program * Summary * What's next? * Complete program listing * Copyright * Resources * About the author

Preface

General

In an earlier lesson titled A Framework for Experimenting with Java 2D Image-Processing Filters (see Resources), I taught you how to write a framework program that makes it easy to use the image-filtering classes of the Java 2D API to process the pixels in an image and to display the processed image.

At the close of that lesson, I told you that future lessons would teach you how to use the following image-filtering classes from the Java 2DAPI: * LookupOp * AffineTransformOp * BandCombineOp * ConvolveOp * RescaleOp * ColorConvertOp

In several of the previous lessons listed in the Resources section, I taught you how to use the LookupOp, the AffineTransformOp, and the BandCombineOp image-filtering classes.

In this lesson, I will teach you how to use the ConvolveOp image-filtering class to perform a variety of filtering operations on images.

I will teach you how to use the remaining classes from the above list in future lessons.

Viewing tip

I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the figures and listings while you are reading about them.

Figures

* Figure 1. Illustration of an edge treatment option. * Figure 2. Illustration of another edge treatment option. * Figure 3. Application of a flat 4x4 smoothing filter. * Figure 4. Application of an embossing filter using ConvolveOp. * Figure 5. Screen shot of the user input GUI. * Figure 6. Screen shot of typical program output.

Listings

* Listing 1. Beginning of the class definition. * Listing 2. The 9x9 convolution filter matrix. * Listing 3. Instantiation of Label object for display of data entry errors. * Listing 4. The primary constructor. * Listing 5. Beginning of the method named constructMainPanel. * Listing 6. Creation of the panel for radio buttons and text fields. * Listing 7.. Creation and population of a sub-panel for the radio buttons. * Listing 8. Creation of a sub-panel that contains the text fields. * Listing 9. Population and initialization of the array of TextField objects. * Listing 10. Complete the construction of the user input GUI. * Listing 11. Beginning of the processMainPanel method. * Listing 12. Conversion of the 2D convolution filter into a 1D array. * Listing 13. Correct for all filter values equal to 0.0f. * Listing 14. Setting the edge treatment parameters. * Listing 15. Creation of the ConvolveOp filter. * Listing 16. Apply the ConvolveOp filter and return the filtered image. * Listing 17. The required processImg method. * Listing 18. Complete listing for the class named ImgMod42.

Supplementary material

I recommend that you also study the other lessons in my extensive collection of online Java tutorials. You will find a consolidated index at www.DickBaldwin.com.

General background information

Constructing images

Before getting into the programming details, it may be useful for you to review the concept of how images are constructed, stored, transported, and rendered in Java (and in most modern computer environments for that matter).

I provided a great deal of information on those topics in the earlier lesson titled Processing Image Pixels using Java, Getting Started (see Resources). Therefore, I won't repeat that information here. Rather, I will simply refer you back to the earlier lesson.

The framework program named ImgMod05

It will also be useful for you to understand the behavior of the framework program named ImgMod05. Therefore, I strongly recommend that you study the earlier lesson titled A Framework for Experimenting with Java 2D Image-Processing Filters (see Resources).

However, if you don't have the time to do that, you should take a look at the earlier lesson titled Using the Java 2D LookupOp Filter Class to Process Images (see Resources), in which I summarized the behavior of the framework program named ImgMod05.

ConvolveOp Examples

In my opinion, the ConvolveOp class is the weakest of the image-filtering classes in the Java 2D API. I will explain my reasons for this opinion later in the section titled Assessment. First, however, I will show you some examples of image convolution using the capabilities of the ConvolveOp class.

Edge treatment

When performing image convolution, you must always decide how you are going to treat the edges of the image. The ConvolveOp class provides the following choices: * Copy edge pixels in unmodified form * Zero fill the edge pixels Emphasizing edge treatment
The processed portion of the images in Figures 1 and 2 was

Author: Richard G. Baldwin

Read article at Internet.com site

Featured Local Company

Moyea Software

92295612365
Hot building, ring street
LA, CA

Related Local Events
Automation Technology Expo West (ATX West)
Dates: 2/9/2010 - 2/11/2010
Location: Anaheim Convention Center
Anaheim, CA
View Details

SOLAR POWER - Exhibition and Conference
Dates: 10/12/2010 - 10/14/2010
Location: Los Angeles Convention & Exhibition Center
Los Angeles, CA
View Details

REAL-TIME & EMBEDDED COMPUTING CONFERENCE - LONG BEACH 2009
Dates: 10/1/2009 - 10/1/2009
Location: Marriott Long Beach
Long Beach, CA
View Details

2009 IEEE Petroleum and Chemical Industry Technical Conference (PCIC 2009)
Dates: 9/14/2009 - 9/16/2009
Location:
Anaheim, CA
View Details

Medical Design & Manufacturing - Trade
Dates: 6/9/2009 - 6/11/2009
Location: CANON COMMUNICATIONS LLC
Los Angeles, CA
View Details