How to tell whether it’s a document or an image

Dynamsoft Camera SDK iOS Edition has two capture modes: image mode and document mode.

Under document mode, document boundary detection function is enabled. You can capture the detected document with a simple click. While under image mode, you will capture the whole image. After capture, you may need to know whether it's a document or an image.

id imgObj = [dcsView.buffer get:0];
if ([imgObj isMemberOfClass:[DcsImage class]]) {
    NSLog(@"imgObj is a DcsImage object.");
} else if ([imgObj isMemberOfClass:[DcsDocument class]]) {
    NSLog(@"imgObj is a DcsDocument object.");

var imgObj = dcsView.buffer.get(0)
        if imgObj is DcsImage {
            print("imgObj is a DcsImage object.")
        } else if imgObj is DcsDocument {
            print("imgObj is a DcsDocument object.")

Is this page helpful?

Leave a Reply

Your email address will not be published.