提交 120a3b75 编写于 作者: E Ethan Rublee

optimizing calibration for android

上级 56313594
......@@ -160,34 +160,9 @@ bool Calibration::detectAndDrawChessboard(int idx, image_pool* pool)
if (grey.empty())
return false;
vector<Point2f> corners;
IplImage iplgrey = grey;
patternfound = cvCheckChessboard(&iplgrey, patternsize);
if (!patternfound)
return false;
float factor = grey.cols / 320.0f;
if (factor < 1)
factor = 1;
cv::Size r_size = cv::Size(grey.cols / factor, grey.rows / factor);
Mat grey_sub;
while (patternfound && (r_size.width < grey.size().width))
{
cv::resize(grey, grey_sub, r_size);
patternfound = findChessboardCorners(grey_sub, patternsize, corners);
if (patternfound)
{
r_size.width *= 2;
r_size.height *= 2;
}
else
{
return false;
}
}
// hopefully if we're going to fail we fail on a smaller size image in the while-loop
patternfound = findChessboardCorners(grey, patternsize, corners);
patternfound = findChessboardCorners(grey, patternsize, corners,CALIB_CB_FILTER_QUADS + CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE
+ CALIB_CB_FAST_CHECK);
Mat img = pool->getImage(idx);
if (corners.size() < 1)
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="chesssizes">
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
......
......@@ -3,7 +3,7 @@
<string-array name="image_sizes">
<item>320x240</item>
<item>400x300</item>
<item>600x400</item>
<item>640x480</item>
<item>800x600</item>
<item>1000x800</item>
</string-array>
......
......@@ -17,7 +17,7 @@ public class ChessBoardChooser extends Activity {
public static final String CHESS_SIZE = "chess_size";
public static final int DEFAULT_WIDTH = 6;
public static final int DEFAULT_HEIGHT = 8;
public static final int LOWEST = 3;
public static final int LOWEST = 2;
class DimChooser implements OnItemSelectedListener {
private String dim;
......
......@@ -51,8 +51,8 @@ public class CameraConfig extends Activity {
// Restore preferences
SharedPreferences settings = ctx.getSharedPreferences(CAMERA_SETTINGS,
0);
size[0] = settings.getInt(IMAGE_WIDTH, 600);
size[1] = settings.getInt(IMAGE_HEIGHT, 400);
size[0] = settings.getInt(IMAGE_WIDTH, 640);
size[1] = settings.getInt(IMAGE_HEIGHT, 480);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册