A position detecting device and a takeout apparatus capable of obtaining information
on height or stage number of an object in a stack of objects by a two-dimensional
image capturing device for an operation of taking out the object by a robot. A
CCD camera is arranged at a position above a place where workpieces stacked in
multiple stages are provided. An image processing device determines a size of the
image of the uppermost workpiece in a two-dimensional image captured by the camera.
The height or stage number of the workpiece is determined from the size of the
workpiece image using a stored relation table or arithmetic expression representing
relationship between the height or stage number of the workpiece and the size of
the workpiece. For a plurality of kinds of workpieces, the relation table/arithmetic
expression is stored for each kind of workpiece and selectively used in accordance
of a mark on the workpiece which indicate the kind of workpiece. The obtained positional
information on height or stage number is sent to a robot controller so that a robot
is operated to a takeout position which is corrected based on the positional information
for taking out the workpiece from a stack of workpieces.