auto-crop on ROI [closed]

asked 2019-04-08 08:08:32 -0600

mrsechocha gravatar image

updated 2019-04-08 08:20:35 -0600

I am very new to using opencv in this way. I have two vouchers as seen below. I ultimately want to be able to extract only the text with numbers from the vouchers. I am able to extract the text after "manually" cropping the captured image.
voucher 1 voucher 2.

I would like to be able to automatically, crop the images such that the RIO of interest is bounded as seen below.

Voucher 1 voucher 2.

I thought I would be able to crop by color (I do not know the code but will eventually figure it out, I hope), that would however work only for the second of the two and fail for the first one as it has a lot of white spaces.

I then thought of searching for shapes (I do not know the code but will eventually figure it out, I hope), that would work work for the first voucher as it has a "gray box" around it, it will however fail for the second one as no such box exists for the second one. Any advice on how I may go around AUTOMATICALLY bounding my ROI to only the "boxed areas". I want to be able to detect the text from the ROI, which I am so far able to do, I however want to remove the need for the user to have to crop the image to designate the RIO instead do that automatically.

I am doing this on android studio.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-12-05 05:13:58.639962