hajaji
hajaji

Reputation: 1

What is the fastest way to create image files

I have a medical device that sends pixel's values in order to plot as an image (frame after frame). I need to take the pixels and build from them an image on the screen. Currently with the code I wrote, I manage to receive 2fps for image size of 800x600.

What is the fastest way plot an image on screen? and doing it continuously.

 Bitmap mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
 Canvas c = new Canvas(mBitmap);
 Paint paint = new Paint();
 int[] colorMatrix = new int[width * height];
 for (int i = 0; i < imageXY.length; i++) {
        int indexValue = Integer.parseInt(strValueIndex[i]);
        int pixelValue = Integer.parseInt(imageValue[indexValue - 1]);
        int pixelIndex = GetXY(imageXY[i]);
        //int pixelIndex = Integer.parseInt(imageXY[i].split(",")[2]);
        colorMatrix[pixelIndex] = pixelValue;
    }

    c.drawBitmap(colorMatrix, 0, width, 0, 0, width, height, false, paint);
    myImage.setImageBitmap(mBitmap);

However its take about 500ms for each frame

Upvotes: 0

Views: 75

Answers (1)

AeroVTP
AeroVTP

Reputation: 336

This is the easiest place to start OpenGL in Android: http://developer.android.com/guide/topics/graphics/opengl.html

I would also look into using multiple cores for this process; although the GPU based calculations may offer higher single core speeds, a fairly "simple" task such as this will be greatly accelerated by utilizing multiple cores and parallel processing, and shouldn't be too hard to implement. Here is an introduction to parallel processing on Android devices.

https://developer.qualcomm.com/blog/multi-threading-android-apps-multi-core-processors-part-1-2

Upvotes: 1

Related Questions