Tuesday, April 10, 2012

Episode_17_Implementation_of_the_Fast_Hough_Transform


Hello..!
After several months I decided focus to do my final project. I come back again to write my blog and sory for my poor english.. hehe.. (learning)

Human Vs Machine




Fuuuuuuuuuuuuuuuuuuuuuuuuuucccccccccccccccccccccccccccc...........


Rubik is a puzzle game that shaped cube is very popular around the world. 
in this Episode, I am using rubik to implementation of hough transform method..

Why Rubik ?
How to solve rubik so easily
Development of Computer Vision Technology in the world
.
.
.
.
.
.
.
.
.
.
Yes, Just Do It ... Sir

 First.. You need make orignal image to biner image 
Original image
Threshold image





 Using Hough Transform 
  • Find objects in the image by using the edges (outline) objects.
  • Have a threshold parameter to determine its sensitivity to detect the edge line.
Hough Transform
Lines that we just need to detection
Ratio total lines with threshold


Ok LET'S ROCK with Math :)



 Filter 1 
  • Finding a pair of lines which have nearly the same length
 A pair of lines which have been selected must have a length of approximately 30


 Filter 2 
  • Finding a pair of intersecting lines
 A pair of intersecting lines that already should have a den value greater than 0.1 


Filter 3 
  • Finding a pair of lines that form right angles and distances are almost similar
 A pair of lines should have a lower angle 0.5 radians (30 degrees


Filter 4 
  • Taking the point of the image are detected in a corner and the coordinates to be corresponding line
 In the local coordinate system, either the first or the second coordinate is exactly 1/3 or 2/3 within a margin of 0.05, and neither of the coordinates is outside of the range [-0.1,1.1] 




 Last.............. ! 

  • Set the coordinate system list according to the number of parallel line segments
The Result

This the Process of Image Processing

So This is my robot rubik


Yeah Still Noob But That's Ok... I build it with myself and I think it's enough for studies.

How I Build ?

Other Implementation made by me


Nobody is born stupid. Some people are born with less knowledge than others, and some people learn must faster and easier than others, it's just a matter of willingness to learn or not.

 SORY IF U FIND FOREIGN LANGUAGE 
 IT'S INDONESIAN LANGUAGE 

reference :
http://karpathy.ca/portfolio/project525.php

link for download :
https://docs.google.com/open?id=0Bzm13VWqKhTvYUI5cWtVUnhKTGc

10 comments:

Unknown said...

Oh yeah Forget..
I made this program with Visual C++ Form Application and Console

I try to upload my program maybe if u want.. :)

Unknown said...

Keren mas blognya,,, saya juga sedang belajar opencv untuk vision di robosoccer !! mungkin bisa share yang lebih banyak lagi mas :) :)

Unknown said...

makasih.. semoga bermanfaat :)
ya entar saya usahakan kalo lagi gak sibuk.

fithrantyo said...

Mau tanya, untuk dapetin Hough lines di situ gimana ya?
Kalo saya: Image source -> Gaussian blur -> Canny -> HoughLines. Tapi hasilnya kurang akurat.
Apa dari Laplacian baru HoughLines?

Unknown said...
This comment has been removed by the author.
Unknown said...

img src -> GrayColor -> Smooth -> Laplace -> HoughLines

Listing Sederhananya seperti ini
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include

using namespace std;

int main(int argc, char* argv[])
{
//inisialisasi data
int i;

IplImage *img = cvLoadImage("tes.png"); // to load image from your folder
IplImage *img2 = cvCreateImage( cvGetSize(img), 8,1 );
IplImage *imgc = cvCreateImage( cvGetSize(img), 8,3 );
IplImage *d = cvCreateImage( cvGetSize(img), IPL_DEPTH_16S, 1 );
IplImage *d2 = cvCreateImage( cvGetSize(img), 8,1 );
IplImage *b = cvCreateImage( cvGetSize(img), 8,1 );

//Hough Lines variables
CvSeq* li = 0;
CvMemStorage* storage = cvCreateMemStorage(0);
int THR = 100;
int lastdetected, dects;
lastdetected = 0;
dects = 50;



while(cvWaitKey(1) != 'q')
{
cvCopy(img,imgc);
cvCvtColor(imgc,img2,CV_BGR2GRAY);
cvSmooth(img2,img2,CV_GAUSSIAN, 3);
cvLaplace(img2,d);
cvCmpS(d,8,d2,CV_CMP_GT);
/*cvCmpS(img2,100,b,CV_CMP_LT);
cvAnd(b,d2,d2);*/
//printf("detected = %d\n ", lastdetected);
if (lastdetected>dects) THR= THR+1;
if (lastdetectedtotal; i++ )
{
CvPoint* p = (CvPoint*)cvGetSeqElem(li,i);
cvLine( imgc, p[0], p[1], CV_RGB(0,255,0), 1, CV_AA,0);

}

lastdetected = li->total;
cvShowImage("Image:",imgc); // show your image
cvShowImage("laplace",d2); // show your image

}


cvWaitKey();
cvDestroyWindow("Image:"); // close your console windows
cvReleaseImage(&img); // releases the memory allocated to an image

return 0;
}

Unknown said...

#include "math.h"

Arun said...

Could you also please upload the windows forms application that controls the rubiks bot - i am interested in building one.

thanks

Unknown said...

But My Rubik Robot still dont have a solving alogrithm, just using memory with color to solve the problem..
I used Arduino and motor servo for controler.
if u want, I will upload tomorrow.

Unknown said...

https://docs.google.com/open?id=0Bzm13VWqKhTvMk1GVEN4Nkd2bVE

Post a Comment