card.io-iOS-source icon indicating copy to clipboard operation
card.io-iOS-source copied to clipboard

Card IO : Set Focus Mode for Non-payment cards

Open dgoldman-pdx opened this issue 9 years ago • 21 comments

[Issue moved here from card.io-iOS-SDK] [Issue actually created by @biksappdev]

Hi @dgoldman-ebay , I have been trying to get this going with little luck. So I tried calling the autoFocusOnce as below -

  • (void)startVideoStreamSession { [self.videoStream startSession]; [self.videoStream autofocusOnce]; // If we don't do this, then when the torch was on, and the card read failed, // it still shows as on when this view is re-displayed, even though the ending // of the session turned it off. [self updateLightButtonState]; }

Also, // if (!self.currentlyAdjustingFocus && frame.focusSucks && [self hasAutofocus]) { NSTimeInterval now = [[NSDate date] timeIntervalSince1970]; // if (now - self.lastAutoFocusOnceTime > kMinTimeIntervalForAutoFocusOnce) { self.lastAutoFocusOnceTime = now; CardIOLog(@"Auto-triggered focusing"); [self autofocusOnce]; [self performSelector:@selector(resumeContinuousAutofocusing) withObject:nil afterDelay:0.1f]; didAutoFocus = YES; // } // }

Removed the condition for triggering autoFocusOnce method while capturing a picture, however I am not able to get a clear shot every time. The library captures an image before it recognizes the corners. Kindly put me in the right direction to resolve this. I am looking forward to get the same behavior as it is for payment cards.

4701fd0c-e50f-11e4-8268-5be5b52c9e35

dgoldman-pdx avatar Apr 17 '15 22:04 dgoldman-pdx

The library captures an image before it recognizes the corners.

@biksappdev Interesting. How can you tell that this is happening?

dgoldman-pdx avatar Apr 17 '15 22:04 dgoldman-pdx

@dgoldman-ebay, The card is being captured almost immediately it is brought before the camera..it doesn;t wait to recognize the corners (as in the above picture).

biksappdev avatar Apr 17 '15 22:04 biksappdev

Thats exactly what I am trying to resolve here.

biksappdev avatar Apr 17 '15 22:04 biksappdev

@biksappdev can you try experimenting with a card that is entirely a single color near its edges?

For your card above, the boundary between the interior white section of the card and the lower green boundary is probably triggering card.io's edge detector, and so it thinks that it has indeed located all four edges of the card.

(card.io looks for the four card edges, not the corners.)

dgoldman-pdx avatar Apr 18 '15 00:04 dgoldman-pdx

See also https://github.com/card-io/card.io-iOS-source/issues/22. Maybe you two can work on this together?

dgoldman-pdx avatar Apr 18 '15 01:04 dgoldman-pdx

Hi Guys, I need your help, I used card.io library for scan credit/debit cards, its working fine. but i could not captured non-payment cards like iTunes, Dirving license cards in iOS. Where should i change/adjust the code. @dgoldman-ebay @biksappdev

vendeesh avatar May 18 '15 06:05 vendeesh

@vendeesh if you want to scan non-credit-cards with card.io, you can't right now. It's just for credit cards. Adding support for other kinds of cards is non-trivial.

card.io will, however, let you find any kind of card and grab an image of it. To do that, please start by looking at the public header files and at least trying to figure this out yourself. @dgoldman-ebay and I have limited bandwidth; the more precise a question you can ask, the better answer you will get.

josharian avatar May 18 '15 15:05 josharian

Thanks Guys. i will try to do that, and let me inform.

vendeesh avatar May 19 '15 05:05 vendeesh

@vendeesh, Did you figure out the right way to get clear and focussed images for non-payment cards using Card IO ?

biksappdev avatar Jul 27 '15 17:07 biksappdev

@dgoldman-ebay , do you have any bandwidth to assist me in working on this issue ? I am still trying to find a nice clean way to get better focussed images for non-payment cards using Card IO. Any help is greatly appreciated.

biksappdev avatar Jul 27 '15 19:07 biksappdev

@biksappdev did you try finding the place in the code where the focus score is calculated and used? That'd be a natural place to start experimenting.

josharian avatar Jul 27 '15 19:07 josharian

@josharian , I would do that, another question that I would have to ask, Is there any way to add a manual image capture button on the Card IO view( probably to this : @property(nonatomic, retain, readwrite) UIView *scanOverlayView;) ? So instead of automatic card capturing, one can snap an image when the edges are focused. Appreciate the help.

biksappdev avatar Jul 27 '15 22:07 biksappdev

Yes, that is possible, although I don't think it will be a good user experience. It's definitely not something we will add to the main repo.

To be perfectly honest, given your needs and inclinations, I'm not sure that using card.io makes that much sense. You might be better off just asking the user to take a photo and then implementing something yourself using the same overall approach as card.io (canny, hough, etc.). You're more than welcome to take any code you like from the card.io code base and adapt it to your needs, without consuming card.io wholesale, for the low low price of an acknowledgment.

In any case, card.io is intentionally focused on a single use case, and the further your needs diverge from that use case: (1) the lower the probability any changes could be contributed back, (2) the less investment the card.io maintainers will make in your desired code changes, (3) the less helpful card.io as it stands will be for you, and (4) the more card.io will be dead weight and binary bloat.

josharian avatar Jul 27 '15 22:07 josharian

@josharian , I am not facing any issues with Payment cards scanning, its just focussing issues while scanning other cards ( like Gift Cards, DL, Shopping cards etc.). So only need to find a way to adjust the focus better and be able to detect the edges cleanly just like it does for payment cards.

biksappdev avatar Jul 27 '15 22:07 biksappdev

@josharian I am also looking to use card.io for more than one reason, 1. to scan a payment card and another to use it get edge detection on Government ID cards. I have some code that uses (Canny and HoughlinesP) currently built to run at Rails server and might need MUCH more optimization to faithfully work on most cases. I was trying to build it as a static image scan but our requirement might take a turn to run it on previews and I want to use card.io if possible. Is it possible to find the code that can help me with edge detection atleast. I don't know if full code is available to peek into or not. I am fairly new to look at card.io SDK.

ashugit avatar Jul 30 '15 11:07 ashugit

The card edge detection and image capture (your second use case) is already an option actually. See the detectionMode property on CardIOViewController. On Thu, Jul 30, 2015 at 4:47 AM Sudhanshu Saxena [email protected] wrote:

@josharian https://github.com/josharian I am also looking to use card.io for more than one reason, 1. to scan a payment card and another to use it get edge detection on Government ID cards. I have some code that uses (Canny and HoughlinesP) currently built to run at Rails server and might need MUCH more optimization to faithfully work on most cases. I was trying to build it as a static image scan but our requirement might take a turn to run it on previews and I want to use card.io if possible. Is it possible to find the code that can help me with edge detection atleast. I don't know if full code is available to peek into or not. I am fairly new to look at card.io SDK.

— Reply to this email directly or view it on GitHub https://github.com/card-io/card.io-iOS-source/issues/21#issuecomment-126286107 .

burnto avatar Jul 30 '15 15:07 burnto

@burnto Thanks a lot, I will start with that. I guess it should work because edge detection I saw is independent of card details. I will update here if I get it working. Thanks again.

ashugit avatar Jul 31 '15 07:07 ashugit

@burnto I see one issue which I believe is also related to focus, when I try to run my feature detector camera captured image it works way better with tesseract OCR.

ashugit avatar Aug 05 '15 06:08 ashugit

@biksappdev I have same question, do you resolve the question?!~

coooliang avatar Aug 20 '15 02:08 coooliang

Is there anyone can use the card.io library for scan Non-payment cards?

yangmiok avatar Nov 28 '15 01:11 yangmiok

@mengmanzbh 你实现了使用card.io library 识别储蓄卡没?求指教

jagtu avatar Feb 21 '17 01:02 jagtu