bitmap

OnPreviewFrame data image to imageView

元气小坏坏 提交于 2019-12-28 12:44:13
问题 i'm trying to get the byte[] from the preview of the camera, convert it to bitmap and display it on a imageview with imageView.setImageBitmap() i've managed to start the preview and display it on a surfaceView, but i don't know how to convert the byte[] data (that comes in Yuv format i think) in a RGB bitmap to display it on a imageView. the code i'm trying is the following: camera = camera.open(); parameters = camera.getParameters(); camera.setParameters(parameters); surfaceHolder =

OnPreviewFrame data image to imageView

最后都变了- 提交于 2019-12-28 12:43:12
问题 i'm trying to get the byte[] from the preview of the camera, convert it to bitmap and display it on a imageview with imageView.setImageBitmap() i've managed to start the preview and display it on a surfaceView, but i don't know how to convert the byte[] data (that comes in Yuv format i think) in a RGB bitmap to display it on a imageView. the code i'm trying is the following: camera = camera.open(); parameters = camera.getParameters(); camera.setParameters(parameters); surfaceHolder =

PixelFormat.Format32bppArgb seems to have wrong byte order

烈酒焚心 提交于 2019-12-28 12:14:19
问题 I try to get all byte values from a Bitmap(System.Drawing.Bitmap). Therefore I lock the bytes and copy them: public static byte[] GetPixels(Bitmap bitmap){ if(bitmap-PixelFormat.Equals(PixelFormat.Format32.bppArgb)){ var argbData = new byte[bitmap.Width*bitmap.Height*4]; var bd = bitmap.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat); System.Runtime.InteropServices.Marshal.Copy(bd.Scan0, argbData, 0, bitmap.Width * bitmap.Height * 4);

Adding a round frame circle on rounded bitmap

对着背影说爱祢 提交于 2019-12-28 11:51:58
问题 Im trying to create a round frame around my bitmap! With this code im able to make my bitmap round: public static Bitmap getRoundedCornerBitmap(Bitmap bitmap) { Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap .getHeight(), Config.ARGB_8888); Canvas canvas = new Canvas(output); final int color = 0xff4242DB; final Paint paint = new Paint(); final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); final RectF rectF = new RectF(rect); final float roundPx = bitmap

Android canvas.drawBitmap讲解

浪子不回头ぞ 提交于 2019-12-28 09:08:19
1,基本的绘制图片方法 drawBitmap(Bitmap bitmap, float left, float top, Paint paint) 参数://Bitmap:图片对象, left:偏移左边的位置,top: 偏移顶部的位置 2, drawBitmap( Bitmap bitmap, Rect src, Rect dst, Paint paint); 这里由2个Rect, 第一个Rect --src 代表要裁剪的bitmap的区域,如传null,表示需要绘制整个图片, 第二个Rect ---det表示需要将bitmap,绘制在屏幕上的位置,不可为空,并且大于src则把src的裁截区放大,小于src则把src的裁截区缩小。 Bitmap bitmap = BitmapFactory.decodeResource(getContext().getResources(),R.drawable.ic_logo); //绘制方法1:---原图,制作偏移 canvas.drawBitmap(bitmap,100,100,mPaint);//将图片从(0,0)位置向左偏移100,向右偏移100 Rect srcRect = new Rect(0,0,bitmap.getWidth()/2,bitmap.getHeight()/2);//截取图片左上1/4的区域 Rect dstRect

Convert NV21 byte array into bitmap readable format [duplicate]

风格不统一 提交于 2019-12-28 06:47:26
问题 This question already has answers here : How to use ScriptIntrinsicYuvToRGB (converting byte[] yuv to byte[] rgba) (5 answers) Closed last year . Hey I'm creating small camera app I have implemented every things but I have one problem which is converting NV21 byte array into jpeg format I have found many way but all of them even not working or work on some devices firstly i tried this snippet and it work on Xperia z2 5.2 but on galaxy s4 4.4.4 bitmap = BitmapFactory.decodeByteArray(data, 0,

Background Turns Black When Saving Bitmap - C#

£可爱£侵袭症+ 提交于 2019-12-28 06:46:19
问题 I am currently trying to save a bitmap image, but the background is changing to black. I can "Save As" the image perfectly fine. I can also "Save" the image as well. Which was much more difficult because I had to overwrite the existing image. However, when I "save" my image the background is turning black. And I have no idea what is causing it. Here is my code: Bitmap tempImage = new Bitmap(DrawArea); DrawArea.Dispose(); if (extension == ".jpeg") tempImage.Save(fileName, System.Drawing

Converting Image to bitmap turns background black

廉价感情. 提交于 2019-12-28 06:46:10
问题 I need to convert an Image to a bitmap. initially a gif was read in as bytes and then converted to an Image. But when I try convert the image to a bit map, the graphic displaying in my picturebox has a black background when it used to be white. Here is the code: var image = (System.Drawing.Image)value; // Winforms Image we want to get the WPF Image from... var bitmap = new System.Windows.Media.Imaging.BitmapImage(); bitmap.BeginInit(); MemoryStream memoryStream = new MemoryStream(); // Save

how to save bitmap to android gallery

孤人 提交于 2019-12-28 06:35:54
问题 unfortunately the solutions I've found didn't work on android 5.1.1. I have a bitmap called source. I need to save it directly to my phone's gallery. My manifest contains <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Can you give me a working method to do this? 回答1: Use this one: private void saveImage(Bitmap finalBitmap, String image_name) { String root = Environment.getExternalStorageDirectory().toString(); File myDir = new File(root); myDir.mkdirs(); String

How to flood-fill part of a bitmap enclosed by a black border with my chosen color?

这一生的挚爱 提交于 2019-12-28 06:26:50
问题 I want to programmatically modify a bitmap using python but don't really need a thorough grounding in the subject, so would like to concentrate on learning just what I need to get the job done. A good example of the kind of thing I'm after would be a bitmap image of england and it's counties. This would initially display a black border around all the counties on a white background. So far so good, but how can I dynamically change the background color of a county? Off the top of my head I was