A machine comprising: a camera configured to capture a first image of medication held by a receptacle (408, 416); memory hardware (904, 906) that stores code; and processor hardware that executes the code stored by the memory hardware (904, 906), wherein the code implements: a color processing module configured to create a second image based on the first image in which each pixel of the second image is identified by a single value; a pixel identification module configured to divide pixels of the second image into first and second mutually exclusive subsets of pixels, wherein pixels of the first subset are more likely to correspond to the receptacle (408, 416) than are pixels of the second subset; a scanning module configured to process the second image along a first axis by, for each point along the first axis: defining a line that is perpendicular to the first axis and intersects the first axis at the point; counting how many of the pixels in the second image located along the line are in the first subset; and recording the count; a maxima detection module configured to determine a first local maximum of the counts and a second local maximum of the counts; an elliptic calculation module configured to: estimate a position of a first edge of the receptacle (408, 416) based on a position of the first local maximum along the first axis; estimate a position of a second edge of the receptacle (408, 416) based on a position of the second local maximum along the first axis; and define an ellipse based on the first and second edges; and an output module configured to output a processed image based on the first image, wherein the processed image indicates that areas of the first image that are outside the defined ellipse are excluded from further processing. a camera configured to capture a first image of medication held by a receptacle (408, 416); memory hardware (904, 906) that stores code; and processor hardware that executes the code stored by the memory hardware (904, 906), wherein the code implements: a color processing module configured to create a second image based on the first image in which each pixel of the second image is identified by a single value; a pixel identification module configured to divide pixels of the second image into first and second mutually exclusive subsets of pixels, wherein pixels of the first subset are more likely to correspond to the receptacle (408, 416) than are pixels of the second subset; a scanning module configured to process the second image along a first axis by, for each point along the first axis: defining a line that is perpendicular to the first axis and intersects the first axis at the point; counting how many of the pixels in the second image located along the line are in the first subset; and recording the count; a maxima detection module configured to determine a first local maximum of the counts and a second local maximum of the counts; an elliptic calculation module configured to: estimate a position of a first edge of the receptacle (408, 416) based on a position of the first local maximum along the first axis; estimate a position of a second edge of the receptacle (408, 416) based on a position of the second local maximum along the first axis; and define an ellipse based on the first and second edges; and an output module configured to output a processed image based on the first image, wherein the processed image indicates that areas of the first image that are outside the defined ellipse are excluded from further processing. a color processing module configured to create a second image based on the first image in which each pixel of the second image is identified by a single value; a pixel identification module configured to divide pixels of the second image into first and second mutually exclusive subsets of pixels, wherein pixels of the first subset are more likely to correspond to the receptacle (408, 416) than are pixels of the second subset; a scanning module configured to process the second image along a first axis by, for each point along the first axis: defining a line that is perpendicular to the first axis and intersects the first axis at the point; counting how many of the pixels in the second image located along the line are in the first subset; and recording the count; defining a line that is perpendicular to the first axis and intersects the first axis at the point; counting how many of the pixels in the second image located along the line are in the first subset; and recording the count; a maxima detection module configured to determine a first local maximum of the counts and a second local maximum of the counts; an elliptic calculation module configured to: estimate a position of a first edge of the receptacle (408, 416) based on a position of the first local maximum along the first axis; estimate a position of a second edge of the receptacle (408, 416) based on a position of the second local maximum along the first axis; and define an ellipse based on the first and second edges; and estimate a position of a first edge of the receptacle (408, 416) based on a position of the first local maximum along the first axis; estimate a position of a second edge of the receptacle (408, 416) based on a position of the second local maximum along the first axis; and define an ellipse based on the first and second edges; and an output module configured to output a processed image based on the first image, wherein the processed image indicates that areas of the first image that are outside the defined ellipse are excluded from further processing.