I am trying to decode raw rgb data from raspistill STDOUT by java language, I encountered the same issue that images are dislocated, see my snapshot(camera is shooting at my roof in static, picture should be same as test0.png) ,
- PI 3B
raspivid Camera App v1.3.12
camera rev 1.3 hardware
since rgb output bytes are byte[width*height*3], so I read though the stream one by one as,
Code: Select all
raspivid --width 320 --height 240 --flush --framerate 10 --timeout 0 --segment 1024 --nopreview --raw-format rgb --raw - --output /dev/null
Code: Select all
while (stream not close) {
byte[] bytes = new byte[width * height * 3];
in.read(bytes);//read from InputStream
...
//then decode to java BufferedImage
...
}
You can see, images are first correct then dislocated some frames, then back to correct, again and again. mean while, the frames is more then expected. for 5 seconds of running, there should be 5*10fps=50 images, but there are much more in byte length. I inserted some code around converting images to mock fps, it is almost up to 50, that means I decoded 50 images per seconds.
what is in raw rgb content, anyone can help me on this? really appreciate