Android alternative to java.awt (BufferedImage and Raster)

后端 未结 2 2176
無奈伤痛
無奈伤痛 2021-02-09 14:55

for my final year project I am developing an android app that can capture the image of a leaf and identify what type of tree it came from. I have a nearly completed PC version

2条回答
  •  余生分开走
    2021-02-09 15:49

    Sounds like you just want to work with bitmaps and be able to manipulate the pixels themselves in an array. The Bitmap class comes to mind along with its getPixels method. Remember though that you have much more limited memory on a mobile device. It's easy to run into out of memory problems when working with large bitmaps.

    Another route would be to use the NDK. I don't have much experience there, but AndroidBitmap_lockPixels and AndroidBitmap_unlockPixels are probably a good place to start.

    Lastly, yet another option that should perform pretty well is to use RenderScript.

    If all you're looking to do is load an image into an int array though, Bitmap.getPixels should be quite sufficient.

提交回复
热议问题