JRPiCam
JRPiCam copied to clipboard
Cannot get a preview to work
I'm trying to use this as a way to add a reverse camera to a vehicle. All that I need it to do is run a preview window that stays open indefinitely and allows me to run other Java GUIs over it. I've tested your demo and it works, the camera is working and everything should be good to go. My code compiles, but when I run it, nothing happens. After a few seconds the terminal opens up to input again.
Here is what I have:
import com.hopding.jrpicam.RPiCamera;
import com.hopding.jrpicam.exceptions.FailedToRunRaspistillException;
public class RetrofitDriver {
public static void main(String[] args) {
// Instantiate the pi camera
try {
RPiCamera cam = new RPiCamera("/home/pi/retrofit");
cam.turnOnPreview(0, 0, 800, 480);
} catch (FailedToRunRaspistillException e) {
e.printStackTrace();
}
}
}
I've tried different coordinates for the preview, tried taking a still (though when I tried cam.takeStill("path/img.jpg"); it failed compiling at the first parenthesis). I have no idea why it isn't working and I can't find any examples or other documentation about how to use the preview.