bitmap位图转换为Mat类型

Mat类型的图片可以进行opencv操作:

Mat mColor = new Mat();
mColor = Utils.bitmapToMat(GLImage.bmp);
Mat mGray = new Mat(mColor.rows(), mColor.cols(), CvType.CV_8UC1, new Scalar(0));//创建一个单通道的Mat图存放灰度图,即单通道

Imgproc.cvtColor(mColor , mGray, Imgproc.COLOR_BGRA2GRAY);     //彩色图到灰度图的转换(Mat类型)
Imgproc.Canny(mGray, mGray, 80, 90, 3);//通过canny算子进行边缘提取

Utils.matToBitmap(FourChannelMat, bmpOut);//是不能展示bmpOut的,因为bmpOut是一个ARGB四通道的图片,而mGray是一个单通道的图片,所以结果是无法展示。

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: