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!
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
Scintillements de controle. Boutons sur une statique. (Owner drawn) [ par Sim 2005 ]
Bonjour, dans l'interface de mon programme, il y a des boutons sur un controle statique utilisé pour affiché l'image de fond. Le problème est que lors
|
Derniers Blogs
UNE JOLIE-HORLOGE ET PAS QU'UN PEU !UNE JOLIE-HORLOGE ET PAS QU'UN PEU ! par neodante
Pour les possesseurs d'iPhone, ça y est Bijin Tokei - qui se traduit littéralement en Français par " Jolie Horloge " - est arrivé et GRATUITEMENT s'il vous plaît ! Après la version Tokyo, Hokkaido, night club, racing, Gal, "pour les mademoiselles'", . voi...
Cliquez pour lire la suite de l'article par neodante TECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICESTECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICES par ROMELARD Fabrice
Animé par: Gaetan Bouveret et Julien Chomarat Business Connectivity Services (BCS) est dans SharePoint 2010 la version 2 de Business Data Catalog (BDC dans SharePoint 2007). Il s'agit de la solution permettant de visualiser des données provenan...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE[DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE par orion
Comme de nombreux geek, je suis un grand amateur de série TV et je rate régulièrement des épisodes de mes séries préférés. Une solution s'offre à vous avec ce merveilleux site : Tv Gorge - www.tvgorge.com Moteur de recherche à l'appui, vous pouvez ...
Cliquez pour lire la suite de l'article par orion TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010 par ROMELARD Fabrice
Animé par: Vincent Bellet et Baptiste Giraudier La BI dans SharePoint 2010, Les nouveaux services d'application dans SP2010 et SQL Server Reporting services 2008 R2. La BI dans SharePoint est généralisée pour tous afin de permettre à tous les coll...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Forum
RE : WIN APIRE : WIN API par racpp
Cliquez pour lire la suite par racpp WIN APIWIN API par omarino_007
Cliquez pour lire la suite par omarino_007
Logiciels
DB-MAIN (9.1.0)DB-MAIN (9.1.0)DB-MAIN is a data-modeling and data-architecture tool. It is designed to help developers and anal... Cliquez pour télécharger DB-MAIN Xilisoft DPG Convertisseur (5.1.37.0120)XILISOFT DPG CONVERTISSEUR (5.1.37.0120)Xilisoft DPG Convertisseur offre aux fans de Nintendo DS une bonne solution leur permettant de dé... Cliquez pour télécharger Xilisoft DPG Convertisseur GraphicsGale (2.01.01)GRAPHICSGALE (2.01.01)GraphicsGale est un logiciel de PixelArt avec de nombreuse fonctionnalités permettant de réalisé ... Cliquez pour télécharger GraphicsGale Architecte 3D (Platinum 2010)ARCHITECTE 3D (PLATINUM 2010)Architecte 3D Platinium vous permet de concevoir facilement les plans votre future maison, de l'é... Cliquez pour télécharger Architecte 3D TeamViewer 5 (TeamViewer 5)TEAMVIEWER 5 (TEAMVIEWER 5)Dépanner un ami,expliquer une manipulation devient un jeu d'enfant.
Prise en main d'un autre ord... Cliquez pour télécharger TeamViewer 5
|