Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use opencv of Android to realize multi-channel separation and merge

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

In this article Xiaobian for you to introduce in detail "how to use Android's opencv to achieve multi-channel separation and merge", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to use Android's opencv to achieve multi-channel separation and merger" can help you solve your doubts.

Multichannel separation

APIpublic static void split (Mat m, List mv)

Parameter one: M, the multi-channel image to be separated

Parameter 2: mv, the separated single-channel image

Operate override fun onCreate (savedInstanceState: Bundle?) {super.onCreate (savedInstanceState) mBinding = DataBindingUtil.setContentView (this, R.layout.activity_channel_split_merge) mBgr = Utils.loadResource (this, R.drawable.test) val imgList = mutableListOf () Core.split (mBgr, imgList) mChannelB = imgList [0] mChannelG = imgList [1] mChannelR = imgList [2]} Channel merge

APIpublic static void merge (List mv, Mat dst)

Parameter 1: mv, an array of images to be merged, where each image must have the same size and data type

Parameter 2: dst, the merged output image has the same size and data type as mv [0], and the number of channels is equal to the sum of the channels of all input images.

Operation private fun showBGZero () {val zero = Mat.zeros (mBgr.rows (), mBgr.cols (), CvType.CV_8UC1) val list = mutableListOf () list.add (zero) list.add (zero) list.add (mChannelR) val result = Mat () Core.merge (list, result) showMat (result) result.release ()} private fun showBRZero () {val zero = Mat.zeros (mBgr.rows (), mBgr.cols () CvType.CV_8UC1) val list = mutableListOf () list.add (zero) list.add (mChannelG) list.add (zero) val result = Mat () Core.merge (list, result) showMat (result) result.release ()} private fun showGRZero () {val zero = Mat.zeros (mBgr.rows (), mBgr.cols () CvType.CV_8UC1) val list = mutableListOf () list.add (mChannelB) list.add (zero) list.add (zero) val result = Mat () Core.merge (list, result) showMat (result) result.release ()} private fun showSwitchBR () {val zero = Mat.zeros (mBgr.rows (), mBgr.cols () CvType.CV_8UC1) val list = mutableListOf () list.add (mChannelR) list.add (mChannelG) list.add (mChannelB) val result = Mat () Core.merge (list, result) showMat (result) result.release ()} result

Read here, this "how to use Android opencv to achieve multi-channel separation and merger" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more about the article, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report