Log in or register to post comments

When to setFrameFormat

October 3, 2017 - 2:57pm #1

I'm trying to use Vuforia's tracking capabilities, while also inspecting images manually for further processing. However, all the images that come out of Vuforia's image queue are grayscale. It seems like Vuforia.setFrameFormat should allow me to ask Vuforia to deliver color images too, but it always fails.

I suspect that is because I'm calling it at the wrong time. If my sequence of events looks something like:

 

this.vuforia = ClassFactory.createVuforiaLocalizer(parameters);

        VuforiaTrackables trackables = this.vuforia.loadTrackablesFromAsset("...");

        VuforiaTrackable trackable = trackables.get(0);

        vuforia.setFrameQueueCapacity(100);

        waitForStart();

        trackables.activate();

        while(true) {

            BlockingQueue<VuforiaLocalizer.CloseableFrame> frameQueue = vuforia.getFrameQueue();

            VuforiaLocalizer.CloseableFrame frame = null;

            while ((frame = frameQueue.poll()) != null) {

                for (int i = 0; i < frame.getNumImages(); i++) {

                    Image img = frame.getImage(i);

                    if (img.getFormat() != PIXEL_FORMAT.GRAYSCALE) {

                        nGrayscale++;

                    } else {

                        nNotGrayscale++;

                }

                LOG("Grayscale count", nGrayscale);  // Grows

                LOG("Non-grayscale count", nNotGrayscale); // Stays at 0

                frame.close();

            }

}

 

then where in the process should I set the frame format?

 

Any help is much appreciated!

When to setFrameFormat

October 4, 2017 - 4:45pm #2

Hmm, apparently calling setFrameFormat after

this.vuforia = ClassFactory.createVuforiaLocalizer(parameters);

works.

Log in or register to post comments