List
Recognizing image with different color
Posted Date: 2018-12-06 11:17     Edited Date: 2018-12-17 1:05     Writer: inactive

We are using MAXST for image recognition in android app, where our app will recognize the color and pattern of LEDs and render appropriate instructions on camera screen. Currently MAXST is not able to differentiate target image as per color.

What can be done to identify target objects/images according to color? 

(I'm using MAXST sdk 4.0.1 in my android project)

Posted Date: 2018-12-06 23:37     Edited Date: 2018-12-06 23:38     Writer: kscho

Hello.

Thanks for your interest in MAXST SDK.

Unfortunately, the image tracker is not able to distinguish between different colors becuase it uses only intensity of pixels in recognition.

If you want to identify color, you'd better use your own color detection algorithm.

The format of android camera image is YUV format, where Y means intensity and U and V includes color information, so you can define a UV boundary of each color which you want to recognize.

In summary, you can detect your pattern using our image tracker and define and recognize your color in UV channels of camera image which you can get the image via TrackedResult.

Thanks.

 

John,

MAXST Support Team

 

 

Posted Date: 2018-12-10 6:52     Edited Date: 2018-12-10 6:52     Writer: inactive

Hey, thank you for the response. I'll explore about YUV format and color detection algorithms.

Also wanted to know, can I send processed image to MAXST? For eg. when camera is focused on some target, I'll calculate it's HSV image and that HSV image will be sent to MAXST for further detection and rendering. Can we do that?

Posted Date: 2018-12-10 7:24     Edited Date: 2018-12-10 7:24     Writer: kscho

Hello.

Our image tracker can get an external image such as RGB and YUV, not HSV via SetNewFrame API,

but the API is activated only to enterprise customers.

I'd like to recommend to use the image of TrackedResult as a result of our image tracker.

You can get a YUV image via the following codes. 

TrackingState state = TrackerManager.getInstance().updateTrackingState();
TrackingResult trackingResult = state.getTrackingResult();
TrackedImage image = state.getImage();

After that, I hope that you handle the YUV format directly to process color or convert YUV to HSV.

Thanks.

 

John,

MAXST Support Team

Posted Date: 2018-12-12 7:37     Edited Date: 2018-12-12 7:37     Writer: inactive

Hello,

I've managed to extract UV data array from image in byte[] format, but the size of this byte array is around 100000+ . Processing such huge amount of data everytime onDrawFrame is called, is not feasible. Is there any other alternative to process this data? Also I'm not able to figure out how to proceed with this data for color detection.

uvArray holds U and V component data.

byte[] data = image.getData();
int inputYLength = image.getWidth() * image.getHeight();
int inputUVLength = image.getWidth() * image.getHeight() / 2;
ByteBuffer uvBuffer = ByteBuffer.allocateDirect(inputUVLength);
uvBuffer.put(image.getData(), inputYLength, inputUVLength);
uvBuffer.position(0);
byte[] uvArray = uvBuffer.array();
Posted Date: 2018-12-12 10:45     Edited Date: 2018-12-12 10:50     Writer: kscho

 

I think that you don't need to process YUV image every frame.

Do you process the image only when the image tracker recognizes the target ?

We hardly help you handle YUV image to analyze color information because it exceeds our support range.

Briefly speaking, you already need to set UV range of your target and analyze UV data when the image tracker recognizes the target, that means you need to decide whether the UV pixels belong to your target is included in the UV range.

Thanks.

 

John,

MAXST Support Team

 

 

Posted Date: 2018-12-12 13:56     Edited Date: 2018-12-12 13:56     Writer: inactive

Yes I'm processing the image once the trackable.getName() is matched with my image name. But processing this much data frame by frame is taking too much time. May be I should write some native method.

Posted Date: 2018-12-17 1:05     Edited Date: 2018-12-17 1:05     Writer: kscho

Yes, I agree to process an image using android native. It would be helpful for speed-up.

 

John,

MAXST Support Team