Está en la página 1de 105

1 Phase - 1

Introduction
1.1 - An overview of existing system: There ere several systems existing to analyse operations on images, but some of them were not able to meet the present requirements of users like doctors and Pharmaceutical analysts etc. The main purpose of those software is to apply some filters on images and display the output as an image, which is used by users to get more clear picture rather than seeing the original image. They dont provide any appropriate result so that it will be easy for the user. 1.2 Au overview of proposed system: The proposed system should be able to apply various filters on given images and analyse the result and make users to decide appropriate operation to be fallowed next. The proposed system should be able to generate reports like HISTOGRAM etc. It should also provide functions like NORMALIZATION OF IMAGES, THRESHOLD AFTER FILTERING IMAGES, etc. Thus a GUI of options should be provided to view and analyse images before and after filtering. 1.3 Need for computerization: The operations in this system are to be implemented on large scale images, which is a little difficult task to perform manually. The analysis is to be done on various images with respect to various filters and various threshold values. Grey-level detection and Histogram drawing are handy tasks when performed with the help of good image processing system. 1.4 Areas of selection: The proposed system should be developed on the basis of fallowing conditions Front-end to use Images to be used : Java : JPEG format images

Phase - 2

Domain Analysis
Domain Analysis: Domain analysis deals with the objective of gathering information regarding the basic system. Domain analysis is to collect the information regarding the thing to done in the system. By this analysis we can get a complete, correct, consistent, and unambiguous modal of the system. This modal will help the developers to generate the system in an efficient way. 2.1 Problem Analysis: Image analysis is a very important task in determining the difference of any two images that is needed to take decision regarding the medical treatment. The basic work in this system is to read grey-level of images, normalize them, apply filters, apply threshold, compute histograms, and many more operations. They should be provided in a GUI to make the users work very easily and take accurate decisions. 2.2 About Domain: The Domain which we are dealing here is EDGE ENHANCEMENT OPERATIONS & ANALYSIS ON MEDICAL IMAGES. The information about the domain is stated below: 1. Introduction: Edge enhancement is a very important task in analyzing medical images, which is mostly needed by doctors and Pharmaceutical analysts etc. They need this kind of software to understand the work clearly and complete the work in fast manner. These softwares also helping them to get reports, which will give ideas to take decisions. 2. Glossary: Various terms, abbreviations used in the system are as fallows: a) Image: Image is a rectangular plot of pixels which determine a specific instance of internal or external view of body parts.

b) Pixel: A pixel is the least addressable point in an image which gives some information about the body or organ. c) Grey-value: Grey-value refers to the intensity of the pixel that it generates. It gives measure of reflectance of light at that point d) Filter, Mask, Kernel: All the three represent the same. A Filter is a mathematical matrix that is used to operate on an image to highlight the information in that image. e) Threshold: Threshold is the cutoff mark or level that is used to convert the grey image into binary image to intensify the edges that are obtained by applying filter. f) Normalize: Normalizing is the method of converting the image from any grey-level to that of the prescribed grey-level, g) Convolution: Convolution is the method by which a filter is applied on an image. h) Size of image or mask: Size of an image or mask is denoted as (r x c) i) Edge: Edge is the highlighted portion of image after applying filter that is used to differentiate any two distinct regions present in the image. j) Width of the edge: Width indicates the no. of pixels that edge contains to differentiate two regions. k) Length of the edge: Length indicates the region that the edge covers in the image. 3. General knowledge about domain: Usually Doctors and Pharmaceutical analysts need image processing techniques to understand and analyse their work in a complete manner. Their main work is to apply various medicines and must analyse the result of each one. The basic job is to analyse r represents no. of rows c represents no. of columns

4 several image at a time. To make this work more easy we use computers to generate reports and store them for future reference. Doctors need such software to identify a defective in a clear manner to decide the right medicine or treatment. Thus edge detection is more important part in image processing when related to medical mages. Thus we need to decide which one is more efficient to work with. There are several operations to be performed in Image Processing. They ate performed extract information from the images. The operations are as fallows: Image loading: This involves several methods of reading the image from disc and display the image on screen. The method should be implemented to read all kinds or images. Normalizing: Normalizing is the process of adjusting the range of grey values of the image. Images used to analyse the effect of filters ate of different grey ranges. We must transform them into a unique range before applying filters. This is done by the range of normalizing, Convolution: Convolution is the method of applying the filter over the image. It is a mathematical operation that is to
a11 a21 a31 a41 a51 a61 a71 a12 a22 a32 a42 a13 a23 a33 a43 .. a14 a24 a34 a44 .. ... .. a77 a15 a25 a16 a26 a17 a27

f11 f21 f31

f12 f22 f32

f13 f23 f33

The resultant matrix will contain the product of all the elements. r11 = a11*f11 + a12*f12 + a13*f13 + a21*f21 + a22*f22 + a23*f23 + r12 = a12*f11 + a13*f12 + a14*f13 + a22*f21 + a23*f22 + a24*f23 + r13 = a13*f11 + a14*f12 + a15*f13 + a23*f21 + a24*f22 + a25*f23 +

r55 = a55*f11 + a56*f12 + a57*f13 + a65*f21 + a66*f22 + a67*f23 +

5 Thresholding: Thresholding is the method of converting of grey-level image into binary image. This is done with the help of threshold value that is compared with all the pixels in the image and changed them basing on the grey-value If else g ij = 0 4. Customers & users: A) Customers of the system are DOCTORS that take decisions on the results obtained from the system. Other customers ate PHARMACEUTICAL ANALYSTS who calculate different effects of different medicines for a particular disease. B) Users of the system are PATIENTS who come for treatment with reports given in the form of images, x-rays etc. Other users are PHARMACEUTICAL COMPANIES those who carry out research work to develop new medicines. 5. Environment: The proposed system should work under the fallowing environment 1. SOFTWARE RECOMMENDATIONS: Operating system Packages Main memory Secondary memory Processor : Windows 98 / NT based : Java virtual machine (JVM) : 256 MB : 25 MB for program : A high-end processor with speed more than 500 MHz. g ij :> threshold value g ij = 1

2. HARDWARE RECOMMENDATIONS:

6. Tasks and procedures currently proposed: The proposed system should perform the fallowing operations: a) Load image: b) Image info: System should read an image that is selected by user. System should be able to provide information about image like greylevels present. c) Draw histogram: System should draw histogram where requested.

6 d) Normalize: e) Apply filter: System should normalize given image before doing any operation. Systems main activity is to apply given filter and obtain output image. values to the filtered image and display all the different images. g) Count edge length: To compare the operations of two filters we need to compute the edge length for given width of the edge and given image. h) Tabulate results: To analyse the result of to filters we need the edge information in the form of table with specific parameters. 7. Competing software: As the old existing software is designed to analyse general kind of images, we should take care to apply right filer to our images. Thus existing software are found to be efficient in respective fields. We are developing software that suits to all kinds of images. 2.3 Problem definition: Usually Doctors and Pharmaceutical analysts need edge enhancement techniques to understand image and analyse their work in a complete manner. Their main work is to apply various medicines and must analyse the result of each one. The basic job is to analyse several image at a time. To perform such a reliable and system we need to implement these operations: a) System should read an image that is selected by user. b) System should be able to provide information about image like grey-levels present. c) System should draw histogram where requested. d) System should normalize given image before doing any operation. e) Systems main activity is to apply given filter and obtain output image. f) After applying any filter the system should apply given threshold values to the filtered image and display all the different images. g) To compare the operations of two filters we need to compute the edge length for given width of the edge and given image. h) To analyse the result of to filters we need the edge information in the form of table with specific parameters. 2.4 Feasibility analysis: 1. Technical feasibility:

f) Apply threshold: After applying any filter the system should apply given threshold

7 The package JAVA which is being used to develop this software is technically a reliable package to develop any system. It is capable of handling images, generate reports and to create a most user friendly GUI. 2. Development risk: There is no risk in developing the software using packages JAVA since it is widely used package and also more reliable to develop systems. 3. Resources availability: The system does not require any additional resources to perform its operations, but to capture the input images is the only task performed by the user manually. 4. Functional feasibility: Functionally the system has no drawbacks since it is designed under desired conditions. 5. Economic feasibility: Economically the system has no troubles. 2.5 Features of the proposed system: 1. Purpose of the system: The System should read the input images, normalize them, apply filters, threshold the output images and compute edge length to compare the given filters applied on a particular image. 2. Scope of the system: The system performs its operations in the fallowing conditions: 1. SOFTWARE RECOMMENDATIONS: Operating system Packages : Windows 98 / NT based : Java virtual machine (JVM)

2. HARDWARE RECOMMENDATIONS: Main memory : 256 MB

8 Secondary memory Processor : 25 MB for program : A high-end processor with speed more than 500 MHz.

3. Objectives of the proposed system: The objectives achieved by the proposed system are as fallows: a) System should read an image that is selected by user. b) System should be able to provide information about image like grey-levels present. c) System should draw histogram where requested. d) System should normalize given image before doing any operation. e) Systems main activity is to apply given filter and obtain output image. f) After applying any filter the system should apply given threshold values to the filtered image and display all the different images. g) To compare the operations of two filters we need to compute the edge length for given width of the edge and given image. h) To analyse the result of to filters we need the edge information in the form of table with specific parameters.

Domain Analysis Document


1. Introduction: Edge enhancement is a very important task in analyzing medical images, which is mostly needed by doctors and Pharmaceutical analysts etc. They need this kind of software to understand the work clearly and complete the work in fast manner. These softwares also help them to get reports, which will give ideas to take decisions. 2. Glossary: Various terms, abbreviations used in the system are as fallows: a) Image: Image is a rectangular plot of pixels which determine a specific instance of internal or external view of body parts. b) Pixel: A pixel is the least addressable point in an image which gives some information about the body or organ. c) Grey-value: Grey-value refers to the intensity of the pixel that it generates. It gives measure of reflectance of light at that point d) Filter, Mask, Kernel: All the three represent the same. A Filter is a mathematical matrix that is used to operate on an image to highlight the information in that image. e) Threshold: Threshold is the cutoff mark or level that is used to convert the grey image into binary image to intensify the edges that are obtained by applying filter. f) Normalize: Normalizing is the method of converting the image from any grey-level to that of the prescribed grey-level, g) Convolution: Convolution is the method by which a filter is applied on an image. h) Size of image or mask:

10 Size of an image or mask is denoted as

(r x c)
i) Edge:

r represents no. of rows

c represents no. of columns

Edge is the highlighted portion of image after applying filter that is used to differentiate any two distinct regions present in the image. j) Width of the edge: Width indicates the no. of pixels that edge contains to differentiate two regions. k) Length of the edge: Length indicates the region that the edge covers in the image. 3. General knowledge about domain: Doctors need this software to identify a defective in a clear manner to decide the right medicine or treatment. Thus edge detection is more important part in image processing when related to medical mages. Thus we need to decide which one is more efficient to work with. There are several operations to be performed in Image Processing. They ate performed extract information from the images. The operations are as fallows: Image loading: This involves several methods of reading the image from disc and display the image on screen. The method should be implemented to read all kinds or images. Normalizing: Normalizing is the process of adjusting the range of grey values of the image. Images used to analyse the effect of filters ate of different grey ranges. We must transform them into a unique range before applying filters. This is done by the range of normalizing, Convolution: Convolution is the method of applying the filter over the image. It is a mathematical operation that is to
a11 a21 a31 a41 a51 a61 a71 a12 a22 a32 a42 a13 a23 a33 a43 .. a14 a24 a34 a44 .. ... .. a77 a15 a25 a16 a26 a17 a27

f11 f21 f31

f12 f22 f32

f13 f23 f33

11

The resultant matrix will contain the product of all the elements. r11 = a11*f11 + a12*f12 + a13*f13 + a21*f21 + a22*f22 + a23*f23 + r12 = a12*f11 + a13*f12 + a14*f13 + a22*f21 + a23*f22 + a24*f23 + r13 = a13*f11 + a14*f12 + a15*f13 + a23*f21 + a24*f22 + a25*f23 + Thresholding: Thresholding is the method of converting of grey-level image into binary image. This is done with the help of threshold value that is compared with all the pixels in the image and changed them basing on the grey-value If else g ij = 0 g ij :> threshold value g ij = 1

r55 = a55*f11 + a56*f12 + a57*f13 + a65*f21 + a66*f22 + a67*f23 +

4. Customers & users: A) Customers of the system are DOCTORS that take decisions on the results obtained from the system. Other customers ate PHARMACEUTICAL ANALYSTS who calculate different effects of different medicines for a particular disease. B) Users of the system are PATIENTS who come for treatment with reports given in the form of images, x-rays etc. Other users are PHARMACEUTICAL COMPANIES those who carry out research work to develop new medicines. 5. Environment: The proposed system should work under the fallowing environment 1. SOFTWARE RECOMMENDATIONS: Operating system Packages : Windows 98 / NT based : Java virtual machine (JVM)

12

2. HARDWARE RECOMMENDATIONS: Main memory Secondary memory Processor : 256 MB : 25 MB for program : A high-end processor with speed more than 500 MHz.

6. Tasks and procedures currently proposed: The proposed system should perform the fallowing operations: a) Load image: b) Image info: System should read an image that is selected by user. System should be able to provide information about image like greylevels present. c) Draw histogram: System should draw histogram where requested. d) Normalize: e) Apply filter: System should normalize given image before doing any operation. Systems main activity is to apply given filter and obtain output image. values to the filtered image and display all the different images. g) Count edge length: To compare the operations of two filters we need to compute the edge length for given width of the edge and given image. h) Tabulate results: To analyse the result of to filters we need the edge information in the form of table with specific parameters. 7. Competing software: As the old existing software is designed to analyse general kind of images, we should take care to apply right filer to our images. Thus existing software are found to be efficient in respective fields. We are developing software that suits to all kinds of images.

f) Apply threshold: After applying any filter the system should apply given threshold

13 Phase - 3

Requirement Specifications
3.1 Functional Requirements: Functional requirements for the promised system are as fallows: 1. Inputs: A) Image details C) Mask details D) Threshold details F) Edge details 2. Outputs: A) Image details C) Table details 3. Stores: A) Table details 4. Computations: A) Edge width 1 0 0 0 Horizontal edge: G G G 0 0 0 0 G 0 0 G 0 0 G 0 : Format of the edge should be as fallows 2 0 0 0 0 GGGG GGGG 0 0 0 0 0 0 0 0 GG GG GG GG 0 0 0 0 3 0 0 0 0 0 GGGGG GGGGG GGGGG 0 0 0 0 0 0 GGG 0 0 GGG 0 0 GGG 0 0 GGG 0 0 GGG 0 : Image, threshold value, edge width, edge length : Image, image description, grey-value range : Threshold value, image description, edge width, edge length B) Histogram details : Image, Histogram, grey-value range : Input image, image description : Input image, input mask : Input image, Threshold value, output image : Input image, edge width B) Normalize details : Input image, output grey-level range

E) Histogram details : Input image, group value

Vertical edge:

B) Edge length

: Format of edge should be as fallows

14 0 0 0 0 0 0 0 0 GGGGG 0 0 0 0 0 0 0 0

WIDTH: 1

LENGTH: 5

15 C) Report generation: To generate a table Length of edges with width is 1 = sum of lengths of all such edges in all directions. 5. Timing & Synchronization: Filter applying time is more important for the fast execution of the system. To view the output quick we should apply filters in parallel way. So we need to synchronize the operations of the system. 3.2 Non-Functional Requirements: Non-functional requirements are for the system are constraints for the system that ate useful for the user that can new specified below: 1. Usability: The system contains various links that ate useful for the user to navigate to various URLs that describe the filters used. There are other links that will help the user to study and acquire knowledge about them. User can also search for new filters and can implement in his program. 2. Reliability: The system proposed is reliable with the fallowing constraints: a) The system should be able to process and generate results with in preferred time for the images of size at least 1024 x 1024 b) The system should not hang or break for applying the filers on large images, but may cause delay in time. c) At any point of time the system should be able to display all the filtered images on screen at a time. d) The system does need any security since the images are given as input and results ate taken out of the system. There is no scope for the storage of results in the system. e) When processing large images we need to take care that main memory should be free for processing images without any disturbance.

16 3. Performance: The systems performance can be estimated with the fallowing constraints: a) The system concurrently processes images to display them in as fast as it can, so there is no scope for other users to interact with the system. b) The system is developed to operate on a single machine, but not on network to allow users to interrupt. 4. Supportability: The fallowing constraints reveal the support provided by the system: a) The system can be extended to any number of filters and also make the results to store for future reference. The system can also be extended to publish the results or print them. b) The system is supported to make the user to maintain or operated from network to get it shared by the users. c) The system does not allow the use the part it to operate on different software or hardware environments. 5. Implementation: There ate no constraints on the hardware platform, maintenance team or on the testing team to implement the operations of the system. Others reasons for the failure of the system are not considerable. 6. Interface: The interface provided is confined to the fallowing constraints: a) The system need not interact with other software to do its work or to make it useful for the user. b) The system import or export the date except the image that is taken as an input. c) The need to maintain the minimum requirements to use the system in an efficient way. 7. Operations: The user himself can manage the system since there ate no critical tasks performed by the system.

17 8. Packaging: The system installation package provided to the clients should have fallowing constraints: a) The package should be of less portable size. b) The package should contain clear instructions to make the user to install for him. c) The package can be installed by any number of users with any pre-notification. 9. Legal constraints: The software provided is legally allowed to redistribute to any number of users that a user wishes. No one is allowed to sell or purchase the software for your business.

3.3 Functional Modal / USE-CASE Modal: 1. Identifying actors: A) Users: The operators who uses the system.

2. Identifying Use-cases:

Acquire image User Input image details Output image User Input normalizing details

Input image details Output image User Input filter details

Input image details Output image User Input threshold details

18

Input image details Output edge length User Input edge details

3. Refining Use-cases: Input image details User Input edge details 4. Identifying relations among Use-cases: <<Include>> Image details Output image User Normalizing details <<Include>> Image details Output image User Filter details <<Include>> Image details Output image User Threshold details <<Include>> Input image details User Input edge details <<Extends>>

Output edge lengths

User

Output edge lengths <<Include>>

User

19 6. Use-case diagrams and their description: User Operations Input image details

Input normal range Normal image

Input filter details User

Filtered image Input threshold details

User

Thresholded images

Input edge details

Edge lengths report

Use-case name Participating actors

User operations User 1. 2. 3. 4. 5. 6. 7. 8. 9. Image details Input normal range Receive normal image Input filter details Receive filtered images Input threshold values Receive thresholded images Input edge details Receive edge lengths report

Flow of events

20 Phase - 4

Requirement Analysis
4.1 Object Modal / Class Modal: 1. Identifying Entity Objects: The entity objects in this system are a) b) c) d) e) Image details Normalizing details Filter details Threshold details Edge details : Input image : Define output grey-level range : Select filter : Define threshold values : Define edge width

2. Identifying Boundary Objects: The boundary objects obtained in this system are a) Image details : Display image, details and options

3. Identifying Control Objects: The control objects obtained in this system are a) Image details 4. Identifying Associations: A) User user 1 views * info Image : Receive & apply options on images and display results

B) User 1 inputs

user 1 normalizes *

info Normal image 1

. 1 Normal details

produces 1

21 C) user User 1 inputs . 1 D) User 1 inputs . 1 Threshold values produces 1 Filter details 1 info 1 views * Thresholded images 1 1 filters * info Filtered image 1 transform

user

user User 1 inputs . 1 Edge width 1 views *

info Edge length 1 produces 1

5. Identifying Aggregates: A) Image

Grey-levels

Image size

22

B) Mask

Matrix Method C) Edge

Size

Length

Width

6. Identifying Aggregates: A) Image Size : Grey-values : Type : B) Size : Type : Purpose : number x number between 0 & 255 {original, normal, filtered, thresolded} Filter number x number {Laplacian, Gaussian, LoG 6, LoG 17} {Edge enhancement, Smoothening }

7. Class diagrams: Class diagrams show the relationship among the various objects present in the system.

23

A) Image 1 1 Details m Filters 1 1 m m Edges 1 Table

4.2 Dynamic Modal / Behavior Modal: 1. Interaction diagrams: A) Sequence diagrams: (i)

User

display acquire filter create normalize image image normalize image image edge threshold

select image select filter

table

displays select value displays select value displays select option displays

images destroys create images destroys create images destroys create table destroys

24 B) Collaboration diagrams: (i)


1. Request to read image

GUI User

ImageIO
2. Receive & display image

4. Normalize Image 6. Filtered Image 8. Thresholded Image

3. Normalize info 5. Filter Info 7. Threshold value

13. Table 14. Graph 11. Edge Lengths 12. Graph Details

Filter
9. Thresholded Image 10. Edge Width

Table

Edge

2. State diagrams: (i)

Void display Select image Selected Image Select image Filtered images Select threshold Select filter

Select back Select image

Thresholded image

Select edge

Select back Select image Select image

Edge images Select option Table

25 3. Activity diagrams: A) Activity diagrams: 1. Load image Original image Normalize image Apply filters Filtered images

