Ask Your Question

Goosebumps's profile - activity

2018-08-10 01:54:04 -0600 received badge  Famous Question (source)
2017-08-11 00:37:13 -0600 received badge  Nice Answer (source)
2016-10-09 11:48:52 -0600 received badge  Notable Question (source)
2016-09-30 12:06:44 -0600 received badge  Nice Answer (source)
2016-01-03 15:54:52 -0600 received badge  Popular Question (source)
2015-12-27 13:36:06 -0600 received badge  Nice Answer (source)
2015-01-21 01:59:55 -0600 received badge  Enthusiast
2015-01-19 06:22:46 -0600 asked a question Chessboard pose in robot and camera world

I have a robot holding a chessboard in front of a camera. In know the chessboard's position in the robot world. If I do pose detection of this chessboard I also now it's position in the camera world. Both cooridnates together define the relation between camera world and robot world. This all works okay, but of course, there are some tolerances.

My question is related to the detection of the chessboard pose with the camera. What is the best way to position the chessboard in view of the camera:

  1. Perpendicular
  2. Rotated around 1,2 or three axes of the camera world
  3. Other.

Which will give the most reliable results?

2014-12-08 09:59:09 -0600 answered a question Skittles counter and classifier

Have a look at watershed segmentation in combination with distance transform. There are many examples on the interwebz. Here is one in OpenCV and python: watershed

Most common steps: - Use automatic global thresholding such as Otsu - Erode this, distance transform and threshold it to get sure foreground - Dilate it to get sure background - Do watershed segmentation using the sure fore- and background

2014-10-28 06:52:23 -0600 commented answer Detecting an incoming bus in opencv?

Because it is possibly easier than detecting the specific vehicle itself. This is not the same as detecting a bus. He wants to detect three specific busses, I presume, not the busses that happen to look like those three. The one thing that identifies a bus is its licence plate. Think about it, it is really not such a strange suggestion.

2014-10-23 06:41:22 -0600 answered a question Detecting an incoming bus in opencv?

How about this: 1. Find rectangles that have an aspect ratio roughly that of a licence plate. 2. Do OCR on the licence plate 3. Decide of the licence plate is one of those 3 busses

PS Flashing with IR helps a great deal with licence plates if you remove/leave out the IR filter of your camera

2014-07-08 09:09:54 -0600 answered a question extracting an object from various object in background

It reminds me of this tutorial on watershed: marker-controlled-watershed-segmentation It uses morphological reconstruction though, which is not standard available in OpenCV. The following thread may be useful for this: morphological-reconstruction

2014-07-03 02:59:20 -0600 commented answer Morphological reconstruction

Yes, but it is ever so much fun ;) BTW this is Emgu

2014-07-03 02:58:20 -0600 received badge  Scholar (source)
2014-07-02 10:58:05 -0600 received badge  Self-Learner (source)
2014-07-02 10:14:37 -0600 answered a question Morphological reconstruction

If found that the morphological reconstructions are not that hard to implement if you read the following document: Morphological Image Processing

This one is also nice because it has some example images of what to expect Morphology

The clue is that the reconstructions' main ingredients are geodesic erosion and dilation. These are basically masked erosion and dilation by using a min operator. Code snippet:

Image<Gray, byte> m = image.Dilate(size, shape); // normal dilation
Image<Gray, byte> geoDilate = m.Min(mask); // masking operation

Same for erosion but using a max operator. Now dilation by reconstruction is keep on geodesically dilating until the image doesn't change anymore.

Image<Gray, byte> m0;
Image<Gray, byte> m1 = image;
do
{
    m0 = m1.Clone();
    m1 = m0.GeoDilate(mask, size, shape);
} 
while (!m1.Equals(m0));
Image<Gray, byte> DilateRec = m1;

Finally, opening by reconstruction is first erode the image. The eroded image is then dilated with the original image as mask:

Image<Gray, byte> m = image.Erode(size, shape);
Image<Gray, byte> openRec = m.DilateRec(image, size, shape);

Closing by reconstruction is the other way around.

2014-06-19 07:57:43 -0600 commented answer Morphological reconstruction

