Accueil > > > TRANSFORMÉE DE HOUGH: DÉTECTION DE DROITES
TRANSFORMÉE DE HOUGH: DÉTECTION DE DROITES
Information sur la source
Description
Ce programme permet de mieux comprendre le fonctionnement de la transformée de Hough.
Cette transformée permet de changer d'espace de représentation. Un point dans l'espace (X,Y) sera transformée en sinusoïde dans l'espace (R,Theta) et inversement un point dans le plan (R, Theta) sera une droite dans le plan (X,Y).
Ce qui est intéressant, c'est que la succession de point formant une droite dans le plan (X,Y) formera des sinusoïdes qui seront concurrente en un point.
Cette transformé permet donc de détecter les droites dans une image.
Source
-
- //*****************************************************************************************
- //Author MORARD Vincent
- //Date : 28/06/07
- //Contact: vincent.morard@cpe.fr
- //WebSite: pistol.petesampras.free.fr
- //*****************************************************************************************
-
- //Includes----------------------------------------------------------------------------------
- #include "windows.h"
- #include "cmugraphics.h"
- #include "math.h"
- #include <vector>
- using namespace std;
-
- //Define------------------------------------------------------------------------------------
- #define SPACE_X1 100
- #define SPACE_Y1 10
- #define SPACE_X2 300
- #define SPACE_Y2 210
-
- #define SPACE_CENTER_X 200
- #define SPACE_CENTER_Y 110
-
- #define HOUGH_X1 50
- #define HOUGH_Y1 230
- #define HOUGH_X2 350
- #define HOUGH_Y2 510
-
- #define HOUGH_CENTER_X 50
- #define HOUGH_CENTER_Y 370
- const double Pi = 3.141592653589793238462643383279;
-
- //Struct---------------------------------------------------------------------------------
- struct Transform
- {
- double X,Y,Theta,R;
- bool Inv_Transform;
- };
-
-
- //Header's function-----------------------------------------------------------------------
- void DrawAxis(window &F,int Graph=-1);
- void DrawCosinus(window &F,double R,double Theta);
- void DrawLine(window &F,double X,double Y,double Theta);
- void UpdateHough(window &F,vector<Transform> Vect);
- void UpdateSpace(window &F,vector<Transform> Vect);
- void ButtonDownAction(window &F,vector<Transform> *Vect,int MouseX,int MouseY,bool Final=0);
- void UpdateCoord(window &F,vector<Transform> *Vect);
- void DrawInterface(window &F,bool *Reset,bool *Exit,bool *Click);
-
-
- //*******************************************************************************************
-
- int APIENTRY WinMain(HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- LPSTR lpCmdLine,
- int nCmdShow)
-
- {
- bool Exit=false;
- bool Reset=true;
- bool Click=false;
- int Cpt=0;
- window F(390,600,0,0); //create a 390 width and 600 Height window
- //at the position (0,0)
- F.SetWaitClose(false); //Close the window when we exit
- F.SetBuffering(true); //Allow double buffering
- F.ChangeTitle("Hough tranform");//Change title
-
- vector<Transform>Vect; //Vector to stock all the parameters
- Vect.resize(0); //init vector
-
-
- do
- {
- if(++Cpt==100)
- {
- MSG msg;
- if(!GetMessage(&msg, NULL, 0, 0))//On recoit le message de fin =>on a appuyé sur la croix
- exit(1);
- Cpt=0;
- }
- if(Reset) //if Reset : we redraw axis
- {
- Reset=false;
- DrawAxis(F);
- Vect.resize(0); //And we resize to 0 the vector
- }
- UpdateCoord(F,&Vect); //To update the points and theres transforms
- DrawInterface(F,&Reset,&Exit,&Click); //Button
- F.UpdateBuffer();
- Sleep(20); //The process gives back the hand to an another process
- //during 20 ms
- }
- while(!Exit);
- exit(0);
- return 0;
- }
-
- //This function checks the mouse's event and calls the appropriate function
- void UpdateCoord(window &F,vector<Transform>*Vect)
- {
- int MouseX,MouseY;
- bool Click=false;
-
- F.GetMouseCoord(MouseX,MouseY);
- if(MouseY>540)
- return;
- //If the user clicks on the screen, he will see the result of Hough tranform in real time
- while(F.GetButtonState(LEFT_BUTTON,MouseX,MouseY)==BUTTON_DOWN)
- {
-
- ButtonDownAction(F,Vect,MouseX,MouseY); //temporary action
- F.UpdateBuffer();
-
- Sleep(30);
- Click=true;
- }
- if(Click) //if we click the result keeps on the sreen
- ButtonDownAction(F,Vect,MouseX,MouseY,1);
- }
-
-
- //This function takes back the coord of the mouse in the graph
- //and calls the function to make a transformation into Hough's space.
- void ButtonDownAction(window &F,vector<Transform> *Vect,int MouseX,int MouseY,bool Final)
- {
- Transform Hough; //this structure allow us to stock all the parameters of the Hough's transform
- //X and Y , R and theta
-
- //if the mouse is over the graph 1
- if(MouseX > SPACE_X1 && MouseX < SPACE_X2 && MouseY > SPACE_Y1 && MouseY < SPACE_Y2)
- {
- //We just have to tranform MouseX and MouseY to have the coord of the position of
- //the mouse on the graph
- Hough.X = MouseX-SPACE_CENTER_X;
- Hough.Y = SPACE_CENTER_Y-MouseY;
- //With X and Y we are able to get R and Theta in polar coord
- //R=sqrt(X² + Y²)
- //tan(Theta) = Y/X
- Hough.R = sqrt((double)(Hough.X*Hough.X+Hough.Y*Hough.Y));
- Hough.Theta = atan((double)Hough.Y/Hough.X)+Pi/2;
- if(Hough.X>0)
- Hough.Theta+=Pi;
- Hough.Inv_Transform = 0; //Hough transform
-
- Vect->push_back(Hough); //we push the new point
- UpdateHough(F,*Vect); //and we update the transform
- if(!Final)
- Vect->pop_back(); //if we still click, we pop the new point
- else
- {
- F.SetPen(RED); //if we stop clicking, we draw a circle on the screen
- F.SetBrush(RED);
- F.DrawCircle(MouseX,MouseY,3,FRAME);
-
- }
-
-
- }
- else if(MouseX >= HOUGH_X1 && MouseX < HOUGH_X2 && MouseY > HOUGH_Y1 && MouseY < HOUGH_Y2)
- {
- double Pas=Pi/(HOUGH_X2-HOUGH_X1);
- //We have got easily R and Theta
- Hough.Theta = (MouseX-HOUGH_CENTER_X)*Pas;
- Hough.R = HOUGH_CENTER_Y-MouseY;
- //And we convert R and Theta in cartesien coord
- Hough.Y = Hough.R*cos(Hough.Theta);
- Hough.X = -Hough.R*sin(Hough.Theta);
- Hough.Inv_Transform = 1; //Hough reverse
-
- Vect->push_back(Hough);
- UpdateSpace(F,*Vect);
- if(!Final)
- Vect->pop_back();
- else
- {
- F.SetBrush(GREEN);
- F.SetPen(GREEN);
- F.DrawCircle(MouseX,MouseY,3,FILLED);
- }
- }
- }
-
- void UpdateHough(window &F,vector<Transform> Vect)
- {
-
- DrawAxis(F,2);
- F.SetPen(GREEN);
- F.SetBrush(GREEN);
- int Size=Vect.size();
- for(int i=0;i<Size;i++)
- {
- if(! Vect[i].Inv_Transform )
- DrawCosinus(F,Vect[i].R,Vect[i].Theta);
- else
- F.DrawCircle(Vect[i].Theta*(HOUGH_X2-HOUGH_X1)/Pi+HOUGH_CENTER_X,HOUGH_CENTER_Y-Vect[i].R,3);
-
- }
-
- }
- void UpdateSpace(window &F,vector<Transform> Vect)
- {
-
- DrawAxis(F,1);
- F.SetPen(RED);
- F.SetBrush(RED);
- int Size=Vect.size();
- for(int i=0;i<Size;i++)
- if(Vect[i].Inv_Transform )
- DrawLine(F,Vect[i].X,Vect[i].Y,Vect[i].Theta);
- else
- F.DrawCircle(Vect[i].X+SPACE_CENTER_X,SPACE_CENTER_Y-Vect[i].Y,3);
-
-
- }
-
- void DrawCosinus(window &F,double R,double Theta)
- {
- int Width=HOUGH_X2-HOUGH_X1;
- int Height=HOUGH_Y2-HOUGH_Y1;
- double x,y;
- double Pas=Pi/Width;
- F.SetPen(GREEN);
- F.SetBrush(GREEN);
- //for each pixel of the graph, we evaluate the y coord with cosinus
- for(double i=HOUGH_X1;i<HOUGH_X2;i++)
- {
- x=i-HOUGH_CENTER_X;
- x*=Pas; //conversion into radian
- y=R*cos(x-Theta);
- F.DrawPixel(i,HOUGH_CENTER_Y-y);
- }
- }
-
-
- //This function is able to draw a line with one point and one angle
- void DrawLine(window &F,double X,double Y,double Theta)
- {
- //Vecteur is the direction
- double Vecteur=tan(Theta);
-
- X+=SPACE_CENTER_X;
- Y=SPACE_CENTER_Y-Y;
- if(X>SPACE_X2 || X<SPACE_X1 || Y>SPACE_Y2 || Y<SPACE_Y1)
- return;
-
- int LastX=X;
- int LastY=Y;
- double i,j;
-
- F.SetPen(RED);
- F.SetBrush(RED);
- for(i=X;i<=SPACE_X2;i+=0.5)
- {
- if((j=Y-Vecteur*(i-X))>SPACE_Y2 || j<SPACE_Y1)
- break;
-
- LastX=i; //We get the coord of the point whith cut the graph's window
- LastY=j;
- }
- F.DrawLine((int)X,(int)Y,LastX,LastY);
- LastX=X;
- LastY=Y;
-
- //We do the same thing in the other way
- for(i=X;i>=SPACE_X1;i-=0.5)
- {
- if((j=j=Y-Vecteur*(i-X))>SPACE_Y2 || j<SPACE_Y1)
- break;
-
- LastX=i;
- LastY=j;
- }
- F.DrawLine((int)X,(int)Y,LastX,LastY);
-
-
- }
-
-
- void DrawInterface(window &F,bool *Reset,bool *Exit,bool *Click)
- {
- int MouseX,MouseY;
- F.SetFont(20,BOLD,SWISS);
- F.SetPen(WHITE);
- F.SetBrush(WHITE);
- F.DrawRectangle(100,540,400,590);
-
-
- F.SetPen(NAVYBLUE,2);
- //F.DrawRectangle(210,545,270,575);
- F.DrawString(110,550,"Reset");
- F.DrawString(220,550,"Quit");
-
- if(F.GetButtonState(LEFT_BUTTON,MouseX,MouseY)==BUTTON_DOWN)
- {
- if(MouseX>=80 && MouseX<180 && MouseY>545 && MouseY<575)
- *Click=true;
- if(MouseX>=210 && MouseX<270 && MouseY>545 && MouseY<575)
- *Click=true;
- }
- else if (*Click)
- {
- *Click=false;
- if(MouseX>=80 && MouseX<180 && MouseY>545 && MouseY<575)
- *Reset=true;
- if(MouseX>=210 && MouseX<270 && MouseY>545 && MouseY<575)
- *Exit=true;
-
-
- }
- else
- *Click=false;
-
- }
-
- void DrawAxis(window &F,int Graph)
- {
-
- F.SetBrush(WHITE);
- F.SetFont(15,BOLD,SWISS);
- if(Graph!=2) //We do not draw again graph 2
- {
- F.SetPen(DARKRED,3);
- F.DrawRectangle(SPACE_X1,SPACE_Y1,SPACE_X2,SPACE_Y2);
- F.SetPen(BLACK);
- //y-axis
- F.DrawLine(SPACE_CENTER_X,SPACE_Y1,SPACE_CENTER_X,SPACE_Y2);
- //x-axis
- F.DrawLine(SPACE_X1,SPACE_CENTER_Y,SPACE_X2,SPACE_CENTER_Y);
- //Arrows
- F.DrawLine(SPACE_CENTER_X-5,SPACE_Y1+9,SPACE_CENTER_X,SPACE_Y1);
- F.DrawLine(SPACE_CENTER_X+5,SPACE_Y1+9,SPACE_CENTER_X,SPACE_Y1);
- F.DrawLine(SPACE_X2-5,SPACE_CENTER_Y+3,SPACE_X2,SPACE_CENTER_Y);
- F.DrawLine(SPACE_X2-5,SPACE_CENTER_Y-3,SPACE_X2,SPACE_CENTER_Y);
- //Legende
- F.DrawString(SPACE_CENTER_X,SPACE_Y1-16,"y");
- F.DrawString(SPACE_X2+10,SPACE_CENTER_Y,"x");
- }
- if(Graph!=1) //We do not draw again graph 1
- {
- F.SetPen(DARKGREEN,3);
- F.DrawRectangle(HOUGH_X1,HOUGH_Y1,HOUGH_X2,HOUGH_Y2);
- F.SetPen(BLACK);
- //y-axis
- F.DrawLine(HOUGH_CENTER_X,HOUGH_Y1,HOUGH_CENTER_X,HOUGH_Y2);
- //x-axis
- F.DrawLine(HOUGH_X1,HOUGH_CENTER_Y,HOUGH_X2,HOUGH_CENTER_Y);
- //Arrows
- F.DrawLine(HOUGH_CENTER_X-5,HOUGH_Y1+9,HOUGH_CENTER_X,HOUGH_Y1);
- F.DrawLine(HOUGH_CENTER_X+5,HOUGH_Y1+9,HOUGH_CENTER_X,HOUGH_Y1);
- F.DrawLine(HOUGH_X2-5,HOUGH_CENTER_Y+3,HOUGH_X2,HOUGH_CENTER_Y);
- F.DrawLine(HOUGH_X2-5,HOUGH_CENTER_Y-3,HOUGH_X2,HOUGH_CENTER_Y);
- //Legende
- F.DrawString(HOUGH_CENTER_X,HOUGH_Y1-16,"Theta");
- F.DrawString(HOUGH_X2+8,HOUGH_CENTER_Y,"R");
- }
-
- }
//*****************************************************************************************
//Author MORARD Vincent
//Date : 28/06/07
//Contact: vincent.morard@cpe.fr
//WebSite: pistol.petesampras.free.fr
//*****************************************************************************************
//Includes----------------------------------------------------------------------------------
#include "windows.h"
#include "cmugraphics.h"
#include "math.h"
#include <vector>
using namespace std;
//Define------------------------------------------------------------------------------------
#define SPACE_X1 100
#define SPACE_Y1 10
#define SPACE_X2 300
#define SPACE_Y2 210
#define SPACE_CENTER_X 200
#define SPACE_CENTER_Y 110
#define HOUGH_X1 50
#define HOUGH_Y1 230
#define HOUGH_X2 350
#define HOUGH_Y2 510
#define HOUGH_CENTER_X 50
#define HOUGH_CENTER_Y 370
const double Pi = 3.141592653589793238462643383279;
//Struct---------------------------------------------------------------------------------
struct Transform
{
double X,Y,Theta,R;
bool Inv_Transform;
};
//Header's function-----------------------------------------------------------------------
void DrawAxis(window &F,int Graph=-1);
void DrawCosinus(window &F,double R,double Theta);
void DrawLine(window &F,double X,double Y,double Theta);
void UpdateHough(window &F,vector<Transform> Vect);
void UpdateSpace(window &F,vector<Transform> Vect);
void ButtonDownAction(window &F,vector<Transform> *Vect,int MouseX,int MouseY,bool Final=0);
void UpdateCoord(window &F,vector<Transform> *Vect);
void DrawInterface(window &F,bool *Reset,bool *Exit,bool *Click);
//*******************************************************************************************
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
bool Exit=false;
bool Reset=true;
bool Click=false;
int Cpt=0;
window F(390,600,0,0); //create a 390 width and 600 Height window
//at the position (0,0)
F.SetWaitClose(false); //Close the window when we exit
F.SetBuffering(true); //Allow double buffering
F.ChangeTitle("Hough tranform");//Change title
vector<Transform>Vect; //Vector to stock all the parameters
Vect.resize(0); //init vector
do
{
if(++Cpt==100)
{
MSG msg;
if(!GetMessage(&msg, NULL, 0, 0))//On recoit le message de fin =>on a appuyé sur la croix
exit(1);
Cpt=0;
}
if(Reset) //if Reset : we redraw axis
{
Reset=false;
DrawAxis(F);
Vect.resize(0); //And we resize to 0 the vector
}
UpdateCoord(F,&Vect); //To update the points and theres transforms
DrawInterface(F,&Reset,&Exit,&Click); //Button
F.UpdateBuffer();
Sleep(20); //The process gives back the hand to an another process
//during 20 ms
}
while(!Exit);
exit(0);
return 0;
}
//This function checks the mouse's event and calls the appropriate function
void UpdateCoord(window &F,vector<Transform>*Vect)
{
int MouseX,MouseY;
bool Click=false;
F.GetMouseCoord(MouseX,MouseY);
if(MouseY>540)
return;
//If the user clicks on the screen, he will see the result of Hough tranform in real time
while(F.GetButtonState(LEFT_BUTTON,MouseX,MouseY)==BUTTON_DOWN)
{
ButtonDownAction(F,Vect,MouseX,MouseY); //temporary action
F.UpdateBuffer();
Sleep(30);
Click=true;
}
if(Click) //if we click the result keeps on the sreen
ButtonDownAction(F,Vect,MouseX,MouseY,1);
}
//This function takes back the coord of the mouse in the graph
//and calls the function to make a transformation into Hough's space.
void ButtonDownAction(window &F,vector<Transform> *Vect,int MouseX,int MouseY,bool Final)
{
Transform Hough; //this structure allow us to stock all the parameters of the Hough's transform
//X and Y , R and theta
//if the mouse is over the graph 1
if(MouseX > SPACE_X1 && MouseX < SPACE_X2 && MouseY > SPACE_Y1 && MouseY < SPACE_Y2)
{
//We just have to tranform MouseX and MouseY to have the coord of the position of
//the mouse on the graph
Hough.X = MouseX-SPACE_CENTER_X;
Hough.Y = SPACE_CENTER_Y-MouseY;
//With X and Y we are able to get R and Theta in polar coord
//R=sqrt(X² + Y²)
//tan(Theta) = Y/X
Hough.R = sqrt((double)(Hough.X*Hough.X+Hough.Y*Hough.Y));
Hough.Theta = atan((double)Hough.Y/Hough.X)+Pi/2;
if(Hough.X>0)
Hough.Theta+=Pi;
Hough.Inv_Transform = 0; //Hough transform
Vect->push_back(Hough); //we push the new point
UpdateHough(F,*Vect); //and we update the transform
if(!Final)
Vect->pop_back(); //if we still click, we pop the new point
else
{
F.SetPen(RED); //if we stop clicking, we draw a circle on the screen
F.SetBrush(RED);
F.DrawCircle(MouseX,MouseY,3,FRAME);
}
}
else if(MouseX >= HOUGH_X1 && MouseX < HOUGH_X2 && MouseY > HOUGH_Y1 && MouseY < HOUGH_Y2)
{
double Pas=Pi/(HOUGH_X2-HOUGH_X1);
//We have got easily R and Theta
Hough.Theta = (MouseX-HOUGH_CENTER_X)*Pas;
Hough.R = HOUGH_CENTER_Y-MouseY;
//And we convert R and Theta in cartesien coord
Hough.Y = Hough.R*cos(Hough.Theta);
Hough.X = -Hough.R*sin(Hough.Theta);
Hough.Inv_Transform = 1; //Hough reverse
Vect->push_back(Hough);
UpdateSpace(F,*Vect);
if(!Final)
Vect->pop_back();
else
{
F.SetBrush(GREEN);
F.SetPen(GREEN);
F.DrawCircle(MouseX,MouseY,3,FILLED);
}
}
}
void UpdateHough(window &F,vector<Transform> Vect)
{
DrawAxis(F,2);
F.SetPen(GREEN);
F.SetBrush(GREEN);
int Size=Vect.size();
for(int i=0;i<Size;i++)
{
if(! Vect[i].Inv_Transform )
DrawCosinus(F,Vect[i].R,Vect[i].Theta);
else
F.DrawCircle(Vect[i].Theta*(HOUGH_X2-HOUGH_X1)/Pi+HOUGH_CENTER_X,HOUGH_CENTER_Y-Vect[i].R,3);
}
}
void UpdateSpace(window &F,vector<Transform> Vect)
{
DrawAxis(F,1);
F.SetPen(RED);
F.SetBrush(RED);
int Size=Vect.size();
for(int i=0;i<Size;i++)
if(Vect[i].Inv_Transform )
DrawLine(F,Vect[i].X,Vect[i].Y,Vect[i].Theta);
else
F.DrawCircle(Vect[i].X+SPACE_CENTER_X,SPACE_CENTER_Y-Vect[i].Y,3);
}
void DrawCosinus(window &F,double R,double Theta)
{
int Width=HOUGH_X2-HOUGH_X1;
int Height=HOUGH_Y2-HOUGH_Y1;
double x,y;
double Pas=Pi/Width;
F.SetPen(GREEN);
F.SetBrush(GREEN);
//for each pixel of the graph, we evaluate the y coord with cosinus
for(double i=HOUGH_X1;i<HOUGH_X2;i++)
{
x=i-HOUGH_CENTER_X;
x*=Pas; //conversion into radian
y=R*cos(x-Theta);
F.DrawPixel(i,HOUGH_CENTER_Y-y);
}
}
//This function is able to draw a line with one point and one angle
void DrawLine(window &F,double X,double Y,double Theta)
{
//Vecteur is the direction
double Vecteur=tan(Theta);
X+=SPACE_CENTER_X;
Y=SPACE_CENTER_Y-Y;
if(X>SPACE_X2 || X<SPACE_X1 || Y>SPACE_Y2 || Y<SPACE_Y1)
return;
int LastX=X;
int LastY=Y;
double i,j;
F.SetPen(RED);
F.SetBrush(RED);
for(i=X;i<=SPACE_X2;i+=0.5)
{
if((j=Y-Vecteur*(i-X))>SPACE_Y2 || j<SPACE_Y1)
break;
LastX=i; //We get the coord of the point whith cut the graph's window
LastY=j;
}
F.DrawLine((int)X,(int)Y,LastX,LastY);
LastX=X;
LastY=Y;
//We do the same thing in the other way
for(i=X;i>=SPACE_X1;i-=0.5)
{
if((j=j=Y-Vecteur*(i-X))>SPACE_Y2 || j<SPACE_Y1)
break;
LastX=i;
LastY=j;
}
F.DrawLine((int)X,(int)Y,LastX,LastY);
}
void DrawInterface(window &F,bool *Reset,bool *Exit,bool *Click)
{
int MouseX,MouseY;
F.SetFont(20,BOLD,SWISS);
F.SetPen(WHITE);
F.SetBrush(WHITE);
F.DrawRectangle(100,540,400,590);
F.SetPen(NAVYBLUE,2);
//F.DrawRectangle(210,545,270,575);
F.DrawString(110,550,"Reset");
F.DrawString(220,550,"Quit");
if(F.GetButtonState(LEFT_BUTTON,MouseX,MouseY)==BUTTON_DOWN)
{
if(MouseX>=80 && MouseX<180 && MouseY>545 && MouseY<575)
*Click=true;
if(MouseX>=210 && MouseX<270 && MouseY>545 && MouseY<575)
*Click=true;
}
else if (*Click)
{
*Click=false;
if(MouseX>=80 && MouseX<180 && MouseY>545 && MouseY<575)
*Reset=true;
if(MouseX>=210 && MouseX<270 && MouseY>545 && MouseY<575)
*Exit=true;
}
else
*Click=false;
}
void DrawAxis(window &F,int Graph)
{
F.SetBrush(WHITE);
F.SetFont(15,BOLD,SWISS);
if(Graph!=2) //We do not draw again graph 2
{
F.SetPen(DARKRED,3);
F.DrawRectangle(SPACE_X1,SPACE_Y1,SPACE_X2,SPACE_Y2);
F.SetPen(BLACK);
//y-axis
F.DrawLine(SPACE_CENTER_X,SPACE_Y1,SPACE_CENTER_X,SPACE_Y2);
//x-axis
F.DrawLine(SPACE_X1,SPACE_CENTER_Y,SPACE_X2,SPACE_CENTER_Y);
//Arrows
F.DrawLine(SPACE_CENTER_X-5,SPACE_Y1+9,SPACE_CENTER_X,SPACE_Y1);
F.DrawLine(SPACE_CENTER_X+5,SPACE_Y1+9,SPACE_CENTER_X,SPACE_Y1);
F.DrawLine(SPACE_X2-5,SPACE_CENTER_Y+3,SPACE_X2,SPACE_CENTER_Y);
F.DrawLine(SPACE_X2-5,SPACE_CENTER_Y-3,SPACE_X2,SPACE_CENTER_Y);
//Legende
F.DrawString(SPACE_CENTER_X,SPACE_Y1-16,"y");
F.DrawString(SPACE_X2+10,SPACE_CENTER_Y,"x");
}
if(Graph!=1) //We do not draw again graph 1
{
F.SetPen(DARKGREEN,3);
F.DrawRectangle(HOUGH_X1,HOUGH_Y1,HOUGH_X2,HOUGH_Y2);
F.SetPen(BLACK);
//y-axis
F.DrawLine(HOUGH_CENTER_X,HOUGH_Y1,HOUGH_CENTER_X,HOUGH_Y2);
//x-axis
F.DrawLine(HOUGH_X1,HOUGH_CENTER_Y,HOUGH_X2,HOUGH_CENTER_Y);
//Arrows
F.DrawLine(HOUGH_CENTER_X-5,HOUGH_Y1+9,HOUGH_CENTER_X,HOUGH_Y1);
F.DrawLine(HOUGH_CENTER_X+5,HOUGH_Y1+9,HOUGH_CENTER_X,HOUGH_Y1);
F.DrawLine(HOUGH_X2-5,HOUGH_CENTER_Y+3,HOUGH_X2,HOUGH_CENTER_Y);
F.DrawLine(HOUGH_X2-5,HOUGH_CENTER_Y-3,HOUGH_X2,HOUGH_CENTER_Y);
//Legende
F.DrawString(HOUGH_CENTER_X,HOUGH_Y1-16,"Theta");
F.DrawString(HOUGH_X2+8,HOUGH_CENTER_Y,"R");
}
}
Sources du même auteur
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
Transformée de Hough [ par elo29 ]
Bonjour, Je travaille avec visual C++ et je debute dans le traitement d'image et en programmation C++. Je dois effectuer la detection de cercles dans
Transformée de Hough ... Help me :( [ par ouafaa ]
Bonjour a tout le mondedans le cadre d'un projet, je suis ramenée à detecter une elipse dans une
Transformée Inverse de Hough [ par s1a1j2 ]
Bonjour Tout le monde,Je cherche la transformée de Hough directe et surtout la transformée inverse Hough. J'espère trouver un code simple en Langage C
Transformée de Hough 3D [ par alice69230 ]
Bonjour,Quelqu'un saurait-il où trouver le code pour faire la transformée de Hough 3D d'un ensemble de points?Merci d'avance!
detection de lignes a l'aide de la transformée de Hough sous matlab [ par mberkani ]
j'utilise matlab pour traiter une video de route , j'ai un pb de programmation concernant la detection des bordures de la route en utilisant la transf
détection de route dans une image de rue [ par wnxbcvqmsldkfjgh ]
Bonjour,J'ai un projet dans lequel je dois détecter une route dans une image de rue, contenant bâtiments, piétons, voitures... Savez-vous si on peut t
Mise en couleur d'image sur une page HTML [ par stephane85700 ]
bonjour, Je débute dans la création de site, et j'aimerai un peu de vos lumières pour avancer.Je souhaiterais pouvoir créer une page ou il serait poss
traitement d'image [ par salma2011 ]
Slt tt le monde,je cherche un théme pour ma representation de PFE avec powerpoint,j'ai comme sujet le traitement d'image avec vc++,,qq1 peut m'aider??
Probleme avec filtre image en c [ par simomiso ]
Bonjour,tout d'abords un GRAND MERCI a tous ceux ki ont participé ds la conception de ce site.En fait j'ai un proble avec un filtre image avec matrice
demande d'aide sur c++builder(segmentation sequence video) [ par fcbomar2007 ]
slt mes frere,je suis un etudiant en informatiquej'ai un projet de fin d'étudequi se présentedans un petit logiciel ,c'est la segmentation séquence v
|
Derniers Blogs
INTéGRATION YAMMER ET SHAREPOINT ONLINE (OFFICE 365), éTAPE 1 .INTéGRATION YAMMER ET SHAREPOINT ONLINE (OFFICE 365), éTAPE 1 . par Patrick Guimonet
#Yammer Certains s'en sont déjà fait l'écho (ici en allemand par exemple : Yammer Integration in Office 365 Phase 1) ou bien sûr sur le blog SharePoint : Make Yammer your default social network in Office 365 en anglais. Mais c'e...
Cliquez pour lire la suite de l'article par Patrick Guimonet [DYNAMICS CRM] AJOUTER LES DOSSIERS DE CRM AU DOSSIER FAVORIS D'OUTLOOK[DYNAMICS CRM] AJOUTER LES DOSSIERS DE CRM AU DOSSIER FAVORIS D'OUTLOOK par bianca
Objectif
Pour aller plus rapidement dans les menus de Dynamics CRM depuis votre client CRM pour Outlook, vous pouvez utiliser le dossier des Favoris d'Outlook. En effet, par simple glisser/déplacer, vous pouvez déposer un éléme...
Cliquez pour lire la suite de l'article par bianca VISUAL STUDIO 2013VISUAL STUDIO 2013 par Etienne Margraff
Ahh, ENFIN ! c'est officiel, il va y avoir un VS et un TFS 2013. De nouvelles fonctionnalités qui vont à mon sens assoir la maturité de TFS qui est maintenant l'outil incontournable pour tout projet (.NET, mais pas seulement !). Si vous n'avez pas jet...
Cliquez pour lire la suite de l'article par Etienne Margraff CONFIGURER LA COLLATION SQL SERVER POUR SHAREPOINT CONFIGURER LA COLLATION SQL SERVER POUR SHAREPOINT par JeremyJeanson
Note : Je poste cet article à titre de pense-bête. Cela fait des années que je me trimballe avec une capture d'écran, car je ne me rappel jamais comment choisir la collation d'un SQL Server pour SharePoint. Pour SharePoint, il est conseillé de choisir la ...
Cliquez pour lire la suite de l'article par JeremyJeanson ETENDRE LE TEAM WEB ACCESS DE TFS 2012 - STEP 1: CRéATION DU PLUGINETENDRE LE TEAM WEB ACCESS DE TFS 2012 - STEP 1: CRéATION DU PLUGIN par Philess
Dans cet article nous allons créer un plugin installable sur le Team Web Access qui s'intègrera dans l'architecture du site et se chargera au moment où on le décidera.
Avant de lire ce billet et si cela n'est pas encore fait j...
Cliquez pour lire la suite de l'article par Philess
Logiciels
Nego Facturation (1.85)NEGO FACTURATION (1.85)Nego Facturation est un logiciel complet qui permet de gérer vos factures et devis très simplemen... Cliquez pour télécharger Nego Facturation Devis-Factures PHMSD (2.2.0.1)DEVIS-FACTURES PHMSD (2.2.0.1)Configuration minimale
Nécessite Windows™ 2000, XP, Windows 7, 8, Vista (Service Pack à... Cliquez pour télécharger Devis-Factures PHMSD WDmemoCode (2.0.0.1)WDMEMOCODE (2.0.0.1)WDmemoCode a été conçu pour aider les développeurs Windev à créer/compléter et conserver une base... Cliquez pour télécharger WDmemoCode ProtoMedic (4.0.0.11)PROTOMEDIC (4.0.0.11)ProtoMedic est un logiciel destiné principalement aux médecins généralistes.
ProtoMedic permet d... Cliquez pour télécharger ProtoMedic MyCurriculum 2011 (7.4.1.12)MYCURRICULUM 2011 (7.4.1.12)Rédigez votre Curriculum Vitae mais également ceux de votre famille ou de vos amis très facilemen... Cliquez pour télécharger MyCurriculum 2011
|