Home > Back-end >  Turn on BufferImage byte array
Turn on BufferImage byte array

Time:09-16

Bosses think excuse me, is there any way turn bufferimage byte don't walk IO stream, it is now our business of video streaming real-time image analysis, to capture, video image size is 1920 * 1080, then bufferimge object into a byte array to the python there is analyzed, and then through their interface returns, but turn bufferimage byte go IO flow takes up to about 100 ms, is there any faster way, or is there any framework technology can be introduced, on the Internet to find for a long time did not find relevant, is it possible that this time can be reduced to about 20 ms ~! Want to do 1 second can handle at least 20 frame diagram,

CodePudding user response:

BufferImage? Which package of

CodePudding user response:

Public static byte [] imageToBytes (BufferedImage bImage, String format) {
ByteArrayOutputStream out=new ByteArrayOutputStream ();
Try {
ImageIO. Write (bImage, format, out);
} the catch (IOException e) {
e.printStackTrace();
}
Return out. ToByteArray ();
}

CodePudding user response:

Such calculating do not calculate?
 BufferedImage image=your_ bufferimage; 
ByteArrayOutputStream out=new ByteArrayOutputStream ();
ImageIO. Write (image, "GIF", out);
Byte [] data=(https://bbs.csdn.net/topics/out.toByteArray);

CodePudding user response:

Consider using multithreading, and how do you read around but IO, just personal feel slow may lie in transmission, rather than read IO on the picture

CodePudding user response:

reference 1st floor tianfang response:
BufferImage? Which package
is the code below ~

CodePudding user response:

reference qybao reply: 3/f
this count?
 BufferedImage image=your_ bufferimage; 
ByteArrayOutputStream out=new ByteArrayOutputStream ();
ImageIO. Write (image, "GIF", out);
Byte [] data=(https://bbs.csdn.net/topics/out.toByteArray);
it is the step that ImageIo. Wirte here writing flow to deal with 1920 * 1080 images with more than 100 ms, feel good
  • Related