2.

Load image Filtered image Normalize image Apply thresholds Thresholded images

3.

Load all images For each image Thresholded image For each edge width Compute edge length Write edge length to table Edge table

26 Select image and load it Apply filter and show all images Input image Apply Threshold and show all images Compute edge length for all widths Write edge length to table Output Edge table

4.

4.3 External Requirements: 1. Hardware requirements: Main memory Secondary memory Processor 2. Software requirements: Operating system Front-end : Windows 98 / NT based : Java virtual machine (JVM) : 256 MB : 25 MB for program : A high-end processor with speed more than 500 MHz.

27

Requirement Analysis Document


1) Introduction: Edge enhancement is a very important task in analyzing medical images, which is mostly needed by doctors and Pharmaceutical analysts etc. They need this kind of software to understand the work clearly and complete the work in fast manner. This software does also help them to get reports, which will give ideas to take decisions. 2) Existing system: There ere several systems existing to analyse operations on images, but some of them were not able to meet the present requirements of users like doctors and Pharmaceutical analysts etc. The main purpose of those software is to apply some filters on images and display the output as an image, which is used by users to get more clear picture rather than seeing the original image. They dont provide any appropriate result so that it will be easy for the user. 3) Proposed system: 3.1 Overview: The proposed system should be able to apply various filters on given images and analyse the result and make users to decide appropriate operation to be fallowed next. The proposed system should be able to generate reports like HISTOGRAM etc. It should also provide functions like NORMALIZATION OF IMAGES, THRESHOLDING AFTER IMAGES, etc. Thus a GUI of options should be provided to view and analyse images before and after filtering. 3.2 Functional Requirements: Functional requirements for the promised system are as fallows: 1. Inputs: A) Image details C) Mask details : Input image, image description : Input image, input mask B) Normalize details : Input image, output grey-level range

28 D) Threshold details F) Edge details 2. Outputs: A) Image details C) Table details 3. Stores: A) Table details 4. Computations: A) Edge width 1 0 0 0 Horizontal edge: G G G 0 0 0 0 G 0 0 G 0 0 G 0 : Format of the edge should be as fallows 2 0 0 0 0 GGGG GGGG 0 0 0 0 0 0 0 0 GG GG GG GG 0 0 0 0 3 0 0 0 0 0 GGGGG GGGGG GGGGG 0 0 0 0 0 0 GGG 0 0 GGG 0 0 GGG 0 0 GGG 0 0 GGG 0 : Image, threshold value, edge width, edge length : Image, image description, grey-value range : Threshold value, image description, edge width, edge length B) Histogram details : Image, Histogram, grey-value range : Input image, Threshold value, output image : Input image, edge width

E) Histogram details : Input image, group value

Vertical edge:

B) Edge length

: Format of edge should be as fallows WIDTH: 1 LENGTH: 5

0 0 0 0 0 0 0 0 GGGGG 0 0 0 0 0 0 0 0 C) Report generation: To generate a table

Length of edges with width is 1 = sum of lengths of all such edges in all directions. 5. Timing & Synchronization: Filter applying time is more important for the fast execution of the system. To view the output quick we should apply filters in parallel way. So we need to synchronize the operations of the system.

29

30 3.3 Non-Functional Requirements: 1. Usability: The system contains various links that ate useful for the user to navigate to various URLs that describe the filters used. There are other links that will help the user to study and acquire knowledge about them. User can also search for new filters and can implement in his program. 2. Reliability: The system proposed is reliable with the fallowing constraints: f) The system should be able to process and generate results with in preferred time for the images of size at least 1024 x 1024 g) The system should not hang or break for applying the filers on large images, but may cause delay in time. h) At any point of time the system should be able to display all the filtered images on screen at a time. i) The system does need any security since the images are given as input and results ate taken out of the system. There is no scope for the storage of results in the system. j) When processing large images we need to take care that main memory should be free for processing images without any disturbance. 3. Performance: The systems performance can be estimated with the fallowing constraints: c) The system concurrently processes images to display them in as fast as it can, so there is no scope for other users to interact with the system. d) The system is developed to operate on a single machine, but not on network to allow users to interrupt. 4. Supportability: The fallowing constraints reveal the support provided by the system: d) The system can be extended to any number of filters and also make the results to store for future reference. The system can also be extended to publish the results or print them.

31 e) The system is supported to make the user to maintain or operated from network to get it shared by the users. f) The system does not allow the use the part it to operate on different software or hardware environments. 5. Implementation: There ate no constraints on the hardware platform, maintenance team or on the testing team to implement the operations of the system. Others reasons for the failure of the system are not considerable. 6. Interface: The interface provided is confined to the fallowing constraints: d) The system need not interact with other software to do its work or to make it useful for the user. e) The system import or export the date except the image that is taken as an input. f) The need to maintain the minimum requirements to use the system in an efficient way. 7. Operations: The user himself can manage the system since there ate no critical tasks performed by the system. 8. Packaging: The system installation package provided to the clients should have fallowing constraints: a) The package should be of less portable size. b) The package should contain clear instructions to make the user to install for him. c) The package can be installed by any number of users with any pre-notification. 9. Legal constraints: The software provided is legally allowed to redistribute to any number of users that a user wishes. No one is allowed to sell or purchase the software for your business.

32 3.4 System Modal: 1. Use-case modal and its description: User Operations Input image details

Input normal range Normal image

Input filter details User

Filtered image Input threshold details

User

Thresholded images

Input edge details

Edge lengths report

Use-case name Participating actors

User operations User 10. Image details 11. Input normal range 12. Receive normal image 13. Input filter details 14. Receive filtered images 15. Input threshold values 16. Receive thresholded images 17. Input edge details 18. Receive edge lengths report

Flow of events

33 2. Object model / Class model:

Image 1 1 Details m Filters 1 1 m m Edges 1 Table

3.5 Dynamic Modal / Behavior Modal: 1. Interaction diagrams: A) Sequence diagrams:

User

display create

filter

threshold

edge

table

acquire select image select filter

displays select value displays select value displays select option displays

images destroys create images destroys create images destroys create table destroys

normalize image image normalize image image

34 B) Collaboration diagrams:

1. Request to read image

GUI User

ImageIO
2. Receive & display image

4. Normalize Image 6. Filtered Image 8. Thresholded Image

3. Normalize info 5. Filter Info 7. Threshold value

13. Table 14. Graph 11. Edge Lengths 12. Graph Details

Filter
9. Thresholded Image 10. Edge Width

Table 2. State diagrams:

Edge

Void display Select image Selected Image Select image Filtered images Select threshold Select filter

Select back Select image

Thresholded image

Select edge

Select back Select image Select image

Edge images Select option Table

35

3. Activity diagrams: 1. Load image Original image Normalize image Apply filters Filtered images

2. Load image Filtered image Normalize image Apply thresholds Thresholded images

3. Load all images For each image Thresholded image For each edge width Compute edge length Write edge length to table Edge table

36 4. Select image and load it Apply filter and show all images Input image Apply Threshold and show all images Compute edge length for all widths Write edge length to table Output Edge table

37 Phase - 5

System Design
System design is the transformation of analysis modal into system design modal. During system design developers define the design goals of the project and decompose the system into smaller subsystems that can be implemented by individual teams. 5.2 Identifying Design Goals: There ate several reasons to identify the design goals of any system. These goals will help to design the system in an efficient manner. There are several criteria to identify these goals. Some of the criteria were explained below: 1. Performance criteria: a) Response time b) Throughput : The response time for the system is based on the size id image given as input to the system. : The throughput of the system is high since it will operate filters on image at a time parallel to one another thus increasing response time and increasing the fastness of the system. c) Memory : The memory used by the system is optimal because the memory related to one operation will be made free after the work is complete, thus reducing the used memory. 2. Dependability criteria: a) Robustness b) Availability c) Fault Tolerance d) Safety : The system should be designed to work efficiently on images of size 1024 x 1024 without any problem. : The system should be ready to accept command from user at any point of time without waiting for internal operations. : The system should not allow the user to work with fault input. It displays error messages for every specific fault occurred. : The system should not do any operations on the input image to get it disturbed.

38 3. Maintenance criteria: a) Portability b) Readability : The system should work on all the platforms like Linux, windows, Macintosh etc : The code generated should be able to understand the purpose of the function of that, so as to make the user to make the modifications easily. c) Traceability : The code generated should be easy to map with the functions with the operations specified by the client. 4. End-user criteria: a) Utility : The system should be made to operate on all inputs of end-user under any kind of circumstances. It should complete all the commands or instructions given by user without any interruption. b) Usability : The interface of the user is to be defined with all options which males the work of the end-user more easy.

5.2 Identifying Subsystems: In this phase we need to identify the subsystems present in the system and convert them to classes or procedures that can be easly implemented in the system code. 1. Class view: A) 1 1 Details m Filters 1 Image 1 m m Edges 1 Table

