Question: ( Particle Identification ) The first challenge is to identify the beads amidst the noisy data. Each image is 6 4 0 - by -

(Particle Identification) The first challenge is to identify the beads amidst the noisy data. Each image is 640-by-480 pixels, and each pixel is represented by a Color object which needs to be converted to a luminance value ranging from 0.0(black) to 255.0(white). Whiter pixels correspond to beads (foreground) and blacker pixels to water (background). We break the problem into three pieces: 1. Read the image. Use the Picture data type to read in the image. 2. Classify the pixels as foreground or background. We use a simple, but effective, technique known as thresholding to separate the pixels into foreground and background components: all pixels with monochrome luminance values strictly below some threshold (tau) are considered background, and all others are considered foreground. The two pictures in figure above illustrate the original frame (left) and the same frame after thresholding (right), using =180.0. This value of results in an effective cutoff for the supplied data. 3. Find the blobs. A polystyrene bead is typically represented by a disc-like shape of at least some minimum number pixels (typically 25) of connected foreground pixels. A blob or connected component is a maximal set of connected foreground pixels, regardless of its shape or size. We will refer to any blob containing at least pixels number of pixels as a bead. The center-of-mass of a blob (or bead) is the average of the x- and y-coordinates of its constituent pixels. Define a data type called BlobFinder in blob_finder.py that supports the following API. Use depth-first search to efficiently identify the blobs. Use this data type: Instance variable:- Blobs identified by this blob finder, _blobs (list of Blob objects). BlobFinder()- Initialize blobs to an empty list.- Create a 2D list of booleans called marked, having the same dimensions as pic.- Enumerate the pixels of pic, and for each pixel (i, j):- create a Blob object called blob;- call _findBlob() with the appropriate arguments; and- add blob to blobs if it has a non-zero mass. bf._findBlob()- Base case: return if pixel (i, j) is out of bounds, or if it is marked, or if its luminance (use the function luminance.luminance() for this) is less than tau.- Mark the pixel (i, j).- Add the pixel (i, j) to the blob blob.- Recursively call _findBlob() on the N, E, W, and S pixels. bf.getBeads(pixels)- Return a list of blobs from blobs that have a mass pixels

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!