Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. needing help in algorithm

needing help in algorithm

Scheduled Pinned Locked Moved C / C++ / MFC
algorithmshelp
20 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T toxcct

    if it is a bmp, then i think you could go though each pixel and test the pixel around like this (i'm not an expert of image computing, so i could be wrong) :

    for each vertical line -> 'y' coordinate
    for each pixel in the line -> 'x' coordinate
    if pixel color is red then
    if pixel directly on top is red and
    pixel directly at left is red and
    pixel directly at right is red and
    pixed directly at bottom is red then
    you found the plus symbol, which coordinates are (x; y)
    end if
    end if
    end for
    end for


    TOXCCT >>> GEII power

    [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

    V Offline
    V Offline
    V_shr
    wrote on last edited by
    #5

    I know this way but it is a lot of noise in image and the plus isn't like this : ------------o-------- -----------ooo------- ------------o-------- it is like this : -----------------------o----------- -----------------------o----------- -----------------------o----------- ---------------o o o o O --- o o o o ---------------------o------------ ----------------------o----------- ----------------------o----------- ----------------------o----------- and the most important is that it may rotate . and i dont want to rotate it in a ( for ) I want it to be a speedy algorithm . and i also want to use the long tail of plus , I mean it isn't one pixel . thanks -- modified at 10:19 Thursday 11th May, 2006

    T B R 3 Replies Last reply
    0
    • V V_shr

      I know this way but it is a lot of noise in image and the plus isn't like this : ------------o-------- -----------ooo------- ------------o-------- it is like this : -----------------------o----------- -----------------------o----------- -----------------------o----------- ---------------o o o o O --- o o o o ---------------------o------------ ----------------------o----------- ----------------------o----------- ----------------------o----------- and the most important is that it may rotate . and i dont want to rotate it in a ( for ) I want it to be a speedy algorithm . and i also want to use the long tail of plus , I mean it isn't one pixel . thanks -- modified at 10:19 Thursday 11th May, 2006

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #6

      edit your post and use the <pre></pre> tags to preserve spaces...


      TOXCCT >>> GEII power

      [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

      1 Reply Last reply
      0
      • V V_shr

        hello I have a image , and a red plus is in it , and Iwant to find it's X and Y. and I want a algorithm . thanks a lot

        B Offline
        B Offline
        Bob Flynn
        wrote on last edited by
        #7

        I want, I want, I want. Since this site is not about doing the job for you, but helping you with problems, I will point you in a good direction and wait to see what effort you make. Search code project for the following types of article image processing and pattern recognition Some thoughts to consider are: 1) Are you looking for a specific size red plus or any two crossing lines of any thinkness and any length? It becomes easier if you know the exact size, thinkness of lines and orientation of the "plus" 2) How is the "plus" put on the image. Can it be partly off your image? For a first cut approach, assuming you know the exact color red (or even the range of colors), try searching through each pixel in your image until you find a red one. Then you need to see if the shape of your plus is in the appropriate adjoining pixels (this is a series of checks over a specific set of offsets from your "found" red pixel. If you get a match, then you have to check some more to make sure that you are not in a field of red. If your "plus" can be partly off the edge, you will have to compute the remaining portions of the plus and use the approach above with a modified definition of a "plus" This is brute force. There are probably better ways to do this. But this will get you started. Good luck.

        1 Reply Last reply
        0
        • V V_shr

          I know this way but it is a lot of noise in image and the plus isn't like this : ------------o-------- -----------ooo------- ------------o-------- it is like this : -----------------------o----------- -----------------------o----------- -----------------------o----------- ---------------o o o o O --- o o o o ---------------------o------------ ----------------------o----------- ----------------------o----------- ----------------------o----------- and the most important is that it may rotate . and i dont want to rotate it in a ( for ) I want it to be a speedy algorithm . and i also want to use the long tail of plus , I mean it isn't one pixel . thanks -- modified at 10:19 Thursday 11th May, 2006

          B Offline
          B Offline
          Bob Flynn
          wrote on last edited by
          #8

          To find something like that I recommed correlation. When you find your first red pixel, you sum the multiplication of all of the pixels in your defined "plus" with the ones in the appropriate location in the image. Since your image is noisy your defined "plus" needs to be thicker than a single pixel width. Once you get a total sum that exceeds a specified threshold, you declare that a "plus" has been found. Since you have to deal with rotations, the appropriate locations for the multiplies will have to be computed taking different rotations into account. This will increase your processing time significantly. To reduce the number of iterations, once you find the first pixel you know that all other pixels will be right or down from there, assuming the origin is in the top left corner. -- modified at 10:29 Thursday 11th May, 2006

          1 Reply Last reply
          0
          • V V_shr

            I know this way but it is a lot of noise in image and the plus isn't like this : ------------o-------- -----------ooo------- ------------o-------- it is like this : -----------------------o----------- -----------------------o----------- -----------------------o----------- ---------------o o o o O --- o o o o ---------------------o------------ ----------------------o----------- ----------------------o----------- ----------------------o----------- and the most important is that it may rotate . and i dont want to rotate it in a ( for ) I want it to be a speedy algorithm . and i also want to use the long tail of plus , I mean it isn't one pixel . thanks -- modified at 10:19 Thursday 11th May, 2006

            R Offline
            R Offline
            Russell
            wrote on last edited by
            #9

            You can use 2D-fft (or 2D convolution/correlation). It will work also if there is a rotation on the plus (i.e. there is only a phase rotation) or if there is a scale factor (i.e. the ratio between frequency amplitudes remains constant),..... but they aren't

            V_shr wrote:

            speedy algorithm

            If you want a good and fast way ,probally, your work will be very hard! Try also something using some pre-processing operation, like noise filters and/or colors thresholds(-> RED plus) Hope it helps

            T 1 Reply Last reply
            0
            • V V_shr

              hello all I need to find a red " + " in a image and i want a good algorithm . thank you -- modified at 9:48 Thursday 11th May, 2006

              V Offline
              V Offline
              V_shr
              wrote on last edited by
              #10

              thank you allllll

              R T B 3 Replies Last reply
              0
              • V V_shr

                thank you allllll

                R Offline
                R Offline
                Russell
                wrote on last edited by
                #11

                You are wellcome:)

                1 Reply Last reply
                0
                • V V_shr

                  thank you allllll

                  T Offline
                  T Offline
                  toxcct
                  wrote on last edited by
                  #12

                  ;)


                  TOXCCT >>> GEII power

                  [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                  T 1 Reply Last reply
                  0
                  • V V_shr

                    thank you allllll

                    B Offline
                    B Offline
                    Bob Flynn
                    wrote on last edited by
                    #13

                    Good Luck

                    1 Reply Last reply
                    0
                    • V V_shr

                      hello all I need to find a red " + " in a image and i want a good algorithm . thank you -- modified at 9:48 Thursday 11th May, 2006

                      S Offline
                      S Offline
                      Stephen Hewitt
                      wrote on last edited by
                      #14

                      Good luck; you'll need it. That's a sophisticated algorithm you're after. I suggest you get a good book on digital processing and don't expect results too quickly. Steve

                      1 Reply Last reply
                      0
                      • R Russell

                        You can use 2D-fft (or 2D convolution/correlation). It will work also if there is a rotation on the plus (i.e. there is only a phase rotation) or if there is a scale factor (i.e. the ratio between frequency amplitudes remains constant),..... but they aren't

                        V_shr wrote:

                        speedy algorithm

                        If you want a good and fast way ,probally, your work will be very hard! Try also something using some pre-processing operation, like noise filters and/or colors thresholds(-> RED plus) Hope it helps

                        T Offline
                        T Offline
                        ThatsAlok
                        wrote on last edited by
                        #15

                        _Russell_ wrote:

                        Try also something using some pre-processing operation, like noise filters and/or colors thresholds(-> RED plus)

                        Good!

                        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                        cheers, Alok Gupta VC Forum Q&A :- I/ IV

                        1 Reply Last reply
                        0
                        • T toxcct

                          ;)


                          TOXCCT >>> GEII power

                          [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                          T Offline
                          T Offline
                          ThatsAlok
                          wrote on last edited by
                          #16

                          Humm...

                          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                          cheers, Alok Gupta VC Forum Q&A :- I/ IV

                          T 1 Reply Last reply
                          0
                          • T ThatsAlok

                            Humm...

                            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                            cheers, Alok Gupta VC Forum Q&A :- I/ IV

                            T Offline
                            T Offline
                            toxcct
                            wrote on last edited by
                            #17

                            ThatsAlok wrote:

                            Humm...

                            pardon dear ? what's up ?


                            TOXCCT >>> GEII power

                            [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                            T 1 Reply Last reply
                            0
                            • T toxcct

                              ThatsAlok wrote:

                              Humm...

                              pardon dear ? what's up ?


                              TOXCCT >>> GEII power

                              [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                              T Offline
                              T Offline
                              ThatsAlok
                              wrote on last edited by
                              #18

                              toxcct wrote:

                              pardon dear ?what's up ?

                              oops sorry! wrong person :)

                              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                              cheers, Alok Gupta VC Forum Q&A :- I/ IV

                              S 1 Reply Last reply
                              0
                              • T ThatsAlok

                                toxcct wrote:

                                pardon dear ?what's up ?

                                oops sorry! wrong person :)

                                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                                cheers, Alok Gupta VC Forum Q&A :- I/ IV

                                S Offline
                                S Offline
                                Scorpio
                                wrote on last edited by
                                #19

                                VC Forum Q&A :- I/ IV ? where are II and III NiLeSh KoRpE

                                T 1 Reply Last reply
                                0
                                • S Scorpio

                                  VC Forum Q&A :- I/ IV ? where are II and III NiLeSh KoRpE

                                  T Offline
                                  T Offline
                                  ThatsAlok
                                  wrote on last edited by
                                  #20

                                  NiLeSh KoRpE wrote:

                                  where are II and III

                                  Still Missing :)

                                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                                  cheers, Alok Gupta VC Forum Q&A :- I/ IV

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups