3

I'm just at the start of looking at ARToolkit on Android and the examples I've seen are dependent upon identifying the marker within a video stream from the device camera.

Are there any examples where an image (e.g. a normal JPG file containing a 2D barcode marker) can be used instead? Or are there ways to pause a video stream or grab a single frame when a marker is in view?

I realise this might sound odd, but I'm interested in a particular use case.

David
  • 31
  • 3
  • The ARToolkit is rather dated and wanted to refer you to www.metaio.com. However they seem to not be currently open for new subscriptions... But to answer your question (I think) the ARToolkit cares not whether the bar is printed on paper, displayed on a screen or as part of a video, as long as it is able to recognize a known pattern. The greatest difficulty lies in the effect of lightning conditions. If in a remotely dark area, the app will have trouble identifying the marker. – cYrixmorten Oct 30 '15 at 00:34

3 Answers3

3

On all platforms except Android you can use the "image" video input module. This is an alternative video capture module which just loops through one or more JPEG images. You request this video module by changing the video configuration string to something like:

-device=Image -image="/path/to/image0.jpeg" -image="/path/to/image1.jpeg"

On Android, one possible alternative if you're building a Java ARToolKit for Android app is to load the image yourself in the Java environment and to push that image to the native tracking routines instead of pushing the image from the camera stream. The simplest place to intercept the pushing of the image is in ARBaseLib/src/org/artoolkit/ar/base/ARToolKit.java's convertAndDetect() method. The 'frame' parameter to arwAcceptVideoImage is a pointer to an NV12-encoded video frame.

If you're using ARToolKit for Unity on Android, the same advice applies, only the location of the arwAcceptVideoImage call is different. Instead it's in the UnityARPlayer classes in file org/artoolkit/ar/unity/CameraSurface in method onPreviewFrame.

Sorry I can't advise of an easier method... ARToolKit for Android isn't really structured for much flexibility in the source of the video stream.

bleater
  • 5,098
  • 50
  • 48
1

Yes, I have done it.

If you will see the flow of it, a camera frame is grabbed as an byte array and that array is sent to renderer class,which appears as background image, and marker detection part which detects marker and generates transformation matrix.

So, what you can do is read an image as bitmap and change it to same format array(as the grabbed frame) and input this array for both rendering and detection part.

If you want to pause the video at one frame, you can just copy that instance of input image array and then continuously feed only that array to both rendering and detection part.

0

or intercept the cameraPreviewFrame(final byte[] data) and load the data array with your bitmap in the correct format.

oliver
  • 1