This paper presents a flexible camera positioning strategy to deal with unknown object poses in a visual inspection application. The object's CAD model is used in a view-based strategy to estimate the object pose. An effective lookup table method is adopted to speed up the estimation. The principal component analysis (PCA) is used to reduce the lookup table size and save memory space. Compared with those edge-based approaches which require good initial pose estimation, our method can find the initial pose in a large range without any initial guess. With the pose estimation precise Eye-in-Hand camera positioning is realized by homography-based visual servo to inspect the object. The inspection strategy with unknown object poses is described in detail. Experiments are carried out to evaluate the system performances.