Nice links. This library seems to be capable of doing the reconstruction. However, I was hoping to stay within Emgu (C# opencv).

2014-06-19 07:54:48 -0600 commented question Morphological reconstruction

Yes, that is the operation I was looking for.

2014-06-18 02:29:39 -0600 received badge  Student (source)
2014-06-18 01:26:36 -0600 asked a question Morphological reconstruction

Does anybody know how to do morphological reconstruction using OpenCV (or emgu). Of course I can find the algorithm and implement it from scratch, but I was hoping this is not neccessary.

Some background. In matlab there is the imreconstruct operation. See: matlab imreconstruct example

It can do the following. The source image:

image description

Eroding it gives

image description

Reconstruction yields those characters that left something after erosion

image description

Credits for the images go to Steve Eddins (as in the link above)

2014-06-17 07:45:47 -0600 answered a question Split connected blobs

Try watershed: watershed example

2014-06-02 08:50:05 -0600 commented question Ideas to process challenging image

Would be nice if you would post some feedback on your progress

2014-05-23 08:51:44 -0600 answered a question Eliminating small blobs leaving bigger ones intact

You state that you do not want to use morphological operations. I am assuming this is to keep the original shape identical. If so, you could still consider using opening by reconstruction. Have a look over here: opening-by-reconstruction

I don't know how to do it in OpenCV though. Anyone?

2014-05-20 03:23:06 -0600 answered a question Ideas to process challenging image

A morphological operation that could work is opening: image description

        int morphOpSize = 3;
        StructuringElementEx element =
            new StructuringElementEx(
                morphOpSize,
                morphOpSize,
                morphOpSize / 2,
                morphOpSize / 2,
                Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_ELLIPSE);

        filtered = gray.MorphologyEx(
            element,
            Emgu.CV.CvEnum.CV_MORPH_OP.CV_MOP_OPEN,
            2);

(sorry for my Emgu dialect)

Otherwise look for edge preserving low pass filtering.

2014-05-09 00:24:25 -0600 received badge  Citizen Patrol (source)
2014-03-26 02:19:22 -0600 commented question Best method for multiple particle tracking with noise and possible overlap?

If you pick up a lot of noise, maybe you could have a look at blob tracking augmented with kalman filtering.

2014-03-24 11:13:26 -0600 commented question Best method for multiple particle tracking with noise and possible overlap?

Any luck yet? I'm curious how you solve this.

2014-03-18 02:08:06 -0600 answered a question Best method for multiple particle tracking with noise and possible overlap?

You may want to start using a top hat operation. That will make you get rid of the blurry non black background.

Second step would be binarization. I used a simple threshold, but there is still some work to be done here. Perhaps watershed could help you.

Then you may want to use findContours and do away with blobs that are more then e.g. 1.5 times as high as they are wide.

static void Main(string[] args)
{
    Image<Bgr, byte> bgr = new Image<Bgr, byte>(@"k:\tomgoo\im.png");
    Image<Gray, byte> gray = bgr.Convert<Gray, byte>();

    // Perform top-hat
    int morphOpSize = 5;
    StructuringElementEx element =
        new StructuringElementEx(
            morphOpSize,
            morphOpSize,
            morphOpSize / 2,
            morphOpSize / 2,
            Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_ELLIPSE);

    Image<Gray, byte> filtered;
    filtered = gray.MorphologyEx(
        element,
        Emgu.CV.CvEnum.CV_MORPH_OP.CV_MOP_TOPHAT,
        1);

    // binarize image
    double thresh = CvInvoke.cvThreshold(
                    filtered,
                    filtered,
                    100,
                    255,
                    THRESH.CV_THRESH_BINARY);

    // find and filter out blobs
    Contour<Point> contours = filtered.FindContours(
        CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE,
        RETR_TYPE.CV_RETR_CCOMP);

    Contour<Point> cont = contours;
    while (cont != null)
    {
        // Remember the next contour for later and isolate the current one
        Contour<Point> next = cont.HNext;
        cont.HNext = null;

        MCvBox2D minAreaRect = cont.GetMinAreaRect();
        if (minAreaRect.size.Height < 1.5 * minAreaRect.size.Width)
        {
            // Generate random color
            CvInvoke.cvDrawContours(
                bgr,
                cont,
                new MCvScalar(255, 0, 0),
                new MCvScalar(255, 0, 0),
                2,
                2,
                LINE_TYPE.EIGHT_CONNECTED,
                new Point(0, 0));
        }

        // Now go to the next contour
        cont = next;
    }
    bgr.Save(@"c:\out.png");
}

(Sorry for my emgu dialect.) You will get this result: image description and image description

2014-02-13 06:07:48 -0600 commented answer How to detect scratches in wood

Any luck so far?

2014-02-07 08:36:03 -0600 commented question Grass blades, bad contours recognition, separation, detectobjects

I don't know if it will do you any good. But I think what you are looking for is related to the Gestalt principle of Good Continuation. See http://en.wikipedia.org/wiki/Principles_of_grouping#Good_Continuation

2014-01-31 01:32:27 -0600 commented answer How to detect scratches in wood

Looks like convolution with a square kernel or 2D moving average filtering if you want some google keywords. This is a low pass filtering technique. Since the kernel is square it will act differently depending on the orientation of your scratch. You might also consider a circular or gaussian kernel if this is your way to go (personally, I do not think so).

2014-01-28 02:17:49 -0600 answered a question How to detect scratches in wood

You could use what I call an oriented high-pass filter (don't know the official name). I pasted the code below. It is in Emgu though (.Net wrapper for OpenCV). The basic idea is that you take a high pass filter kernel like:

k = [-1 -1 4 -1 -1
     -1 -1 4 -1 -1
     -1 -1 4 -1 -1
     -1 -1 4 -1 -1
     -1 -1 4 -1 -1
     -1 -1 4 -1 -1
     -1 -1 4 -1 -1
     -1 -1 4 -1 -1]

and convolve it with the image. Then rotate the kernel by N degrees (e.g. 15) and convolve it again. You do this up to 180 degrees and take the max of all the convoluted images. Scratches will have a high response to this kernel when aligned with the rotated filter. Your grains will too though. But you could experiment with leaving out the direction of the grains... BTW, smoothing the image beforehand gave me better results.

private Image<Gray, float> OrientedHighPass(Image<Gray, byte> image)
{
Image<Gray, float> filtered = new Image<Gray, float>(image.Size);
Image<Gray, float> final = new Image<Gray, float>(image.Size);

// import parameters
int smoothOpSize = 5;
int filterLength = 16;
int angleStep = 15;

// construct the kernel
float[,,] k3 = new float[1, 5, 1]
{
    { { -1 }, { -1 }, { 4 }, { -1 }, { -1 } },
};
Image<Gray, float> kRow = new Image<Gray, float>(k3);
Image<Gray, float> kImageOriginal = kRow;
for (int l = 0; l < filterLength - 1; ++l)
    kImageOriginal = kImageOriginal.ConcateVertical(kRow);

// first step, smooth image
image._SmoothGaussian(smoothOpSize);

for (int angle = 0; angle < 180; angle += angleStep)
{ 
    // Create convolution kernel
    Image<Gray, float> kImage = kImageOriginal.Rotate(angle, new Gray(0), false);
            // make sure the average of the kernel stays zero
    kImage = kImage - (kImage.GetSum().Intensity / (kImage.Width * kImage.Height));

    float[,] k = new float[kImage.Height, kImage.Width];
    Buffer.BlockCopy(kImage.Data, 0, k, 0, k.Length * sizeof(float));
    ConvolutionKernelF kernel = new ConvolutionKernelF(k);

    filtered = image.Convolution(kernel);

    final = filtered.Max(final);
}

return final;
}
2014-01-25 06:02:30 -0600 received badge  Teacher (source)
2014-01-24 09:35:59 -0600 received badge  Editor (source)
2014-01-24 09:35:24 -0600 answered a question Accessing pixels along a circle

If you want to read out the meter using computer vision you might also consider transforming the image to a polar plot using logpolar.

This might make measuring easier:

image description

Or if it is just the dots, you might even draw them here and transform back to cartesian. Your dots will be slightly deformed though.