Techno News, How To Unbrick Qualcomm Android Devices, 15 Second ADB Installer Latest Version V1.4.3 Free, Samsung FRP Reset Files Using Odin Flash, ATF Box Full Crack Tool, Facebook Contacts Sync, Miracle Box Latest Setup Full Crack Free, 4 Steps Jcow Social Networking Web Server, Infinity Box Chinese Miracle 2 MTK v 1.58 setup, Miracle Box Crack Latest Version 2.26 Full Setup, Nokia Asha 501 RM-899 Latest Flash File

Jumat, 01 Mei 2015

Convert IplImage to byte array or IplImage to Bitmap in JavaCV - Android Java

Convert IplImage to byte array or IplImage to Bitmap in JavaCV - Android Java - is the information you are looking for in search engines like google and others, okay we have provided such information in the blog Techno News, we have around collecting information from various reliable sources and presenting it in this blog, well please read Convert IplImage to byte array or IplImage to Bitmap in JavaCV - Android Java to finish:

Articles : Convert IplImage to byte array or IplImage to Bitmap in JavaCV - Android Java
full Link : Convert IplImage to byte array or IplImage to Bitmap in JavaCV - Android Java

You can also see our article on:


Convert IplImage to byte array or IplImage to Bitmap in JavaCV - Android Java

Hi techies,

Now iam gonna share a wonderful and efficient way on "How to convert IplImage to byte array in JavaCV" with pure java code.



How to convert IplImage to Android Bitmap

public static Bitmap IplImageToBitmap(IplImage src) {
Bitmap bm=null;
   int width = src.width();
   int height = src.height();
// Unfortunately cvCvtColor will not let us convert in place, so we need to create a new IplImage with matching dimensions.
IplImage frame2 = IplImage.create(width, height, opencv_core.IPL_DEPTH_8U, 4);
opencv_imgproc.cvCvtColor(src, frame2, opencv_imgproc.CV_BGR2RGBA);
                   // Now we make an Android Bitmap with matching size ... Nb. at this point we functionally have 3 buffers == image size. Watch your memory usage!
bm = Bitmap.createBitmap(frame2.width(), frame2.height(), Bitmap.Config.ARGB_8888);
bm.copyPixelsFromBuffer(frame2.getByteBuffer());
//src.release();
frame2.release();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
return bm;
}


How to convert IplImage to byte[]

public static byte[] IplImageToByteArray(IplImage src) {
Bitmap bm=null;
    int width = src.width();
    int height = src.height();
 // Unfortunately cvCvtColor will not let us convert in place, so we need to create a new IplImage with matching dimensions.
  IplImage frame2 = IplImage.create(width, height, opencv_core.IPL_DEPTH_8U, 4);
  opencv_imgproc.cvCvtColor(src, frame2, opencv_imgproc.CV_BGR2RGBA);
                    // Now we make an Android Bitmap with matching size ... Nb. at this point we functionally have 3 buffers == image size. Watch your memory usage!
  bm = Bitmap.createBitmap(frame2.width(), frame2.height(), Bitmap.Config.ARGB_8888);
  bm.copyPixelsFromBuffer(frame2.getByteBuffer());
  //src.release();
  frame2.release();
  ByteArrayOutputStream stream = new ByteArrayOutputStream();
  bm.compress(Bitmap.CompressFormat.PNG, 100, stream);
  return stream.toByteArray();
}

So hope you guys got this helper methods so useful for your JavaCV projects.
And don't forget to use the comment box below.



Information about the Convert IplImage to byte array or IplImage to Bitmap in JavaCV - Android Java has been discussed

A few of our information about the Convert IplImage to byte array or IplImage to Bitmap in JavaCV - Android Java, hopefully give more knowledge for you

You have finished reading Convert IplImage to byte array or IplImage to Bitmap in JavaCV - Android Java and many articles about Techno News in our blog this, please read it. and url link of this article is https://ikkemunandar.blogspot.com/2015/05/convert-iplimage-to-byte-array-or.html Hopefully discussion articles on provide more knowledge about the world of new tech gadgets and Techno News.

Tag :
Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : Convert IplImage to byte array or IplImage to Bitmap in JavaCV - Android Java

4 komentar:

  1. Với nền kinh tế ngày càng phát triển, trên thị trường có hàng ngàn các sản phẩm hàng hóa đến từ các doanh nghiệp khác nhau. Chính vì vậy, để kinh doanh hiệu quả, ngoài chất lượng sản phẩm thì doanh nghiệp cũng cần chú ý thương hiệu, hình ảnh công ty. in tem decal đẹp, bắt mắt đã trở thành một công cụ marketing vô cùng hiệu quả được rất nhiều doanh nghiệp sử dụng.
    Bạn có nhu cầu in tem decal vui lòng liên hệ với in Đông Bắc để có những sản phẩm chất lượng nhất.
    hotline: 0988291900

    BalasHapus
  2. It’s really informative. I am going to watch out for brussels.
    I’ll be grateful if you continue this in future. smartbytes Numerous people will be benefited from your writing.
    Airtel USSD Codes
    Cheers!

    BalasHapus