Click here to Skip to main content
15,888,610 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Threshholding ? Pin
David Crow24-Apr-07 3:39
David Crow24-Apr-07 3:39 
QuestionLoop Pin
MoustafaS21-Apr-07 9:21
MoustafaS21-Apr-07 9:21 
GeneralRe: Loop Pin
MoustafaS21-Apr-07 10:27
MoustafaS21-Apr-07 10:27 
AnswerRe: Loop Pin
Frank Kerrigan2-May-07 5:45
Frank Kerrigan2-May-07 5:45 
QuestionImage Recognition Algorithm Pin
softwaremonkey19-Apr-07 5:42
softwaremonkey19-Apr-07 5:42 
AnswerRe: Image Recognition Algorithm Pin
Luc Pattyn19-Apr-07 6:24
sitebuilderLuc Pattyn19-Apr-07 6:24 
AnswerRe: Image Recognition Algorithm Pin
Nathan Addy19-Apr-07 7:14
Nathan Addy19-Apr-07 7:14 
AnswerRe: Image Recognition Algorithm [modified] Pin
Rilhas19-May-07 9:43
Rilhas19-May-07 9:43 
Some ideas given here seem good, but they will tend to be computationally heavy. My work involves real time image processing in many domains, and in general most algorithms that are called "transform" are usually unacceptably slow (even for modern computers or DSP's). This, of course, depends on wether or not you can distribute the algorithm through various machines. In general I can't.

Anyway, without more details on your case I simply imagine white sheets of paper with concentric circles drawn in them. If this is the case then finding the center is a very fast and efficient operation.

Simply compute the mass center of all "pen" pixels. For example, if they are black then just sum the positions where you find them (keep X and Y separate) and in the end just divide the result by the image size. For example:

mass_center_x=0;
mass_center_y=0;
total_found=0;
for(y=0; y<image_size_y; y++) {
for(x=0; x<image_size_x; x++) {
if (Pixel(x, y)==BLACK) {
mass_center_x+=x;
mass_center_y+=y;
total_found++;
}
}
}
if (total_found>0) {
mass_center_x/=total_found;
mass_center_y/=total_found;
}

At this point the "mass_center_x" and "mass_center_y" contain the coordinates of the center of the concentric circles. This algorithm is very fast because each pixel is analyzed only once, and so runs in an amount of time directly proportional to the number of pixels. Also note that Y is the outer loop so as to exploit the CPU cache in the most efficient manner.

I hope this helps,
Rilhas



-- modified at 8:28 Sunday 20th May, 2007
Questionhelp genetic algo Pin
clemzug15-Apr-07 1:12
clemzug15-Apr-07 1:12 
AnswerRe: help genetic algo Pin
cp987615-Apr-07 2:31
cp987615-Apr-07 2:31 
GeneralRe: help genetic algo Pin
clemzug15-Apr-07 2:44
clemzug15-Apr-07 2:44 
GeneralRe: help genetic algo Pin
cp987615-Apr-07 16:01
cp987615-Apr-07 16:01 
GeneralRe: help genetic algo Pin
Tim Craig15-Apr-07 18:08
Tim Craig15-Apr-07 18:08 
QuestionAnswer for this algorithm Pin
MoustafaS13-Apr-07 4:24
MoustafaS13-Apr-07 4:24 
AnswerRe: Answer for this algorithm Pin
CPallini13-Apr-07 4:37
mveCPallini13-Apr-07 4:37 
GeneralRe: Answer for this algorithm Pin
MoustafaS13-Apr-07 4:40
MoustafaS13-Apr-07 4:40 
AnswerRe: Answer for this algorithm [modified] Pin
Leslie Sanford13-Apr-07 4:46
Leslie Sanford13-Apr-07 4:46 
AnswerRe: Answer for this algorithm Pin
cp987613-Apr-07 4:47
cp987613-Apr-07 4:47 
GeneralRe: Answer for this algorithm Pin
MoustafaS13-Apr-07 4:51
MoustafaS13-Apr-07 4:51 
GeneralRe: Answer for this algorithm Pin
cp987613-Apr-07 4:59
cp987613-Apr-07 4:59 
GeneralRe: Answer for this algorithm Pin
MoustafaS13-Apr-07 5:02
MoustafaS13-Apr-07 5:02 
QuestionSkip List Indexing Pin
Leslie Sanford12-Apr-07 5:55
Leslie Sanford12-Apr-07 5:55 
AnswerRe: Skip List Indexing Pin
Luc Pattyn12-Apr-07 9:30
sitebuilderLuc Pattyn12-Apr-07 9:30 
GeneralRe: Skip List Indexing Pin
Leslie Sanford12-Apr-07 10:44
Leslie Sanford12-Apr-07 10:44 
QuestionThe Perfect Circle Pin
Bassam Abdul-Baki10-Apr-07 4:15
professionalBassam Abdul-Baki10-Apr-07 4:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.