Mask Generation and Finding %Sky |
||
Histogram / Identifying the ThresholdHistogram generation happens immediately after generating the primary mask, which is described below. We build a basic histogram based on the raw image and the mask image, and then smooth it with a Gaussian weighted average method.After smoothing the histogram, we apply the ISODATA clustering algorithm described in the lab assignment to determine thresholds for each region being used. Generating Mask ImagesGenerating mask images turned out to be, ultimately, a multi-step process as we used multiple masks for the multi-region thresholding.Primary MaskThe primary mask is initially chosen by estimating the diameter of the circular image region. First, we check the four corners to find a good value for the dark, non photographic background(by taking the mean). We increase this value by several points of intensity, as we found this tended to smooth a raw mask very well, preventing strange spikes. After picking an intensity to denote non-photographic areas, we searc each row of the image for its first occurrence of areas brighter than this threshold. If this point is on a larger circle than the previous points we had found(that is, we look for the top, bottom, and far left and right of the circle, treating each point as a possible extreme point), we store it as one of the four points we want. After the image has been examined, we use these points to determine an approximate center and the diameter of the circle.For a basic mask, at this point we generate a black image, and draw a white circle with 2/3 the radius of the area we found, centered at central point we found. This eliminates the lens ring, and selects an area with a radius of about 60 degrees(instead of the 90 degree radius of the raw image). This mask is then applied to the raw image during thresholding, which blacks out "uninteresting" areas, sets "sky" areas to bright white, and "tree" areas to a middle grey. Secondary MasksThe secondary masks used by the sub-region thresholding method are generated one at a time. These masks black out the uninteresting area, greys out photographic areas which are not being used in the pass, and sets the area we are thresholding to white. During thresholding, areas which are grey are left alone, while white mask areas are thresholded, and black areas are, naturally, blacked out.Finding %SkyAfter the image has been thresholded by either the single mask method or the multiple mask method, finding the %sky is a simple matter of counting up the white and grey pixels, and then dividing the white pixels by the total number of photographic(white or grey) pixels. |
Back | |
| Swarthmore College - E/CS 27 - Fall 2003 | ||