I got R cannot be resolved
a variable error when i debug with build target at android 4.2.2, in addition when i debug with android 5.1.1, i got cannot load library error. How can i solve these problems. Thanks for your helps.
public class MainActivity extends ActionBarActivity {
private final String imageInSD = "/sdcard/dapi1.jpg";
Mat src,dst;
static {
if (!OpenCVLoader.initDebug()) {
// Handle initialization error
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView myImageView = (ImageView)findViewById(R.id.imageview);
//Mat image = Highgui.imread(imageInSD);
Bitmap bitmap = BitmapFactory.decodeFile(imageInSD);
Size size = new Size(bitmap.getWidth(), bitmap.getHeight());
src = new Mat(size,CvType.CV_8UC3);
Utils.bitmapToMat(bitmap,src);
Imgproc.cvtColor(src, src, Imgproc.COLOR_RGB2GRAY);
Imgproc.threshold(src, src, 100, 255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C);
Utils.matToBitmap(src, bitmap);
myImageView.setImageBitmap(bitmap);
}
}
Any help would be greatly appreciated.