简体   繁体   中英

Convert YBR_Full image to RGB in java

I could get the array of byte contains the YUV values and perform the same method in( Confusion on YUV NV21 conversion to RGB ) on it to get the array of int value represent RGB,and then i tried to convert this array to ByteBuffer so i can view it in JLabel. But what i can see is a separated vertical columns of Red, green, and Blue? Where is the wrong in my schema? Please help.

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 ));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM