Ask Your Question

pepper's profile - activity

2019-10-05 05:38:27 -0600 received badge  Famous Question (source)
2017-08-23 16:27:40 -0600 received badge  Notable Question (source)
2017-06-02 14:12:23 -0600 received badge  Popular Question (source)
2015-11-16 00:22:36 -0600 received badge  Enthusiast
2015-11-15 21:04:36 -0600 commented answer Object detection and splitting, clustering?

Hi @sturkmen, thanks for your inputs. But I find Eduardo's inputs more applicable/appropriate for my case. Thanks again!

2015-11-15 21:03:13 -0600 commented answer Object detection and splitting, clustering?

Hi @Eduardo, I'd like to thank you for your very helpful inputs (for the second image). I was able to achieved what I want by following it. It helps me a lot. Again, thank you very much!

2015-11-11 04:17:14 -0600 commented answer Object detection and splitting, clustering?

Hi @sturkmen!

I was able to try and run the code you've provided and the result is as expected. Unfortunately, when I tried use a different image, the result was not what I expected.

Because of this, I'm thinking it might have something to do with the below linke of code

src.cols * src.rows / 8

can you please explain if what is the purpose of it?

thank you!

2015-11-09 21:27:34 -0600 commented answer Object detection and splitting, clustering?

Hi @sturkmen, thanks for your answer.

I already tried implementing your solution in java, unfortunately i'm having problem with this part of the code

big = big | boundingRect(contours[i]);

can you please explain it to me what it does? Also, the Rect big variable prior to the for loop, what should be it's initial value?

Thanks again!

2015-11-09 21:23:15 -0600 commented answer Object detection and splitting, clustering?

@Eduardo, first I'd like thank you for a very detailed answer.

But since I'm a java developer, I'm wondering if having the solution implemented using c++ rather have it on java is a better approach.

Since most of the implementations that I've found related to image manipulation uses c++, could give inputs on why I should consider or stick with c++ implementation (or if c++ is better in doing this kind of stuff) vs having it on java.

Thanks in advance!

2015-11-07 14:54:42 -0600 received badge  Student (source)
2015-11-07 06:12:20 -0600 received badge  Editor (source)
2015-11-07 06:10:40 -0600 asked a question Object detection and splitting, clustering?

I'm currently working on an application that will split a scanned image (that contains multiple receipts) into individual receipt images.

Below is the sample image:

image description

I was able to detect the edges of each receipts in the scanned image using canny function. Below is the sample image with detected edges:

image description

... while my sample code is

Mat src = Highgui.imread(filename);
Mat gray = new Mat();

int threshold = 12;

Imgproc.cvtColor(src, gray, Imgproc.COLOR_BGR2GRAY);
Imgproc.blur(gray, gray, new Size(3, 3));
Imgproc.Canny(gray, gray, threshold, threshold * 3, 3, true);

List<MatOfPoint> contours = new ArrayList<>();
Mat hierarchy = new Mat();

Imgproc.findContours(gray, contours, hierarchy,
        Imgproc.RETR_CCOMP,
        Imgproc.CHAIN_APPROX_SIMPLE);

if (hierarchy.size().height > 0 && hierarchy.size().width > 0) {
    for (int idx = 0; idx >= 0; idx = (int) hierarchy.get(0, idx)[0]) {
        Rect rect = Imgproc.boundingRect(contours.get(idx));
        Core.rectangle(src, new Point(rect.x, rect.y),
                new Point(rect.x + rect.width, rect.y + rect.height),
                new Scalar(255, 0, 0));
    }
}

Now my problem is, I don't know how am I going to identify the 3rd receipt since unlike with the first 2 it is not enclosed in one rectangular shape which I will use as the basis for splitting the image.

I've heard that for me to extract the 3rd image, I must use a clustering algorithm like DBSCAN, unfortunately I can't find one.

Anyone knows how am I going to identify the 3rd image?

Thank you in advance!