Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
reduce the edges width by one pixel wide by thinning using morphology concept
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
rabia fyz  
View profile  
 More options Jun 5 2011, 7:55 am
Newsgroups: comp.graphics.visualization
From: rabia fyz <rabiafy...@gmail.com>
Date: Sun, 5 Jun 2011 04:55:37 -0700 (PDT)
Local: Sun, Jun 5 2011 7:55 am
Subject: reduce the edges width by one pixel wide by thinning using morphology concept
Hi all,

Statement: Thinning algorithms, reducing the edge width to one pixel.

as i know thinning algorithm can be applied after 1st order derivation
convolution operator. so that edges width will get reduce to one
pixel.

Test: http://imm.io/6bNo

first image is original image , second ine is from Prewitt 1st
derivative operator and the last one is from Thinning algorithm using
morphology concept..

so My code in MFC c++ :

void CImageToolDoc::OnMorphologyThinning()
{
        CDib dib = m_Dib;
        DibErosion(dib);
        DibDilation(dib);
        DibErosion(dib);
        AfxNewImage(dib);

}

void DibDilation(CDib& dib)
{
        int i,j;

        int w = dib.GetWidth();

        int h=dib.GetHeight();

        CDib cpy =dib;

        BYTE** ptr1 = dib.GetPtr();
        BYTE** ptr2 = cpy.GetPtr();

        for(j=1;j<h-1;j++)
        {
                for(i=1;i<w-1;i++)
                {
                        if(ptr2[j][i] !=0)
                        {

                                if(ptr2[j-1][i-1] == 0 || ptr2[j-1][i] ==0 || ptr2[j-1][i+1] ==0
||
                                   ptr2[j][i-1] ==0 || ptr2[j][i+1] ==0 ||
                                   ptr2[j+1][i-1] == 0 || ptr2[j+1][i] == 0 || ptr2[j+1][i+1] ==0)

                                {

                                        ptr1[j][i] = 0;
                                }
                        }

                }
        }

}

void DibErosion(CDib& dib)
{
        int i,j;

        int w = dib.GetWidth();
        int h=dib.GetHeight();

        CDib cpy =dib;

        BYTE** ptr1 = dib.GetPtr();
        BYTE** ptr2 = cpy.GetPtr();

        for(j=1;j<h-1;j++)
        {
                for(i=1;i<w-1;i++)
                {
                        if(ptr2[j][i] ==0)
                        {
                                if(ptr2[j-1][i-1] !=0  || ptr2[j-1][i] !=0 || ptr2[j-1][i+1] !=0
||
                                   ptr2[j][i-1] !=0 ||ptr2[j][i] !=0  ||  ptr2[j][i+1] !=0 ||
                                   ptr2[j+1][i-1] != 0 || ptr2[j+1][i] != 0 || ptr2[j+1][i+1] !=0)

                                {
                   ptr1[j][i] =1;
                                }
                        }
                }
        }

}

as you can see my last  image result after applying the thinning
algorithm on prewitt result ..but my edges are still wide,, not reduce
by 1 pixel..

TO be verry frank, i did not clear Thinning algorithm perfectly..
Can any one guide me,,Its urgent,,Thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »