Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how can ı do region growing in ımage with c#
ı have a source code
ı need help
Posted
Updated 20-May-14 7:14am
Comments
lukeer 16-May-14 3:19am    
Improve your question. Tell us what your source code does and what you expect instead.
And show the relevant portion of said source code so we have a chance to find what's going wrong.
OriginalGriff 16-May-14 3:42am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.
[no name] 16-May-14 5:11am    
you have clear your point. show your code ?
agent_kruger 16-May-14 10:30am    
sir, please try to improve your question.

1 solution


Regions can be made up of Rectangles (both Rectangle and RectangleF), GraphicsPaths, or RegionData. A Region can be "unioned" with Rectangles (both Rectangle and RectangleF), GraphicsPaths, or another Region. In the case of forming the Union of two or more Regions, it is important to make the receiving Region empty.



In the following example, we have an array of Rectangles that contains labels. We want to react to a MouseClick event on any of the labels (later we would determine on which label the MouseClick occurred). A region is the perfect data structure for hit testing. So we want a Region that contains all of the Rectangles that make up labels. Assume that the array of label Rectangles has already been populated.


C#
Rectangle [ ] label;

// ******************************************* new_label_union

Region new_label_union ( )
    {
    Region  region = new Region ( );

    region.MakeEmpty ( );
    for ( int i = 0; ( i < label.Length ); i++ )
        {
        if ( label [ i ] != null )
            {
            if ( label [ i ] != Rectangle.Empty )
                {
                region.Union ( label [ i ] );
                }
            }
        }

    return ( region );
    }


Note that as soon as we create the Region, we make it empty. Although not necessary for Region.Union ( Rectangle ) it is absolutely necessary for Region.Union ( Region ). So I always use Region.MakeEmpty.



Hope that helps.

 
Share this answer
 
Comments
arifemutlu 21-May-14 8:35am    
thank u so much
gggustafson 27-May-14 14:13pm    
Please rate and mark the solution as the solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900