i'm working on an engineering app which takes a camera live feed from a given url and updates the live feed in matlab. this is later going to be used for image processing, and with the current setup i am only able to attain a framerate of ~3 fps, where our target is more like 10+ fps.
my code is actually in matlab, but here's the jist of what i'm doing right now, and then what i want to do.
NOW:
create a new URLConnection
create a new InputStream (URLConnection.getInputStream)
open a file
create a new FileOutputStream
copy the input stream over to the output stream
close the file
close the input stream
close the connection
rinse, and repeat
im guessing that connection negotiations are significantly slowing down this whole process, so what i'd like to do is:
open a URLConnection, InputStream, FileOutputStream (allocate basically)
while(...) {
open a temp file
create associated stream
push inputstream into fileoutputstream
display temp file
refresh inputstream (input image should change each read)
}
close everything
my main problem is, i don't know how to refresh the InputStream without opening a brand new URLConnection.
sorry for my rambling haha thanks y'all