Confusion on YUV NV21 conversion to RGB
First of all, I am not super experienced with image encoding (has some limited exposure to this about a year ago). So, take my answer with grain of salt.
However, I believe you are right. I think in their code both
a) V and U are flipped
b) R and B are flipped
I have a feeling that when both of these things are flipped, it will produce the same result as if they arent' flipped. That's the reason why you can find wrong code in many places (originally, somebody got it wrong and after it was copied all over the places, because the resulting code works (however, variables named incorrectly)).
Here is another example of code (which works the same as yours):
http://www.41post.com/3470/programming/android-retrieving-the-camera-preview-as-a-pixel-array
Converting YUV-RGB(Image processing)-YUV during onPreviewFrame in android?
Why not specify that camera preview should provide RGB images?
i.e. Camera.Parameters.setPreviewFormat(ImageFormat.RGB_565);
YUV_NV21_TO_RGB not working?
Your preview size is not 128 by 128 because you fail to set it. You set it on the Camera.Parameters
instance but you don't apply it to the camera.
You need to add the following line:
camera.setParameters(param);
And it's probably safe to get the parameters directly from the Camera
instance:
preview_format = camera.getPreviewFormat();
Camera.Size sz = camera.getPreviewSize();
Convert YBR_Full image to RGB in java
You need to create Image and set it's value by using your array , then display the image in Jlabel
Like this :
byte[] imageInByte;////////////this byte array contain your RGB
InputStream in = new ByteArrayInputStream(imageInByte);
BufferedImage bImageFromConvert = ImageIO.read(in);
then You can display bImageFromConvert
in JLabel
Like this :
JLabel jLabel = new JLabel(new ImageIcon(bImageFromConvert ));
Related Topics
Android: How Do Bluetooth Uuids Work
Listselector Applies to the Entire List
How to Give Hexagon Shape to Imageview
Android Edittext Onchange Listener
How Does Evaluatejavascript Work
Apply Custom Filters to Camera Output
Kotlin: Whats Does "Return@" Mean
Android: Get Height of a View Before It's Drawn
Hiding Title in a Fullscreen Mode
Extract Code Country from Phone Number [Libphonenumber]
List All the Files from All the Folder in a Single List
ASP.NET Web API Authentication
How to Hide Underbar in Edittext
What's the Difference Between Setwebviewclient VS. Setwebchromeclient
How to Make a Smaller Ratingbar
How to Prevent Going Back to the Previous Activity
Android: Test Push Notification Online (Google Cloud Messaging)