Tuesday, December 7, 2010

Program Details

SETINPUTIMAGE --> wpixel, hpixel, totaldata[(wpixel*hpixel)*2], edgepoints[{wpixel*hpixel)*4]

processedImage --> PixelArray() --> rgbs[wpixel*hpixel], pixelArrayData[wpixel][hpixel] (get value of each pixel color in the image. Print out the Array. 

If "noiseOn" is "true" addNoise() --->   for each pixel in the image, generate a random double from 0-1. With the random number subtract .5 from it. Then multiply it by 256*the percent value
The color = the color of the pixel. If the color + the random number is greater than 256, then set the pixel to 256.
If the color - the random number is less than 0, then set the pixel to 0
else set the pixel to its original color + the random number;   return the image with noise  

print again with noise. return pixelArrayData………………. processedImage = pixelArrayData (with or without noise)

FindEdge(processedImage) --> 
  • find y derivative: in each Y row, take each X color value and add it to yDerivativeLIst and add 1 to the DerivativeCounter. Once all X values are filled, take the YDerivative of the list and that y value
    • slope[list.length], counter=0, sum = 0;
    • Add to the slope, for each number in the list, the absolute value of list[y] - list [y-1], add 1 to the counter
    • Find the sum, the average, and the max
    • for each number in the slope list, if the number is greater than the max*maxpercet, change the pixel to blue, and add the x and y value to the edgepoints[] add 1 to the edgecounter.
    • add the slope to the totaldata;
  • Find x derivative: in each X row, take each Y color value and add it to xDerivativeLIst and add 1 to the DerivativeCounter. Once all Y values are filled, take the XDerivative of the list and that x value
    • slope[list.length], counter=0, sum = 0;
    • Add to the slope, for each number in the list, the absolute value of list[x] - list [x-1], add 1 to the counter
    • Find the sum, the average, and the max
    • for each number in the slope list, if the number is greater than the max*maxpercet, change the pixel to blue, and add the x and y value to the edgepoints[] add 1 to the edgecounter.
    • add the slope to the totaldata;
  • Print points of the edge points
  • Print list of derivatives
  • Find Efficiency - find max and total average of derivatives. Efficiency = (max-totalAverage)/totalAverage

No comments:

Post a Comment