C++ image processing, counting angles of objects -


i'm trying write image processing program i've got few problems.

i managed count shape's field, circuit(edge detecting) , other variables need. need find out @ angle each arrow is. thinking looking centre of arrow , comparing center of mass of image (and line between them angle, i'm not sure if it's how should done).

the problem have no idea how implement it. detect arrows set colour, me edges. don't know how find centre of mass (searching info on internet confused me more), centre of each arrow or how count angles.

could me counting these angles? i'm out of ideas how already.

i'm using diblook sample. can't use non-standard libraries.

my current function thing is:

void cdibdoc::converttograyimage(cview *view) { trace("start converttograyimage\r\n");      rgbtriple* rows[500] ; int width, height ; int obwod=0; int pole=0; float w3=0.0; float m00, m01, m02, m20, m10, m11; float m01, m20, m11, m7, m02;  if( getdibrowsrgb(m_hdib,rows,&width,&height)) { for( int x=0;x<width;x++)     for( int y =0;y<height;y++) {          if(x<width-1 && x>0 && y<height-1 && y>0){      //count circuit, edge detection         if(rows[x][y].rgbtblue != rows[x+1][y].rgbtblue || rows[x][y].rgbtblue != rows[x][y+1].rgbtblue ){             obwod++;          }         }          if(rows[x][y].rgbtblue == 0){    //count field         pole++;          m00+= 1;         m01+= y;         m02+= y*y;         m20+= x * x;         m10+= x;         m11=+x * y;         }                                 //counting variables other things         m02 = m02 - (m01*m01) / m00;         m01 = m01 - (m01/m00) * m00;         m11 = m11-m10 * m01 / m00;         m20 = m20 - m10*m10 / m00;         m7 = (m20*m02 - m11*m11)/(m00*m00*m00*m00);      }  freedibrows(m_hdib);  w3 = (obwod / (2* sqrt((float)m_pi * pole))) -1;    //more counting   } updateallviews(null);   

picture arrows:

enter image description here

i think easiest way of doing is, after detects edges of arrow, can calculate coordinates of p1 , p2 point of arrow head(p1) , middle point(p2) of arrows bottom line. lets p1 coordinates (x,y) , p2(x',y'). using can calculate tangent of arrow.

tan 0 = (y' - y) / (x' - x) 

so hope


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -