I'm making an app that does some real time image processing using the camera. I've written code in Java and now I'm trying to port that code over to native code to speed things up. An essential part of the Java code is to use the Color.rgb (from the android.Graphics library) method to convert my array of pixel intensities into "color-ints" (description given by the documentation). The specific line of code is:
Color.rgb(pixel, pixel, pixel)
where pixel is an integer between 0 and 255. I then use the drawBitmap method to draw this array of color-ints to a canvas. Yes I realise that this results in a B&W image because that is what I need.
Now I need to convert the pixel intensities into color-ints in my C code, and I can't use the above method as there is no library in C. I'm not sure what color-ints even are in the first place. If someone could describe to me what the Color.rgb method actually does to an intensity value, I could then manually code that in C. Cheers.
Take a look:
public static int rgb(int red, int green, int blue) {
return (0xFF << 24) | (red << 16) | (green << 8) | blue;
}
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With