Android OpenCV 灰度图转化

阅读更多
package com.tsayq.opencv0;

import org.opencv.core.Mat;
import org.opencv.highgui.Highgui;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;

public class OpenCV_0_Activity extends Activity {
	private ImageView imageView;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		imageView = (ImageView) findViewById(R.id.image);
		Mat img = Highgui.imread("/sdcard/Lena.jpg",0);
		Highgui.imwrite("/sdcard/new.JPG", img);
		Bitmap bitmap = BitmapFactory.decodeFile("/sdcard/new.JPG");
		imageView.setImageBitmap(bitmap);

	}
}

你可能感兴趣的:(android,opencv,灰度图,转化,转换)