Sunday, November 14, 2010

Algorithm

The algorithm needs to include the following:


Load image from camera or file
Gray scale image
Find pixel matrix of image - print out
Find Edges- change color of edges to blue
Print edge point coordinates
Check for Shape
- Circle: find center point by using edge points, find radii -->


  public int radiusAverage(double listOfRadii[]){
        int sum=0;
        for (int x=0;x< listOfRadii.length;x++){
            sum += listOfRadii[x];
        }
        sum = sum/listOfRadii.length;
        return sum;
    }


              GIVEN: list of radii
              if  radiusaverave =radiusAverage(listOfRadii);
               for (int x=0;x
//            System.out.println("radii difference: " + listOfRadii[x]/radiusaverave);
            if (listOfRadii[x]/radiusaverave > 4.4){ //CHANGE 4.4 MAYBE

                   NOT A CIRCLE
- Square:
0,1,2,3,4,5,6,7,8,9,10
1
2
3
4
5
6
7
8
9
10

0,00; 1,00; 2,00; 2,00; 3,00; 4,00; 5,00; 6,00; 7,00; 8,00; 9,00; 10,00; 
0,01                                  10,01
0,02                                  10,02
0,03                                  10,03
0,04                                  10,04
0,05                                  10,05
0,06                                  10,06
0,07                                  10,07
0,08                                  10,08
0,09                                  10,09
0,10; 1,10; 2,10; 2,10; 3,10; 4,10; 5,10; 6,10; 7,10; 8,10; 9,10; 10,10; 


square - go through list until y changes... the list up until when Y changes is the upper line of the square.. record # of numbers in a variable topside. *this will be checked with another one later*

Go through loop.. (for... ){ list[x] == (look for X coord.) After Y changes, look for change in X. Add each one to a varialbe
rightside or leftside.


In the latter loop ^ have another loop that checks for a change in Y.. *really it checks that it doens't change*

With the following numbers add them up and save in bottomside
check if (topside and bottomside) and (rightside and leftside) have the same # of numbers
If yes, it is a square

- Triangle:

Triangle:

---    ---    ---    3,0    4,0    5,0     ---    ---    ---   ---    12/3 = 4
---    ---    2,1    3,1    4,1    5,1    6,1    ---    ---   ---    20/5 = 4
---    ---    2,2    3,2    ---    5,2    6,2    ---    ---   ---     16/4 = 4
---    1,3    2,3    ---    ---    5,3    6,3    ---    ---   ---     14/4 = 3.5
---    1,4    2,4    ---    ---    ---    6,4    7,4    ---   ---     16/4 = 4
0,05   1,5    2,5    ---    ---    ---    6,5    7,5    ---   ---     16/4 = 4
0,06   1,6    ---    ---    ---    ---    ---    7,6    8,6   9,6    25/4
0,07   1,7    ---    ---    ---    ---    ---    ---    8,7   9,7    18/3 = 6
0,08   ---    ---    ---    ---    ---    ---    ---    8,8   9,8    17/2 = 8.5
0,19   ---    ---    ---    ---    ---    ---    ---    ---   9,9    = 9


add up X values until Y value changes, The average of each line should be relatively the same/ increase as it gets to the end. If so, the image is a triangle

Goals

Create a Java-based application that uses edge detection and shape recognition to images from a camera
Design and implement a shape detection algorithm in Java.
Integrate shape recognition algorithm in application and test its effectiveness against image noise.

Proposal


Step 1: Project Ideas:
  1. Machine Vision
  2.  ?
  3.  ?
  4.  ?
  5.  ?
Step 2: My Decision
""How does noise affect an algorithm's ability to recognize a shape?""
"Title: The effect of noise on pattern recognition algorithms"
Step 3: Variables
IV - Noise level on image
DV - Correct reading of image
Constants - Algorithm, language, type of camera, color and size of image, lighting, location
Step 4: Questions to Research
  1. How does image processing work?
  2. What is machine vision?
  3. How does a computer read a picture?
  4. What is edge detection?
  5. What is noise?
Step 5: Research (2 must be books, magazines, or online journals)
1st Source -Knudsen, JavaWorld.com, 09/01/98, Day and Jonathan. "Image Processing with Java 2D - JavaWorld." Welcome to JavaWorld.com. 01 Sept. 1998. Web. 15 Sept. 2010. .
Notes:
Convolution - allows you to combine the colors of a source pixel and its neighbors to determine the color of a destination pixel.
Blur, Edge Detection, Invert color, Negative Color, Thresholding
2st Source - Warren E. Smith, "Image processing," in AccessScience, ©McGraw-Hill Companies, 2008, http://www.accessscience.com
Notes:
Image Processing - manipulating data in the form of an image through several possible techniques. An image is usually interpreted as a two-dimensional array of brightness values.
To digitally process an image- reduce the image to a series of numbers that can be manipulated by the computer. Each point or pixel has a number according to the color it shows, which differs in light.(256 gray levels)The point is then moved a distance usually equal to its width, and the process is repeated. The smaller the spot and the finer the scan , the more accurate the description of the transparency will be.
pixel - each number representing the brightness value of the image at a particular location. Also called a picture element.
It compares each pixel with its eight neighbours and if the pixel is larger or smaller in value than all eight, replaces it by the largest or smallest of the neighbours. This is good for removing single noisy pixels from an image.
An image is enhanced when it is modified so that the information it contains is more clearly evident, but enhancement can also include making the image more visually appealing. An example is noise smoothing
To create noise- replace the value of randomly chosen pixels by 150 (bight gray) or 0 (black). To smooth the image, a median filter can be aplied with a 3X3 pixel window.This means that the value of every pixel in the noisy image is recorded, along with the values of its nearest eight neighbors. These nine numbers are then ordered according to size, and the median is selected as the value for the pixel in the new image. As the 3 × 3 window is moved one pixel at a time across the noisy image, the filtered image is formed. This is a local operation, since the value of a pixel in the new image depends on the values of nine pixels in the old image.

3st Source - "Machine Vision." How the New Technology Works: A Guide to High-tech Concepts. 2 ed. 18 Sep. 1991. eLibrary Science. Web. 09 Sep 2010.
Notes: 
Machine vision is the process by which a computer-driven device optically senses external objects and, from its analysis of the sensed data, infers accurate information about those objects. The sensing device is usually a video camera that is linked to a computer that digitizes the captured images and analyzes them.
For INTRODUCTION: machine vision is used for small tasks like checking for correct size or shape for automobiles, in medical diagnosing(x-rays, photographs,chromosome slides, cancer smears), military - photos.
note- we don’t “see” everything that our eyes sense. The mind filters out the irrelevant things. The eye-mind combo allows us to focus(zoom in) on the surroundings that interest us and then ignore the rest
4st Source -.Hester, Josiah. "Ultimate Java Image Manipulation." Javalobby | The Heart of the Java Developer Community. 11 Sept. 2007. Web. 13 Sept. 2010. http://www.javalobby.org/articles/ultimate-image/.
Notes: 
-Loading an image,drawing an image on the screen,Creating on image, saving Image, Translucency, Certain color Transparent,Flipping,Rotating,Resizing, Splitting, Animation
5st Source - Levine, Martin D. Vision in Man and Machine. New York: McGraw-Hill, 1985. Print.
Notes: 
Page 12 - the black and white image seen by the computer “eye”: The sampling and quantification process in these applications results in an array on numbers, each of which represents how gray the image is in the small sampled area. This degree of grayness can vary from white to black as specified by an appropriate intensity value assigned according to a linear scale. 
Page 170 - An edge in a picture may be defined as a discontinuity of abrupt change in the gray level or color. In general, pictures may contain a variety of edge sizes, some short and other long. These contrasting segments may occur at any orientation. An efficient edge-detection procedure would necessarily have to be able to distinguish contrast at different angles. Analyzing edge contest at a particular point in a picture by observing the local date at a set of frequency bandwidths.
Page 170 - Idealized edge models can be represented by the conventional singularity functions in math. An abrupt change in intensity can be defined by an ideal step.
Page 480 - There exist many theories of shape description and recognition, each attempting to explain some specific aspect of the problem. This is so because it is possible to conceptualize shape as a high-level perceptual function.
Principle of visual perception: “the human visual system is designed to produce organized perception. Information consisting of a variety of such spatial features as size, shape, distance, relative position, and texture is structured by the mind to represent visual scenes. These spatial features are not perceived as properties of things, objects in the scene, and not merely as abstract lines of surfaces. We do not perceives line of unattached extents; we perceive objects. All parts of each object are perceived together in one construction - not as separate, independent, and free-floating elements. All all the objects are perceived as related to each other near, far, behind, adjoining, and so fourth”
page 481 - “A contour is a one-dimensional interface between figure and ground” This is only acceptable in the very restricted sense in which an object is superimpose on a background. We shall assume that a contour is made up of a set of edges connected to each other but not necessarily forming a closed curve.
page 485 - We create a binary image by assigning a 1 to the set of pixels in the object set and a 0 to all the exterior pixels.Therefore, the elements of the border set must all touch at least one pixel in the exterior set, conceptually separating it from the interior
Image --> Photoelectric Transduction --> scanner and digitizer (Picture input mechanism) --> image processor --> pictorial or symbolic output
PRODUCE BINARY OBJECT FROM THE ORIGINAL GRAY-LEVEL IMAGE
Step 6: Hypothesis
If the amount of noise increases then the correct reading of the image decreases because the algorithm will not be able to detect the shape.
Step 7: Procedure
  1. What materials will be needed for the project and how will you obtain them?
    • Computer with java
    • Webcam
    • Printer and Paper
    • Room with fixed lighting
    • Shape Recognition Algorithm
  1. Where will you do your work?
    • At home or in class
  2. How will you measure the dependent variable?
    • If the machine gets the shape correct or not based on amount of noise
  3. Describe your procedure in detail
    • First i write the Shape Recognition Algorithm with edge detection and all the math to recognize a circle
    • Print out 5-10 pictures with different amounts of noise by changing amount of random numbers to make the image have noise.
    • Set up room with camera and fixed light
    • Run experiment
Step 8: Reactions
Let us know how you are feeling about this project in a “Reactions” paragraph.
Are you anxious? Excited? Comfortable? Do you have questions about anything?
Tell us your thoughts/feelings at this point.
I am not very anxious, I think it is very doable. I am slightly excited. I just want to get going and i will be more excited. At the moment i do not have questions, i just need to start coding. I feel that right now i have only a small clue as to what to do, but once i get on the computer i will pick it up and it will end up being fun and challenging for me.
Step 9: Honor Pledge
Pledge your assignment, by writing in ink: “On my honor, I have neither given nor received unauthorized aid in doing this project,” and sign it in ink.

Science Project 2010-2011

This blog is going to be used to keep information about my science project