// counts the number of frames since a background image is added to algorithm
private int frameCounter = 0;
-
+ private CameraSmart _camera;
/*******************************************************************************************************************************************
**
*
* @return [void] None.
*/
- public void newCameraFrameAvailable(CameraSmart _camera) {
+ public void newCameraFrameAvailable(byte[] latestFrame, long timeStamp) {
BufferedImage img = null;
try {
// Parse the byte array into a Buffered Image
- InputStream in = new ByteArrayInputStream(_camera.getLatestFrame());
+ //InputStream in = new ByteArrayInputStream(_camera.getLatestFrame());
+ InputStream in = new ByteArrayInputStream(latestFrame);
img = ImageIO.read(in);
} catch (RemoteException e) {
imageWriteLock.lock(); // lock the image and timestamp buffers since multithread
latestImage = img; // image into image buffer
- // timestamp from camera into timestamo buffer
- long dateLong = _camera.getTimestamp();
+ // timestamp from camera into timestamp buffer
+ long dateLong = timeStamp;
possibleDate = new Date(dateLong);
imageWriteLock.unlock(); // Never forget to unlock