39 2. System overview: ` Filter Normal Threshold

Display

Image

Table

Edge

3. Subsystem view: The system can be subdivided into various subsystems that ate as fallows: Operators Subsystem Filter Memory Subsystem Edge

Threshold

Image

Normal

Report Subsystem Table

Interface Subsystem Display

A) Interface subsystem

: This subsystem is designed to display information n images as well as to show options and let user to select the one of his choice

B) Memory subsystem

This subsystem is useful for the user to maintain the

images in the memory and to perform operations on it.

40 C) Operators subsystem : Under this subsystem the user will receive get all the filters or functions that he wishes to use on the images. The selected filters or functions ate sent to the memory to get performed on the images. D) Report subsystem : This subsystem is used to compute edge information from the memory objects and send the result table to the output display subsystem.

5.3 Addressing design goals: 1. Mapping subsystems to processes and components: A) Identifying Hardware configuration and a platform: To understand the Hardware-Software interaction present in the system we need to draw Deployment diagrams. These deployment diagrams for the proposed system were explained below:

User system User interface

Operating system Image IO

Report generator

File IO

2. Identifying and storing Persistent data: Persistent data represents a single execution of the system. The data needed to control and maintain the system. In the present system the persistent data is the filters that ate being used to develop the software. These filters ate fixed and stored inside the system not on any file or database to be disturbed or modified. So we dont need any care about them.

41 3. Providing access controls: In this system the operations ate not used in special purpose, but the work which is being performed in the system is the operations on an image that are done by the user which can not be changed so we dont need any access control mechanism in the system. 4. Designing global control-flow: The global control-flow come into picture when the operations are performed in various locations by various people, but the system is not developed to do so. Here the work is already made to be processed sequentially by the user. 5. Identifying boundary conditions: Boundary conditions that present in the system are as fallows: A) Startup & Shutdown: The system we are developing is not a high programming or data enhancement system, so we dont need to develop any startup or shutdown conditions. B) Exception Handling: This operation is very important in building the system because the image is read from a disk or drive which may be a removable, so we need to take IOException care for reading images. Similarly care should be taken to operate on memory objects. The fallowing exceptions are to be handled 1) IOException 2) ArrayOutOfBounds 3) Overflow 4) .ImageIO : For reading files for images. : For navigating through images and filters. : For convolution of image and filter : For testing a file weather an image or not.

42

System Design Document


1 Introduction: A. Purpose of the system: The System should read the input images, normalize them, apply filters, threshold the output images and compute edge length to compare the given filters applied on a particular image. B. Design goals: There ate several reasons to identify the design goals of any system. These goals will help to design the system in an efficient manner. There are several criteria to identify these goals. Some of the criteria were explained below: 1. Performance criteria: a) Response time b) Throughput : The response time for the system is based on the size id image given as input to the system. : The throughput of the system is high since it will operate filters on image at a time parallel to one another thus increasing response time and increasing the fastness of the system. c) Memory : The memory used by the system is optimal because the memory related to one operation will be made free after the work is complete, thus reducing the used memory. 2. Dependability criteria: a) Robustness b) Availability c) Fault Tolerance d) Safety : The system should be designed to work efficiently on images of size 1024 x 1024 without any problem. : The system should be ready to accept command from user at any point of time without waiting for internal operations. : The system should not allow the user to work with fault input. It displays error messages for every specific fault occurred. : The system should not do any operations on the input image to get it disturbed.

43 3. Maintenance criteria: a) Portability b) Readability : The system should work on all the platforms like Linux, windows, Macintosh etc : The code generated should be able to understand the purpose of the function of that, so as to make the user to make the modifications easily. c) Traceability : The code generated should be easy to map with the functions with the operations specified by the client. 4. End-user criteria: a) Utility : The system should be made to operate on all inputs of end-user under any kind of circumstances. It should complete all the commands or instructions given by user without any interruption. b) Usability : The interface of the user is to be defined with all options which males the work of the end-user more easy. C. References: The references made to build this system are as fallows: 1. Books: a) Digital Image Processing By Rafael C. Gonzalez and Richard E. Woods Addision Wesley b) Fundamentals of Electronic Image Processing By Arthyr R Weeks, Jr.(PHI) c). Image processing, Analysis, and Machine vision By Milan Sonka vaclan Halavac Roger Boyle, Vikas Publishing House. 2. Journals: a) Fast convolution with Laplacian-of-Gaussian Masks By J.S.Chen, A.Huertas, and G.Medioni. 3. Web links: a) http://homepages.inf.ed.ac.uk/rbf/HIPR2/log.htm b) http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm

44 D. Overview: The proposed system should be able to apply various filters on given images and analyse the result and make users to decide appropriate operation to be fallowed next. The proposed system should be able to generate reports like HISTOGRAM etc. It should also provide functions like NORMALIZATION OF IMAGES, THRESHOLDING AFTER IMAGES, etc. Thus a GUI of options should be provided 2 Current software architecture: Currently the system is being implemented by manual verification. 3 Proposed software architecture: A. System overview: Filter Normal Threshold

Display

Image

Table B. Subsystem decomposition: Operators Subsystem Filter

Edge

Memory Subsystem Edge

Threshold

Image

Normal

Report Subsystem Table

Interface Subsystem Display

45 C. Hardware-Software mapping:

User system User interface

Operating system Image IO

Report generator

File IO

D. Persistent data management: In the present system the persistent data is the filters that ate being used to develop the software. These filters ate fixed and stored inside the system not on any file or database to be disturbed or modified. So we dont need any care about them. E. Access control and security: In this system the operations ate not used in special purpose, but the work which is being performed in the system is the operations on an image that are done by the user which can not be changed so we dont need any access control mechanism in the system. F. Global control-flow: The global control-flow come into picture when the operations are performed in various locations by various people, but the system is not developed to do so. Here the work is already made to be processed sequentially by the user. G. Boundary conditions: Boundary conditions that present in the system are as fallows: A) Startup & Shutdown: The system we are developing is not a high programming or data enhancement system, so we dont need to develop any startup or shutdown conditions. B) Exception Handling: This operation is very important in building the system because the image is read from a disk or drive which may be a removable, so we need to take IOException care for

46 reading images. Similarly care should be taken to operate on memory objects. The fallowing exceptions are to be handled 1) IOException 2) ArrayOutOfBounds 3) Overflow 4) .ImageIO 4 Subsystem services: A) Interface subsystem : This subsystem is designed to display information n images as well as to show options and let user to select the one of his choice B) Memory subsystem C) Operators subsystem : This subsystem is useful for the user to maintain the images in the memory and to perform operations on it. : Under this subsystem the user will receive get all the filters or functions that he wishes to use on the images. The selected filters or functions ate sent to the memory to get performed on the images. D) Report subsystem : This subsystem is used to compute edge information from the memory objects and send the result table to the output display subsystem. : For reading files for images. : For navigating through images and filters. : For convolution of image and filter : For testing a file weather an image or not.

47 Phase - 6

Object Design
Object design involves identification of existing patterns and off-shelf components that are present in the system. Description of class interfaces is also done in the system. 6.1 Reusing pattern solutions: 1. Identifying Solution objects: Solution objects that ate present in the system can be stated for the organization of hardware control flow and other connections for relating software and off-shelf components. JIPS System Application objects User interface Image Report

Solution objects

javax.imageio.ImageIO

java.awt.image.BufferedImage

Off-shelf Components

IO Subsystem

Memory Assistant

2. Specification inheritance & Implementation inheritance:

48 Inheritance is the best way to implement the most critical tasks that are well defined in the Operating System. These operations are present in the system, we need not develop any new method, and just we extract and extend the methods present. The Image operations present in the system are fallows Class BufferedImage extends java.awt.image { // All the methods present in image can be applied to BufferedImage. // It can also implement some other functions and features. } There are some other methods that are inherited and can be used to implement the system with ease by reducing the coding activity. Class pimg extends JLabel { BufferedImage img; JLabel name; public pimg(BufferedImage image, String text) {} } // Combination of JLabel and BufferedImage classes is developed to display. // the constructer is used to create a label to display image and name of it.

3. Selecting patterns: In the system design and other phases implemented we defined more goals in different manner with a complexity in them. To achieve all these goals we need to define architecture, which enables us to deal with complexity and allow flexibility to deal with change later in development process. A). Strategy pattern: In our system we have to operate on various images of various types. But the method implemented must be same. So we fallow the Strategy pattern to acquire images and read them into memory.

49

Image

Loader Open()

ImageIO read() getRGB()

Jpeg ImageIO read() getRGB()

Bitmap ImageIO read() getRGB()

Gif ImageIO read() getRGB()

Png ImageIO read() getRGB()

B). Abstract factory pattern: In our system we have to perform many operations on images of various types. They cannot be grouped because of dissimilarities in them. But they have to be implemented totally in the application. Such filters are as fallows:

Image

Image Operations read() getRGB()

Filer Operations ApplyFilter()

Threshold Operations ApplyThreshold()

Edge Operations CalculateEdgeLength()

6.2 Specifying interfaces: 1. Identifying missing attributes and components: In this step we identify the missing objects and components that were not found in the previous phases. In the present system there were no such objects. Such objects that are present in the system are: a) Color of images : The images considered in the system are of Grayscale type.

2. Specifying Types, Signatures and Visibility: During this step we define the types of attributes that are used in the system. The type specification includes data type of the attributes used in the system.

50

Filter Operations Image +Investor code: int 1 * +Images: umage, normimg, timg

* Edge -Edge width: int +Edge length: int length(image, width)

1 -Normalize() +ApplyLap() +ApplyGas() +ApplyLog6() +ApplyLog7()

Result +Table: int[][] - image: Image +ShowResult()

3. Specifying Pre-conditions and Post-conditions: In this step we identify the constraints for each operation in each class. The conditions to perform an operation and to complete an operation are to be known to describe the operations. The various Pre and Post conditions of the system are as fallows: /* To apply filter we have to normalize image first */ Context: Image :: applyfilter(image) pre: Image.type()->isnormalized() /* To apply threshold on an image first we need to apply one filter */ Context: Image :: applythresh(image) pre: Image.type()->isfiltered() /* Generation of table is complete only after edges ate found in all directions and write them to table */ Context: image :: generatetable() post: Table.details->isfilledinalld(image, width, direction)

4. Invariants and Inheriting Contracts: Invariants are complicated conditions that are implemented during the design that enables the developer to generate the code easily. In the present system there are no such combinations of conditions to describe.

51 In our system we need to display all the images and also the table details these details ate to be made condition as invariants. Images +size : int x int +Display()

Selected image

Filtered image

Threshold image

Normal image

In the above instance the display() method can be used to display any kind of images that are generated in the system

52

Object Design Document


1. Introduction: 1.1 Object design trade-offs: Object design trade-offs include various non-functional constraints that were discussed earlier, ate to be mentioned again to male them qualify more. a) The system should not hang or break for applying the filers on large images, but may cause delay in time. b) At any point of time the system should be able to display all the filtered images on screen at a time. c) The system does need any security since the images are given as input and results ate taken out of the system. There is no scope for the storage of results in the system. d) When processing large images we need to take care that main memory should be free for processing images without any disturbance. e) The system can be extended to any number of filters and also make the results to store for future reference. The system can also be extended to publish the results or print them. f) The system is supported to make the user to maintain or operated from network to get it shared by the users. 1.2 Interface documentation guidelines:: The interface documentation guidelines are useful to improve the communication between developers during the design phase. For our system we specify some rules to be implemented by the programmers. They are as fallows: a) Classes should be designed in respect to the action performed by them. b) Functions declared should have appropriate names for understanding the purpose and exact names for the parameters. c) The function calls should be made efficiently to allow the system to work properly. d) The web links and references should be made dynamic for users ease.

53 2. Packages: This process describes the decomposition of subsystems into packages and the file organization of the code. Package Images Filters Operations Table Classes included pimg JIPS JIPS Runthread

2. Class Interfaces: In this process we explain the relation between the various classes present the system. The fallowing diagram shows the various classed present in out system, it also describes the Interface relationship among them.

JIPS

ImageIO

Help

MemotyIO

Threshold

Edge

Table

Phase - 7

54

Implementation & Coding Activity


After all the design activities were implemented correctly and completely we will be having the use-cases , class interfaces and designing goals with us. The next step is to implement them to resolve them into a system by developing the code. The code generation should be done in a systematic manner. The process will be explained in this phase. 7.1 Optimizing Object Design modal: The Object modal obtained in the object design phase will be a very complex one. To make the design very clear and easy we optimize it. a) Modal transformations: Here out objective is to know the defective modal and change it. Before transforming: Original Image After transforming: Image Type: String b) Refactoring: Here we plan for the code optimization foe the benefit of programmers and readers Before refactoring: Public class jips extends jpanel { ping p1 = new pung(this) class ping extend Jlabel { public ping(Jpanel p) {p.add() } } } Filtered Image Thresholded Image

55 After refactoring: Public class jips extends jpanel { Jpanel me = this; ping p1 = new pung() class ping extend Jlabel { public ping(J) {me.add() } } }

7.2 Mapping Associations to Collections: In this step we combine some Associations obtained in the Requirement analysis phase to generate Collections. a) One-to-one Associations:

Image b)

Acquired image

One-to-many Associations:

Image

Filtered Images Thresholded Images Edges

Image

Image

c)

Manytomany Associations : Threshold Images * *

Edges

d)

Manytoone Associations : Edges * 1

Table

56 e) Associations classes: Some of the above associations can be grouped to have a class as fallows:

Image

Masks

Filtered image

Threshold image

Edge

Table

7.3 Mapping Contracts to Exceptions: In this step we convert the contracts and conditions defined in the object design phase into exceptions that are used as a part of coding activity. All the pre & post conditions and invariants that are described during the previous phases are converted to exceptions. 1) Checking Pre-conditions: The pre conditions defined in the system ate a) Image should be normalized before applying filter. b) Image should be filtered before applying threshold on it. c) All the filters ate to be applied before computing table of edges. All the above conditions are procedurally made inbuilt in the system, so we dint need to take any extra care regarding them.

57 2) Checking Post-conditions: The post conditions defined in the system ate a) Before displaying the results table, we have to check weather applied all filters or not to ensure for complete table. All the above conditions are procedurally made inbuilt in the system, so we dint need to take any extra care regarding them. 3) Checking efforts: This step deals with the checking of effort made by the developer to do the real work, the code for condition checking etc. is more complex we should try to increase effort made on testing and code clean-up. 4) Checking increased opportunities for defects: The main usage of this step is to check the code for the presence of any mistakes that lead to a downfall of system. The leakages and bugs present in the source code are to be removed. 5) Preferences drawback: The preferences considered by the developer sometimes become problem for coding because of the conflict between them. Here condition like correctness, efficiency etc. may overcome preferences like response time, throughput etc. In such positions the developer should take care of the most important one. 7.4 Mapping Object modals to a persistent storage schema: In this step the schema for the persistent data is being discussed. A) Image : The major data part in the system is an image. So we need to define the stricture of the image. Image is a rectangular plot of pixels that has come Image I mxn grey-value which ranges from 0 to 255. g11 g12 g13... .. g1n = g21 g22 g23... .. gm1 gm2 gm3... .. g2n gmn

58 Where g ij mxn represents the colot at that ith row, jth column. is the size or the image.

we treat the image in the form of matrix of integer values image[j][j] = g ij Functionally we use the functions present in the BufferedImage class to get or set the color as below color = Image.getRGB(I,j) To deal with grey-scale images we convert the color to grey-value Color = ARGB(alpha, red, green, blue) Grey-value = ARGB(alpha, grey, grey, grey) To read the grey-value of a pixel we need to do binary operations on the color receives. grey-value = ARGB(alpha, grey, grey, grey) & 0xff By the above binary operation we get the grey value at that pixel.

B) Filter

: This is a data item which is to be organized in the system. As image this is also a rectangular array grid used to perform mathematical operations on

images. v11 v12 v13... .. Filter m pxp = v21 v22 v23... .. vm1 vm2 vm3... ..

v1p v2p vpp

Where

v ij pxp

represents the colot at that ith row, jth column. is the size or the mask.

59

Interface Design
Interface design is the development of screens basing on the input requirements and output requirements that were specified earlier. 8.1 Introduction to software environment: The software being used to develop this system are as fallows 1) Java Devolopmebt Kit 1.5 : Java development kit 1.5 is robust, efficient and reliable software that is used to develop software in a reliable way. Java is a well organized programming language that can be implemented 8.2 Introduction to hardware used: Main memory Processor : 512 MB : 2.56 GHz.

Phase - 8

8.3 Design of persistent data: The various persistent data objects used in this system can be explained as fallows a) Grey-value: Grey-value is a very important data item used in the system. Grey-value is the combination of three basic colors (Red, Green, Blue) in eqlual aspect. Thus we have gv = Color(alpha, red, green, blue) color( 0xff, int, int, int ) implemented as INTEGER data rype in java as int gv = b) Filter or mask: The filtrer or mask is a mathematical form of integers that are implemented in java as Mask m = m11 M21 M31 m12 m22 m32 m13 m23 m33

60 Represented as Int[][] m = new int[3][3] : c) Image: Image is a combination of grey values and is represented as a mateix of integers This is represented as array of integers in java. Image I mxn = gv 1 1 gv 2 1 gv 1 2 gv 2 2 gv 1 n gv 2 n gv m n {(m11, m12, m13,), (m21, m22, m23,), (m31, m32, m33)}

gv m 1 gv m 2 is represented as bufferedimage in java as fallows BufferedImage I m n

= new BufferedImage(m,n,BufferedImage.TYPE_BYTE_GREY)

The data is treated as a matrix of integers. 8.4 Design of Input screens: The various inputs in this system are handled using menus and the other inputs like Brousing a file etc. are done with the help of java in-built controls as a) File Open Dialog: The file open dialog in java is done with the help of JFileChooser keyword. // Creation of file open dialog JFileChooser fileChooser = new JFileChooser("IMAGES"); if(fileChooser.showDialog(new JFrame(),"Select Image") == JFileChooser.APPROVE_OPTION) // Aassigning the selected file to file pointer. { File file = fileChooser.getSelectedFile(); // Reading the image file and assigning the image to // bufferedimage object try { image = ImageIO.read(file); } // Catch any error exception caused by the file object catch (IOException ioe) { } }

61 The above part of code will display the file open dialog box and assign the selected file to file object in the program.

b) Menus: Menus play a very important in giving the options to the program. The design of menus is done as fallows: // To create menu bar and menu heads JMenuBar menubar = new JMenuBar(); JMenu filemenu, helpmenu, fltmenu, threshmenu, edgemenu, toolsmenu; // To create menu items and give access conteols JMenuItem contents = new JMenuItem("Contents",'c'); // To add menu items to heada and heads to menu bar helpmenu.add(contents); helpmenu.addSeparator(); // To give action to menu items with the help of new self implemebted // class TextAction(); contents.addActionListener(new TestAction("contents")); // TextAction implemented by programmer to ease the work of menus class TestAction extends AbstractAction { public TestAction(String name) { super(name); } public void actionPerformed(ActionEvent event) { if (getValue(Action.NAME).equals("load")) { JFileChooser fileChooser = new JFileChooser("IMAGES"); // other implementations code } } }

62

The view of the resultant menu will be as fallows;

8.5 Design of output screens:

Design of output screens include various components like images, tables and other information like text is displayed with the help of fallowing options:
a) Text: The text present the system is displayed with the help of labels as fallows: JLabel ltext = new JLabel(String); ltext.setText(String); b) Images:

The outputs in the system are mostly images. They can be viewed with the help of labels as fallow:
JLabel limg = new JLabel(); limg.setIcon(new imageIcon(BufferedImage));

Similarly any number of images can be displayed on several labels to make the system to view the output images. The sample view of the images and labels can be used as fallows

63 c) Grid of images:

The outputs in the system are mostly images. We should show many images at a time on the screen so we need to arrange them in a grid view. This can be done with the help of fallowing commands:
// To devide the screen into 9 equal parts JPanel imgpane = new JPanel(new GridLayout(3,3) ); // To set the panel as backbone for the screen pane.setContentPane(imgpane); // To add images on the new screen pane.add(new pimg(image,"Selected image")); // To draw images on screen Graphics2D g = normimg.createGraphics(); g.drawImage(image,0,0,image.getWidth(),image.getHeight(),null); normalize(normimg); pane.add(new pimg(normimg,"Normalized Image")); // To change the display of the menus & control flow of the system. fltmenu.show(); edgemenu.hide(); toolsmenu.show(); pane.show();

The above code is used to create a grid of 9 images and add some desired to te grid. The output will be as fallows:

64 d) Table of values:

The output of the system is to displayed in the form of table of values that are the edge lengths calculated in the program This is achieved with the help of the fallowing commands:
// Compute table values Object table[][] = new Object[20][10]; // Create table to store values Object[] col = {"Thresh", "Lap 1","Lap 2","Lap 3","Log6 1","Log6 2","Log6 3","Log17 1","Log17 2","Log17 3"}; JTable tab = new JTable(table, col); JScrollPane js = new JScrollPane(tab); // Assign values to the fields of the table table[k][4] = edgelength(t2,1);

By the help of above commands we create the table, compute the values and store the values, finally display the table. The output will be as fallows:

e) Graph:

65

The output of the system is to displayed in the form of a graph that displays the information in a competitive way to help of the user to take decision easily. The commands that help are as fallows:
// To create graphics object on an image and display it BufferedImage img = new BufferedImage(600,525,BufferedImage.TYPE_3BYTE_BGR); Graphics2D g = img.createGraphics(); ; g.drawImage(img,0,0,600,525,null); // To set color and draw lines on the graphics object g.setColor(Color.white); g.drawLine(50,0,50,500); g.drawRect(75+25*i-2,(int) (400-x-2),4,4); // To set color and draw lines, tectangles, text etc. if (j==1) {g.setColor(Color.CYAN); o.setColor(Color.CYAN); o.drawString("Laplacian - 1",20,50);}

66 8.6 Design of User-Interfaces:

Design of User-interfaces include various like design of forms, windows etc. that are meant to take commands from users and get the output for the user.
a) Forms & Windows: // Extending Frame class to get user designed screeen public class JIPS extends JFrame implements ActionListener { public JIPS() { // Set properties of the user form super("Coparitive Stuby Laplacian & Gaussian Filters"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.createBufferStrategy(1); setLayout(null); setFont(new Font("Times New Roman",Font.BOLD,18) ); } } // Creation of user object public static void main(String args[]) { JIPS ip = new JIPS(); }

The user interface can be displayed as fallows:

67 b) Message Dialogs:

The user-interface also includes various other components are options like messages etc. Such commands are as fallows:
// To display a message to avail the information of the users JOptionPane.showMessageDialog(this,"Welcome to the System.");

The message will be as fallows;

68 Phase - 9

Testing Analysis
Testing is a process of analyzing a system or system components to detect the differences between specified and observed behavior. In other words, testing is a fault detection technique that tries to enumerate failures or erroneous states in a planned way. This allows the developer to detect failures in the system before it is released to the customer. Testing of the project involves the fallowing activities: 9.1 Component testing: All the components that are present in the system are tested and were reviewed many times for the developing. The fallowing components were tested: Component Filter functions Threshold function Edge calculation function Graph Function 9.2 Usability testing: Usability test tests the users understanding of the system. It outlines the differences between the system and the users expectation of what it should do. This is of three types: 1 Scenario test: The testing of each scenario will be performed here. Scenario Test case 1 Test case 2 Feed back Quick and ok ok Test result Revised 3 times and approved Approved Approved Revised 2 times and approved

Test cases used in this test are : Name Location Test case 1 JIPS.java: class JIPS

69 Input1 Oracle1 Log1 Input2 Oracle2 Log2 Name Location Input1 Oracle1 Log1 Input1 Oracle1 Log1 9.3 Unit testing: Testing of building blocks is performed here. 1. To test the smaller units of the system we inspect on buffered image implementation and file I/O operations etc. 2. Testing of all the components independently and parallel synchronizing the operations of all components. This test includes the fallowing tests to be performed: 1 Equivalence test or Black-Box test: To test the performance of filters and thresholds we define an average range of scenarios as inputs to maintenance of equality with other inputs we use this Black-Box test with the fallowing test case: Name Location Input1 Oracle1 Log1 Equivalence rest case JIPS.java: class JIPS Input image of size 535 x 526, all filters, medium threshold value The system will display 4 filtered images, 4 threshold images. 4 filtered, 4 threshold images with average edge length and width are displayed. Input image of size 535 x 526, all filters, 1 threshold value The system will display 4 filtered images, 4 threshold imges. 4 filtered, 4 threshold images are displayed. Input image of size 385 x 400, 1 filter, all threshold values The system displays 1 filtered image, 16 threshold images. 1 filtered image, 16 threshold images are displayed. Test case 2 JIPS.java: class pimg Input image of size 535 x 526, table, graph The system will display a table and a graph A table and a graph are displayed. Input image of size 385 x 400, table, graph The system will display a table and a graph A table and a graph are displayed.

70 2 Path test or White-Box test: The control-flow mechanism of application of filters in the system can be explained with the help of fallowing Flow-Graph:

Laplacian s Gaussian Laplacian of Gaussian 6

Laplacian of Gaussian 17

Images

Display

The selection of filters is done with the help of above path whish resulted in the clear control flow of the activities performed in the program. 3 State-based test: The state of the display with the change of selection of options is displayed with the help of fallowing UML state-chart diagram:

71

1. Select image Selected Image

2. Select filter

3. Select back

Filtered Image

4. Select Threshold

3. Select back

Thrsholed Image

5. Select result 1. Select image 5. Select result

Result table

6. Select graph

5. Select result

1. Select image

Result graph

The states changes of the system can be explained by the help of the fallowing the crate description. This could explain the difference between the expected output and the resultant outputs that resulted during the input of various input test-cases.

72

Stimuli Click open image Click filter Click back Click filter Click Threshold value Click back Click Threshold value Click Result Click Graph

Transition tested 1. Initial display 2. Select filter 3. Select back 2. Select filter 4. Select threshold 3. Select back 4. Select threshold 5. Select result 6. Select graph

Predicted resulting state Selected image Filtered image Selected image Filtered image Thresholded image Filtered image Thresholded image Result table Result graph

4 Polymorphism test: The various design patterns that were implemented in the system are to be tested here. In the present system we need to test the Strategy design pattern implemented in the reading of the reading of image of various types. The testing is done by giving various inputs of different types. The fallowing test cases are to be used to test the system. Name Location Input1 Oracle1 Log1 Input2 Oracle2 Log2 Input3 Oracle3 Log3 Polymorphism Test case JIPS.java: class pimg Input image of size 535 x 526 of BMP format, table, graph The system will display a table and a graph A table and a graph are displayed. Input image of size 385 x 400 of JPG format, table, graph The system will display a table and a graph A table and a graph are displayed. Input image of size 225 x 281 of GIF format, table, graph The system will display a table and a graph A table and a graph are displayed.

9.4 Integration testing:

73 Testing of components at a individual level is performed in Unit testing; Those components have to be tested as a group in this phase. We implement Top-down Strategy to test the system. 1 Top-down Strategy:

User Interface [A]

Filter Class [B]

Threshold Class [C]

Table Class [D]

Graph Class [E] In this test we test the components as a group i.e. pair-wise application of components that are present. A, B; A, C; A, D; D, E; and so on. The faults found can be corrected and re-inspected for the best performance of the system. 9.5 System testing: System testing is the important phase of testing. This phase is used to test the satisfaction of functional and non-functional requirements that were in Requirements Analysis Document. The tests included in this phase in this phase are as fallows:

1 Functional test or Requirements test:

74 In this test we need to test weather the functional requirements stated in Requirements Analysis Document are met or not. A) All inputs were processed through navigation of menus. B) All outputs were presented with the help of images on screen. C) All computations were performed within the TextAction Class. D) Storage of table Is done to a text file in Binary Mode; E) Synchronization of process is done with the help of Runthread Class. 2 Performance test: In this test we need to test the achievement of design goals stated in System Design Document. A) Volume test: When large images are given as input for the system, it takes much time to respond but does not hang or crash the system. B) Timing test Timing test is implemented to estimate the average time taken to process and display the result. 3 Pilot test or Field test: This test conducted with out any pre-conditions or pre-defined scenarios. The system is given to tester who test on real data and know the practical problems or faults that come in the system. 4 Acceptance test: The client who wants the software will conduct the system. The needs to test the system in the fallowing ways: A) Benchmark test: Under this test the client gives the input basing on his typical conditions and tries to get the output he wants. In system sir gave 4 input images and got the result accurate as for his requirements.

5 Installation test:

75 The system provided in the form of package is installed in many systems of lab and found be working efficiently in the Project lab where java is nor installed on some systems. By implementing these tests on the system we determine the system to working well as per the given functional and non-functional requirements.

76

Conclusion
Conclusion of the system describes the satisfaction of the clients, as well as he description of the pattern in which the system works and the comments of he client. The conclusions made by the user as fallows: All the operations present in the system are working as per the requirements The system is working at a considerable speed and throughput. The objectives of the project are achieved and satisfactory. The Look & Feel of the system is efficient. The references and links present in the system are much helpful for the users of the system.

77

Recommendations
The recommendations of the project include the basic and optimal requirements of the system. They also include the hardware requirements. 1. SOFTWARE RECOMMENDATIONS: The system should need the fallowing basic requirements: Operating system Packages : Windows 98 / NT based : Java virtual machine (JVM)

2. HARDWARE RECOMMENDATIONS: The system should need the fallowing basic requirements: Main memory Secondary memory Processor : 256 MB : 25 MB for program : A high-end processor with speed more than 500 MHz.

78

Bibliography
The references made to work out the project are as fallows: Books: 1. 2. Digital Image Processing Rafael C. Gonzalez and Richard E. Woods Addision Wesley The complete Reference of Java 5th Edition Herbert Shildt Journals: 1. Fast Convolution with Laplacian-of-Gaussian Masks J. S. Chen, A. Huertas, G. Medioni Web links: 1. 2. 3. http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm http://homepages.inf.ed.ac.uk/rbf/HIPR2/log.htm http://homepages.inf.ed.ac.uk/rbf/HIPR2/convolve.htm

79 Annexure - I

Screen Layout
The output of the project can be explained with the help of the sample run of the project to get the clear view for the user or client to understand the work of the project. The complete run of project will be noted and submitted in the form of a report to the client. The various activities performed in this step are Welcome to system Selection of image Selection of Filter Application of threshold Retrieve results as table Retrieve results as graph a) Welcome to system: When the system is started the screen will look like this

80

b) Selection of image: First we select the image by selecting the Load Image from file menu. The result is as fallows:

Then we see the screen as fallows

81

This will display the ORIGINAL IMAGE and NORMALIZED IMAGE as fallows

c) Selection of filter: Later we can any one filter of all filters to apply.

If one filter is applied we can apply all thresholds. If not so we can only compare all the filters manually and analyse the result

82

Later we go back and select individual filters to see all threshold values

d) Applying threshold value: We select individual filters and see all the threshold values we want. If we dint want we can skip this step.

83 First we select Laplacian Filter and try to apply threshold value 30-60 abd see the result images as fallows:

The result of Thresholded images and get different sets of images as fallows:

84

85

e) Retrieving result as table: The next step is to get table of comparative values that contains information about the filters of all kinds to generate result

In the next step we see the graph generated as a result of selection Show Graph from the tools menu Here the is used steered for furfures reference.

86

87 The whole process from step 1 to step 5 is repeated by taking different image each time and all the results are used to compare al kinds of filters used Consider the input as FLOWER.JPG; Some processes like the implementation of loading, filtering are most common for all image so let us see the output

Next we need to get the result in the form of table and graph to compare with the previous one. Both are different image but they are NORMALIZED to same range and applied to test. The table and graph compaction values of this image as fallows;

88

89 The whole process from step 1 to step 5 is repeated by taking different image each time and all the results are used to compare al kinds of filters used Consider the input as LADY.JPG; Some processes like the implementation of loading, filtering are most common for all image so let us see the output

Next we need to get the result in the form of table and graph to compare with the previous one. Both are different image but they are NORMALIZED to same range and applied to test. The table and graph compaction values of this image as fallows;

90

91 The whole process from step 1 to step 5 is repeated by taking different image each time and all the results are used to compare al kinds of filters used Consider the input as BRAIN.JPG; Some processes like the implementation of loading, filtering are most common for all image so let us see the output

Next we need to get the result in the form of table and graph to compare with the previous one. Both are different image but they are NORMALIZED to same range and applied to test. The table and graph compaction values of this image as fallows;

92

93 6. Drawing Conclusion: Drawing conclusion is the important stage of the project. The major purpose of th user is to take decision basing in the tables and graphs obtained. Here in the present situation we are entrusted to know the effect of all the filters in getting the edge length. In my opinion the LOG 17 is a very large filter of size 17 c 17 and also the operations take much time. Though small LOG 6 filter is ia low burden filter and is comparatively better than a LOG 17 filter.

94 Annexure - II

Sample Code
// // COMPARATIVE STUDY OF LAPLACIAN & GAUSSIAN FILTERS // // File Name : JIPS.java // // Author : N. Chandra Sekhar // // Info : 3 / 3 M.C.A // A.U. COLLEGE OF ENGG. // ANDHRA UNIVERSITY // import java.io.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.plaf.*; import javax.swing.event.*; import javax.imageio.ImageIO; import javax.swing.plaf.metal.*; public class JIPS extends JFrame implements ActionListener { BufferedImage image,normimg,timg; JFrame pane; Object table[][] = new Object[20][10]; JMenu filemenu, helpmenu, fltmenu, threshmenu, edgemenu, toolsmenu; String state = ""; JMenuBar menubar = new JMenuBar(); Boolean res = false; //JPanel gph = new JPanel(); BufferedImage imglap, imggas, imgl6, imgl17; public JIPS() { super("Coparitive Stuby Laplacian & Gaussian Filters"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.createBufferStrategy(1); setLayout(null); setFont(new Font("Times New Roman",Font.BOLD,18) ); filemenu = new JMenu("File"); filemenu.setMnemonic('f'); menubar.add(filemenu); fltmenu = new JMenu("Filter"); fltmenu.setMnemonic('l'); menubar.add(fltmenu); threshmenu = new JMenu("Threshold"); threshmenu.setMnemonic('t'); menubar.add(threshmenu); edgemenu = new JMenu("Edge"); edgemenu.setMnemonic('e'); menubar.add(edgemenu);

95 toolsmenu = new JMenu("Tools"); toolsmenu.setMnemonic('t'); menubar.add(toolsmenu); helpmenu = new JMenu("Help"); helpmenu.setMnemonic('h'); menubar.add(helpmenu); JMenuItem loadimage = new JMenuItem("Load Image",'l'); filemenu.add(loadimage); loadimage.addActionListener(new TestAction("load")); filemenu.addSeparator(); JMenuItem exit = new JMenuItem("Exit",'x'); filemenu.add(exit); exit.addActionListener(new TestAction("exit")); pane = this; JMenuItem contents = new JMenuItem("Contents",'c'); helpmenu.add(contents); contents.addActionListener(new TestAction("contents")); helpmenu.addSeparator(); JMenu links = new JMenu("Links"); helpmenu.add(links); JMenuItem conpage = new JMenuItem("Method of Convolution"); links.add(conpage); conpage.addActionListener(new TestAction("conpage")); JMenuItem gaspage = new JMenuItem("About Gaussian Filter"); links.add(gaspage); gaspage.addActionListener(new TestAction("gaspage")); JMenuItem logpage = new JMenuItem("Use of LOG filters"); links.add(logpage); logpage.addActionListener(new TestAction("logpage")); JMenuItem search = new JMenuItem("Use of LOG filters"); links.add(logpage); logpage.addActionListener(new TestAction("logpage")); JMenu refs = new JMenu("References"); helpmenu.add(refs); JMenuItem edgefiie = new JMenuItem("About Edge detection, Thresholding & various Filters"); refs.add(edgefiie); edgefiie.addActionListener(new TestAction("edgelink")); JMenuItem logfiie = new JMenuItem("About Application of LOG Filters"); refs.add(logfiie); logfiie.addActionListener(new TestAction("logfile")); helpmenu.addSeparator(); JMenuItem about = new JMenuItem("About",'a'); helpmenu.add(about); about.addActionListener(new TestAction("about")); JMenuItem applylap = new JMenuItem("Laplacian filter"); fltmenu.add(applylap); applylap.addActionListener(new TestAction("lap")); JMenuItem applygas = new JMenuItem("Gaussian filter"); fltmenu.add(applygas); applygas.addActionListener(new TestAction("gas")); JMenuItem applylog6 = new JMenuItem("LOG 6x6 filter"); fltmenu.add(applylog6); applylog6.addActionListener(new TestAction("log6")); JMenuItem applylog17 = new JMenuItem("LOG 17x17 filter"); fltmenu.add(applylog17); applylog17.addActionListener(new TestAction("log17")); fltmenu.addSeparator();

96 JMenuItem allflt = new JMenuItem("All filters"); fltmenu.add(allflt); allflt.addActionListener(new TestAction("allflt")); JMenuItem back = new JMenuItem("Back"); threshmenu.add(back); back.addActionListener(new TestAction("back")); threshmenu.addSeparator(); JMenuItem apply48 = new JMenuItem(" 30, 35, 40, 45, 50, 55, 60"); threshmenu.add(apply48); apply48.addActionListener(new TestAction("48")); JMenuItem apply58 = new JMenuItem(" 65, 70, 75, 80, 85, 90, 95"); threshmenu.add(apply58); apply58.addActionListener(new TestAction("58")); JMenuItem apply68 = new JMenuItem(" 100, 105, 110, 115, 120, 125"); threshmenu.add(apply68); apply68.addActionListener(new TestAction("68")); JMenuItem backe = new JMenuItem("Back"); edgemenu.add(backe); backe.addActionListener(new TestAction("backe")); edgemenu.addSeparator(); JMenuItem result = new JMenuItem("Result"); edgemenu.add(result); result.addActionListener(new TestAction("result")); toolsmenu.add(result); toolsmenu.addSeparator(); JMenuItem graph = new JMenuItem("Edge Graph"); toolsmenu.add(graph); graph.addActionListener(new TestAction("graph")); setJMenuBar(menubar); setBounds(15,5,975,725); setResizable(false); //show(); for (int i=0;i<20;i++) table[i][0]=(30+5*i); Theme theme = new Theme(); MetalLookAndFeel.setCurrentTheme(theme); try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); SwingUtilities.updateComponentTreeUI(this); } catch(Exception e) { System.out.println(e); } //DrawGraph(); fltmenu.hide(); threshmenu.hide(); threshmenu.hide(); edgemenu.hide(); toolsmenu.hide(); pane.show(); repaint(); JOptionPane.showMessageDialog(this,"Welcome to the System."); } } class TestAction extends AbstractAction { public TestAction(String name) { super(name); } public void actionPerformed(ActionEvent event) { if (getValue(Action.NAME).equals("load")) { JFileChooser fileChooser = new JFileChooser("IMAGES"); fileChooser.setDialogType(JFileChooser.DIRECTORIES_ONLY); if(fileChooser.showDialog(new JFrame(),"Select Image") == JFileChooser.APPROVE_OPTION)

97 fileChooser.setDialogType(JFileChooser.DIRECTORIES_ONLY); File file = fileChooser.getSelectedFile(); try { image = ImageIO.read(file); } catch ( Exception e) { //System.out.printf("read error: " + ioe.getMessage()); JOptionPane.showMessageDialog(pane,e.getMessage()); } viewimg(); imglap=ApplyLap(); imggas=ApplyGas(); imgl6=ApplyLog6(); imgl17=ApplyLog17(); fltmenu.show(); } } else if (getValue(Action.NAME).equals("exit")) System.exit(0); else if (getValue(Action.NAME).equals("lap")) { DspImgf("lap"); } else if (getValue(Action.NAME).equals("gas")) { DspImgf("gas"); } else if (getValue(Action.NAME).equals("log6")) { DspImgf("log6"); } else if (getValue(Action.NAME).equals("log17")) { DspImgf("log17"); } else if (getValue(Action.NAME).equals("allflt")) { DspImgf("allflt"); } else if (getValue(Action.NAME).equals("back")) { viewimg(); } else if (getValue(Action.NAME).equals("48")) { DspImg("48"); } else if (getValue(Action.NAME).equals("58")) { DspImg("58"); } else if (getValue(Action.NAME).equals("68")) { DspImg("68"); } else if (getValue(Action.NAME).equals("backe")) { DspImgf(state); } else if (getValue(Action.NAME).equals("result")) { try { ShowResult(); } catch (Exception e) { JOptionPane.showMessageDialog(pane,"Unabe to process image.");} } else if (getValue(Action.NAME).equals("graph")) {DrawGraph(); } else if (getValue(Action.NAME).equals("contents") ) { try { Runtime r = Runtime.getRuntime(); String[] command = {"explorer","CONTENTS.HTML"}; r.exec(command); } catch (Exception ex) { System.out.println(ex); } } else if (getValue(Action.NAME).equals("about") ) { try { Runtime r = Runtime.getRuntime(); String[] command = {"explorer","ABOUT.HTML"}; r.exec(command); } {

98 catch (Exception ex) { System.out.println(ex); } } else if (getValue(Action.NAME).equals("logfile") ) { try { Runtime r = Runtime.getRuntime(); String[] command = {"explorer","LOG MASKS.pdf"}; r.exec(command); } catch (Exception ex) { System.out.println(ex); } } else if (getValue(Action.NAME).equals("edgelink") ) { try { Runtime r = Runtime.getRuntime(); String[] command = {"explorer","EdgeDetectionI.pdf"}; r.exec(command); }catch (Exception ex) { System.out.println(ex); } } else if (getValue(Action.NAME).equals("gaspage") ) { try { Runtime r = Runtime.getRuntime(); String[] command = {"explorer","http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm"}; r.exec(command); }catch (Exception ex) { System.out.println(ex); } } else if (getValue(Action.NAME).equals("logpage") ) { try { Runtime r = Runtime.getRuntime(); String[] command = {"explorer","http://homepages.inf.ed.ac.uk/rbf/HIPR2/log.htm"}; r.exec(command); }catch (Exception ex) { System.out.println(ex); } } else if (getValue(Action.NAME).equals("conpage") ) { try { Runtime r = Runtime.getRuntime(); String[] command = {"explorer","http://homepages.inf.ed.ac.uk/rbf/HIPR2/convolve.htm"}; r.exec(command); }catch (Exception ex) { System.out.println(ex); } } else if (getValue(Action.NAME).equals("search") ) { try { Runtime r = Runtime.getRuntime(); String[] command = {"explorer","http://www.google.co.in"}; r.exec(command); }catch (Exception ex) { System.out.println(ex); } } pane.show(); } } public void viewimg() { JPanel imgpane = new JPanel(new GridLayout(1,2) ); pane.setContentPane(imgpane); pane.add(new pimg(image,"Selected image")); normimg = new BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.TYPE_BYTE_GRAY ); Graphics2D g = normimg.createGraphics(); g.drawImage(image,0,0,image.getWidth(),image.getHeight(),null); normalize(normimg); pane.add(new pimg(normimg,"Normalized Image"));

99 fltmenu.show(); threshmenu.hide(); edgemenu.hide(); toolsmenu.show(); pane.show(); //DrawGraph(); } public BufferedImage ApplyLog6() { int[][] flt = {{-3,-2,-1,-1,-2, -3,}, {-2, 0, 2, 2, 0,-2,}, {-1, 2, 4, 4, 2,-1,}, {-1, 2, 4, 4, 2,-1,}, {-2, 0, 2, 2, 0,-2,}, {-3,-2,-1,-1,-2, -3} }; int width, height, i, j, k; width = normimg.getWidth(); height = normimg.getHeight(); BufferedImage img_log = ApplyGas(); try{ for ( i=0; i<width-7; i++) for ( j=0; j<height-7; j++) { int cc = 0; for (k=0; k<6; k++) for (int l=0; l<6; l++) { cc += ( (img_log.getRGB(i+k,j+l) & 0xff ) * flt[k][l] ); img_log.setRGB(i,j,set_clr(cc)); } } } catch ( Exception e) { System.out.printf("read error: " + e.getMessage()); timg = img_log; return img_log; } public BufferedImage ApplyLog17() { int[][] flt = { {0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0,}, {0, 0, -1, -1, -1, -2, -3, -3, -3, -3, -3, -2, -1, -1, -1, 0, 0,}, {0, 0, -1, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1, -1, 0, 0,}, {0, -1, -1, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -1, -1, 0,}, {0, -1, -2, -3, -3, -3, 0, 2, 4, 2, 0, -3, -3, -3, -2, -1, 0,}, {-1, -1, -3, -3, -3, 0, 4, 10, 12, 10, 4, 0, -3, -3, -3, -1, -1,}, {-1, -1, -3, -3, -2, 2, 10, 18, 21, 18, 10, 2, -2, -3, -3, -1, -1,}, {-1, -1, -3, -3, -3, 4, 12, 21, 24, 21, 12, 4, -3, -3, -3, -1, -1,}, {-1, -1, -3, -3, -2, 2, 10, 18, 21, 18, 10, 2, -2, -3, -3, -1, -1,}, {-1, -1, -3, -3, -3, 0, 4, 10, 12, 10, 4, 0, -3, -3, -3, -1, -1,}, { 0, -1, -2, -3, -3, -3, 0, 2, 4, 2, 0, -3, -3, -3, -2, -1, 0,}, { 0, -1, -1, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -1, -1, 0,}, { 0, 0, -1, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1, -1, 0, 0,}, { 0, 0, -1, -1, -1, -2, -3, -3, -3, -3, -3, -2, -1, -1, -1, 0, 0,}, { 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0,},

100 { 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0} }; int width, height, i, j, k; width = normimg.getWidth(); height = normimg.getHeight(); BufferedImage img_log = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY); try{ for ( i=0; i<width-18; i++) for ( j=0; j<height-18; j++) { int cc = 0; for ( k=0; k<17; k++) for (int l=0; l<17; l++) cc += ((normimg.getRGB(i+k,j+l) & 0xff)* flt[k][l] ); img_log.setRGB(i,j,set_clr(cc)); } } catch ( Exception e) { System.out.printf("read error: " + e.getMessage()); } timg = img_log; return img_log; } public void DspImgf(String s) { JPanel p = new JPanel(new GridLayout(2,3) ); pane.setContentPane(p); state = s; add(new pimg(image,"Original Image")); add(new pimg(normimg,"Normalized Image")); if (s.equals("lap") || s.equals("allflt")) {add( new pimg(imglap,"Laplacian image") );} if (s.equals("gas") || s.equals("allflt")) {add( new pimg(imggas,"Gaussian image") );} if (s.equals("log6") || s.equals("allflt")) {add( new pimg(imgl6,"LOG 6x6 image") );} if (s.equals("log17") || s.equals("allflt")) {add( new pimg(imgl17,"LOG 17x17 image") );} fltmenu.hide(); threshmenu.show(); edgemenu.hide(); if (s.equals("gas") || s.equals("allflt")) { for ( int i=2;i<5;i++) { threshmenu.getItem(i).hide(); } } else { for ( int i=2;i<5;i++) { threshmenu.getItem(i).show(); } } } } class pimg extends JLabel { JLabel name = new JLabel("new image."); JLabel limage = new JLabel(); public pimg(BufferedImage image, String text) { BufferedImage img BufferedImage(305,210,BufferedImage.TYPE_BYTE_GRAY); = new

101 Graphics2D g = img.createGraphics(); g.drawImage(image,0,0,305,210,null); name.setText(text); name.setFont(new Font("Times New Roman",Font.BOLD,18) ); setSize(305,235); setLayout(null); name.setBounds(0,0,305,25); limage.setIcon(new ImageIcon(img) ); limage.setBounds(0,25,305,210); add(name); add(limage); name.setHorizontalAlignment(JLabel.CENTER); show(); } public pimg(Graphics2D o, String text) { BufferedImage img = new BufferedImage(600,525,BufferedImage.TYPE_3BYTE_BGR); Graphics2D g = img.createGraphics(); ; g.drawImage(img,0,0,600,525,null); name.setText(text); name.setFont(new Font("Times New Roman",Font.BOLD,18) ); try{ for ( int i=0; i<600; i++) for ( int j=0; j<500; j++) img.setRGB(i,j,set_clr(0) ); g.setColor(Color.white); g.drawLine(50,0,50,500); g.setColor(Color.white); g.drawLine(0,450,600,450); for ( int i=50; i<600; i+=25) {g.setColor(Color.WHITE); g.drawLine(i,450,i,460); if (i>25) g.drawString(String.valueOf(30 + 5*(i/25-2)) ,i+5,470); /*System.out.println(i); */} int min= Integer.valueOf(table[0][1].toString()),max= Integer.valueOf(table[0][1].toString()),k; g.setColor(Color.yellow); for ( int i=0; i<20; i++) for ( int j=1; j<10; j++) { if (min> Integer.valueOf(table[i][j].toString())) min= Integer.valueOf(table[i][j].toString()); if (max< Integer.valueOf(table[i][j].toString())) max= Integer.valueOf(table[i][j].toString()); } System.out.println(min + " " + max); k=(max-min)/14; int i, j=0; for (i=450; i>0; i-=25,j++) {g.setColor(Color.WHITE); g.drawLine(50,i,40,i); if (i>25) g.drawString(String.valueOf(min+k*j),0,i-55); } k=0; float y=0; for (j=1; j<10; j++) for (i=0; i<20; i++) { Float x = Float.valueOf(table[i][j].toString()); x-=min; x/=(max-min);

102 x*=350; if (j==1) {g.setColor(Color.CYAN); o.setColor(Color.CYAN); o.drawString("Laplacian - 1",20,50);} if (j==2) {g.setColor(Color.BLUE); o.setColor(Color.BLUE); o.drawString("Laplacian - 2",20,100);} if (j==3) {g.setColor(Color.YELLOW); o.setColor(Color.YELLOW); o.drawString("Laplacian - 3",20,150);} if (j==4) {g.setColor(Color.RED); o.setColor(Color.RED); o.drawString("LOG 6x6 - 1",20,200);} if (j==5) {g.setColor(Color.GREEN); o.setColor(Color.GREEN); o.drawString("LOG 6x6 - 2",20,250);} if (j==6) {g.setColor(Color.ORANGE); o.setColor(Color.ORANGE); o.drawString("LOG 6x6 - 3",20,300);} if (j==7) {g.setColor(Color.LIGHT_GRAY); o.setColor(Color.LIGHT_GRAY); o.drawString("LOG 17x17 - 1",20,350);} if (j==8) {g.setColor(Color.PINK); o.setColor(Color.PINK); o.drawString("LOG 17x17 - 2",20,400);} if (j==9) {g.setColor(Color.MAGENTA); o.setColor(Color.MAGENTA); o.drawString("LOG 17x17 - 3",20,450);} g.drawRect(75+25*i-2,(int) (400-x-2),4,4); g.drawRect(75+25*i-1,(int) (400-x-1),2,2); if (i!=0) { g.drawLine(75+25*i-25,(int) (400-y),75+25*i,(int) (400-x)); } y=x; } } catch (Exception e) { JOptionPane.showMessageDialog(pane,e); } setSize(600,550); setLayout(null); name.setBounds(0,0,600,25); limage.setIcon(new ImageIcon(img) ); limage.setBounds(0,25,600,525); add(name); add(limage); name.setHorizontalAlignment(JLabel.CENTER); show(); repaint(); } } class runthread implements Runnable { public runthread(int i) { if (i==1) thlap(); if (i==2) thlog6(); if (i==3) thlog17(); } public void thlap() { int thresh =30; BufferedImage t1,t2;

103 t1 = imglap; //t1 = ApplyLap(); try { for (int k=0;k<20;k++,thresh+=5) { t2 = threshhold(t1, thresh); table[k][1] = edgelength(t2,1); table[k][2] = edgelength(t2,2); table[k][3] = edgelength(t2,3); } } catch (Exception e) { JOptionPane.showMessageDialog(pane,e); } } public void thlog6() { int thresh =30; BufferedImage t1,t2; t1 = imgl6; //t1=ApplyLog6(); try { for (int k=0;k<20;k++,thresh+=5) { t2 = threshhold(t1, thresh); table[k][4] = edgelength(t2,1); table[k][5] = edgelength(t2,2); table[k][6] = edgelength(t2,3); } } catch (Exception e) { JOptionPane.showMessageDialog(pane,e); } } public void thlog17() { int thresh =30; BufferedImage t1,t2; t1 = imgl17; //t1=ApplyLog17(); try { for (int k=0;k<20;k++,thresh+=5) { t2 = threshhold(t1, thresh); table[k][7] = edgelength(t2,1); table[k][8] = edgelength(t2,2); table[k][9] = edgelength(t2,3); } } catch (Exception e) { JOptionPane.showMessageDialog(pane,e); } } public void run() { } }

104 Annexure - III

Glossary
The various terms and abbreviations present in the project are as fallows: a) Image: Image is a rectangular plot of pixels which determine a specific instance of internal or external view of body parts. b) Pixel: A pixel is the least addressable point in an image which gives some information about the body or organ. c) Grey-value: Grey-value refers to the intensity of the pixel that it generates. It gives measure of reflectance of light at that point d) Filter, Mask, Kernel: All the three represent the same. A Filter is a mathematical matrix that is used to operate on an image to highlight the information in that image. e) Threshold: Threshold is the cutoff mark or level that is used to convert the grey image into binary image to intensify the edges that are obtained by applying filter. f) Normalize: Normalizing is the method of converting the image from any grey-level to that of the prescribed grey-level, g) Convolution: Convolution is the method by which a filter is applied on an image. h) Size of image or mask: Size of an image or mask is denoted as (r x c) r represents no. of rows c represents no. of columns

105 i) Edge: Edge is the highlighted portion of image after applying filter that is used to differentiate any two distinct regions present in the image. j) Width of the edge: Width indicates the no. of pixels that edge contains to differentiate two regions. k) Length of the edge: Length indicates the region that the edge covers in the image.

También podría gustarte