Hallo Xtreme,
Der Algothmus für die Positionsbestimmung ist folgender:könnt ihr das mir dem Farb/Flächenschwerpunkt mal genauer erklähren?
Wäre ne große Hilfe, brauch sowas nämlich grad in Delphi...
1. Alle Farbpunkte auf gleiche Helligkeit bringen
2. Den Rot-Anteil nehmen mit einem Grenzwert vergleichen
3. Die Punkte, die über dem Grenzwert liegen in ein binäres Schwarz/Weisbild übertragen
4. Den Flächenschwerpunkt im Binärbild berechnen.
Hier das SCILAB Scibt für die Berechnung des Schwerpunktes einer Matrix. Wenn Du weist, wie man Matrizen mit Vektoren multipliziert, sollte das kein Problem sein, in Delphi umzusetzen.
Gruss,Code:function [rowcp,columcp]=centroid(mat) // // calculate the centerof a matrix // // // $Revision: 1.0 $ $Date: 2006/04/01 nx=length(mat(:,1)); // nx=number of rows ny=length(mat(1,:)); // ny=number of colums gx=1:nx; // create vektor x=1,2,3..nx gy=1:ny; // create vektor x=1,2,3..ny summat=sum(mat); // calculate sum of all elements if summat==0, // if summat=0 then the result is not defined columcp=0; rowcp=0; else columcp=sum(mat*gy')/summat; // calculate colum center point rowcp=sum(gx*mat)/summat; // calculate row center point end endfunction // // ------------------------------------------------------------------------- // This file ist made for scilab the free mathematical toolbox // // Copyright (C) 2006 stochri // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // ------------------------------------------------------------------------- //
stochri







Zitieren

Lesezeichen