Ask Your Question
0

Image processing up to 50€ as reward

asked 2015-12-22 17:33:36 -0500

Geaper gravatar image

I know this is OpenCV but you can tell me in C++ and i figure it out in C#.

I am willing to pay around 50€ via Paypal if you help me in the inicial code to make a project. I am new in EMGU and it's very hard for me to start.

Squares: https://gyazo.com/f48b1a95aafedde2704...

I need to process squares like this images and determine which one is which (maybe comparing to a known database or if square has color blue,yellow,red than it's square 1).

I am already trying to solve this problem.

This s my Application: https://gyazo.com/5e22e9a489d42266f55...

[code]

frame11.SmoothMedian(3); //Filtro mediana antes da passagem para HSV

frame11_processado_hsv = frame11.Convert<hsv, byte="">(); //Converte a imagem da camera RGB para HSV

frame11_processado = frame11_processado_hsv.InRange(new Hsv(hl.Value, sl.Value, vl.Value), new Hsv(hh.Value, sh.Value, vh.Value)); //utiliza as trackbars HSV para ver a cor pretendida

frame11_processado.SmoothGaussian(11); //Filtro gaussiano na imagem binaria

            #region Extracting the Contours
            using (MemStorage storage = new MemStorage()) //aloca espaço na memoria
            {

                for (Contour<Point> contours = frame11_processado.FindContours(Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE, Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_LIST, storage); contours != null; contours = contours.HNext)
                {

                    Contour<Point> currentContour = contours.ApproxPoly(contours.Perimeter * 0.015, storage);

                    if (currentContour.Area > area_contornos.Value)
                    {
                        if (currentContour.Total == 4)
                        {                        

                            CvInvoke.cvDrawContours(frame11, contours, new MCvScalar(255), new MCvScalar(255), -1, 3, Emgu.CV.CvEnum.LINE_TYPE.EIGHT_CONNECTED, new Point(0, 0));                               
                           frame11.Draw(currentContour.BoundingRectangle, new Bgr(0, 0, 255), 3);

                            Point[] pontos = currentContour.ToArray();
                            foreach (Point p in pontos)
                            {
                                listbox_contornos.Items.Add(p);
                            }
                        }
                    }

                }

            }
            #endregion[/code]

But if you look the image is very noisy. I will never be able to detect only the squares like this. Maybe I need to improve code? Maybe I need to change the Squares (I can make like bigger outlines or something?Can you share ideas to solve this problem? Like i said i am willing to donate via pyapal (or something else) if you help me. Consider it as a Xmas gift ^^

edit retag flag offensive close merge delete

Comments

1

Try hsv color space (and it's free!)

LBerger gravatar imageLBerger ( 2015-12-23 01:57:50 -0500 )edit
1

first of all you need to set some requirements into which your application would work, it is not easy to make an application that it will work under every condition. For example in the first image things are much easier to be solved compared to the second due to the size of the squares, the sharpness of the image, etc... Therefore, you need to specify for example under which distance you would like your app to work, what kind of camera are you using, calibration of the camera(in your second image you have a quite heavy distortion) and other.

theodore gravatar imagetheodore ( 2015-12-23 02:45:19 -0500 )edit

Anyway, in addition to what @LBerger suggested check the official squares.cpp example for detecting squares plus another approach here. I hope it helps and it's free as well :-)!

theodore gravatar imagetheodore ( 2015-12-23 02:46:23 -0500 )edit

It's a 1280x720 camera. I am using 680x360 images. Maybe i am losing quality there? I will use it always 1.5-2 meters from the squares.

Maybe I need to do improvements on the squares? Like bigger outlines? Should i remove the outline between each color (if you look closely it's separating each color into a new square) or make it bigger? I need at least 4 squares in the camera view.

Geaper gravatar imageGeaper ( 2015-12-23 09:27:02 -0500 )edit

Which ones are the easiest colors to detect? I think red and purple are the hardest. Maybe 255 green 255 blue and which ones more?

Geaper gravatar imageGeaper ( 2015-12-23 09:28:46 -0500 )edit

Like i said i am willing to give some money/games as a reward. it's not much but it's a thank you for helping me.

Geaper gravatar imageGeaper ( 2015-12-23 09:30:41 -0500 )edit

@Geaper upload some more images from use cases that you want your app to process. Me or someone else might find some time to try something and help you :-).

theodore gravatar imagetheodore ( 2015-12-23 11:01:19 -0500 )edit

Image

I want to use the drone webcam to look at the squares on the ground and use it as a spacial location. I already have everything on the drone working. I just need to detect very well each square to determine each square to a coordinate in space.

Geaper gravatar imageGeaper ( 2015-12-23 11:08:19 -0500 )edit

If you look closely each square have 2-3 colors. If i am able to determine how many colors or which color combination a square has I am able to use it as a x,y coordinate in space.

Geaper gravatar imageGeaper ( 2015-12-23 11:10:08 -0500 )edit

@Geaper the image that you have uploaded above is not useful at all. What I was meaning was an actual image of what the drone sees.

theodore gravatar imagetheodore ( 2015-12-27 08:39:35 -0500 )edit

2 answers

Sort by » oldest newest most voted
0

answered 2015-12-28 13:59:09 -0500

arman gravatar image

updated 2015-12-29 07:11:39 -0500

With Emgu + C# + windows forms?

Use for centroids: moments = CvInvoke.Moments(image, false); Centroid = new Point((int)(moments.M10 / moments.M00), (int)(moments.M01 / moments.M00));

and for colour, hsv method.

I test it, see: https://www.youtube.com/watch?v=Yk3wq...

edit flag offensive delete link more

Comments

Does anyone have any idea which are the easiest colors to detect from HSV?

Geaper gravatar imageGeaper ( 2015-12-28 14:40:34 -0500 )edit

Thank you Alexander. Can you share your project? Thanks ;)

Geaper gravatar imageGeaper ( 2015-12-28 14:42:13 -0500 )edit

always, primary colors: RED, GREEN, BLUE, others here: https://en.wikipedia.org/wiki/Templat.... Remember HSV (Hue, Saturation, Value ), This is a nonlinear transformation of the RGB color space, and can be used in color progressions. [cylindrical-coordinate representations].

arman gravatar imagearman ( 2015-12-28 16:24:06 -0500 )edit

code for color detection here: http://www.emgu.com/forum/viewtopic.p...

arman gravatar imagearman ( 2015-12-29 07:00:07 -0500 )edit
0

answered 2015-12-27 09:04:17 -0500

theodore gravatar image

updated 2015-12-27 10:34:48 -0500

@Geaper from your information that you have given what I would try to do is the following:

  1. Calibrate and udistort the drone camera (optional, but recommended)
  2. try to detect the squares on the undistorted image, by using the method applied in the official squares.cpp example (check here and here as well for some customizations) or just a simple findcontours() approach which you can combine it with a colour segmentation approach see next step
  3. or you can go straight forward for a color segmentation approach based on hardcored colour segmentation on the HSV/YUV colour space or by using more advanced colour(and not only) identification and segmentation techniques like k-means clustering [1], [2], graphcut, etc... I am sure there are more approaches if you search for colour classification, segmentation, etc...
  4. having applied the above I guess you will get all the info you want

Unfortunately, I am quite busy this period and I cannot spend that much time but as I said try give some good pictures and maybe someone or me at the end is willing to try something.

edit flag offensive delete link more

Comments

Thanks. Can you just tell me if I need to mmakes changes on the squares? Should I remove the black line between each color and make the outer line thicker?

Geaper gravatar imageGeaper ( 2015-12-28 05:57:01 -0500 )edit

Do you have paypal account?

Geaper gravatar imageGeaper ( 2015-12-28 05:57:25 -0500 )edit

@Geaper I do not think that making changes on the squares would have any big impact. I think that it will work both with and without the black lines, but you can try different things. In the beginning I would start without any black lines neither inner nor outer ones, since only the discrimination between colours is enough I think.

theodore gravatar imagetheodore ( 2015-12-28 09:11:32 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-12-22 17:30:38 -0500

Seen: 443 times

Last updated: Dec 29 '15