AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Hough transformation for Kreise

Ein Thema von bernhard_LA · begonnen am 24. Dez 2010 · letzter Beitrag vom 28. Dez 2011
Antwort Antwort
Benutzerbild von Corpsman
Corpsman

Registriert seit: 8. Nov 2005
Ort: nähe Stuttgart
981 Beiträge
 
Delphi XE2 Professional
 
#1

AW: Hough transformation for Kreise

  Alt 26. Dez 2010, 11:38
So, ich habe mal das Java Ding nach Lazarus "portiert", da ich ja kein Delphi mehr habe.

Ich habe aber extra keine LCL spezifischen Sachen benutzt.

Du müsstest relativ einfach mein "gewerksel" nach Delphi portieren können.

Im Zip ebenfalls die Ausgabe des Akkumulators für "basic.bmp"

Die ganzen 1D Sachen sind nur weil Java ( wie alle C ähnlichen Dinge ) so bescheiden mit 2D-Arrays umgeht. Die Portierung in 2D-Arrays sollte aber kein Problem für dich darstellen.
Angehängte Dateien
Dateityp: zip Hough_Circle.zip (71,6 KB, 39x aufgerufen)
Uwe
My Sitewww.Corpsman.de

My marble madness clone Balanced ( ca. 70,0 mb ) aktuell ver 2.01
  Mit Zitat antworten Zitat
bernhard_LA

Registriert seit: 8. Jun 2009
Ort: Bayern
1.141 Beiträge
 
Delphi 11 Alexandria
 
#2

AW: Hough transformation for Kreise

  Alt 30. Dez 2010, 07:33
Danke für die schnelle Hilfe, der Port in eine 2D Array analog zur Linienerkennung ist fertig.

Ich kann zwar den Akku vom TestBild reproduzieren bei vielen anderen Testbeispielen bekomme ich aber kein sinnvolles Ergebnis



///
/// Hough transformation for circle detection
///
///
/// AnalysisBitmap : TBitMap; -> the image for hough tranmsformation
/// aHoughResult : THoughResult -> the result of the Hough transformation array of array of integer
/// r : Integer; -> the search radius
///
///


procedure Hough_CircleDetection ( AnalysisBitmap : TBitMap; var aHoughResult : THoughResult ; r : Integer );
var x,y, x0,y0 : integer;
ImageWidth : integer;
ImageHeight : Integer;
max_d : Integer;
help : Real;
theta : Integer;
max_theta : Integer;
Box_LL : FPoint;
Box_UR : FPoint;
TestPoint : TPoint;
begin


/// size of hough array
ImageWidth := AnalysisBitmap.Width;
ImageHeight:= AnalysisBitmap.Height;

///
Box_LL.X := 0;
Box_UR.y := 0;

Box_UR.X := ImageWidth;
Box_UR.Y := ImageHeight;

max_theta := 360;
// a // b
SetLength(aHoughResult,ImageWidth, ImageHeight );

// For all rows in image:
for y:=0 to AnalysisBitmap.Height-1 do
begin

// For all pixel in one row :
for x:=0 to AnalysisBitmap.Width-1 do
begin

// Is there a point ?
if IsPixel(x,y, AnalysisBitmap, 128 ) then
begin

for theta:=0 to max_theta do
begin

TestPoint.x := round ( x - r * cos(theta*PI/max_theta) );
TestPoint.y := round ( y - r * sin(theta*PI/max_theta));

// if IsPointInBox( Box_LL , Box_UR, testPoint ) then Inc(aHoughResult[x,y]);

if ((testPoint.x < ImageWidth) and (testPoint.x > 0 ) and
(testPoint.y < ImageHeight ) and (testPoint.y > 0 ) ) then Inc(aHoughResult[TestPoint.x,TestPoint.y]);

end;
end;
end;
end;


end
  Mit Zitat antworten Zitat
Benutzerbild von Corpsman
Corpsman

Registriert seit: 8. Nov 2005
Ort: nähe Stuttgart
981 Beiträge
 
Delphi XE2 Professional
 
#3

AW: Hough transformation for Kreise

  Alt 30. Dez 2010, 09:27
1. Bitte nutze Code Tags
2.
ich hatte auch so meine Schwierigkeiten vernünftige Akkus zu erzeugen. Das Hauptproblem ist hierbei der Radius. Eigentlich müsstest du alle Radien, von 2 bis sqrt( sqr(image.width) + sqr(image.height))/2 testen. Und alle Ergebnisse hieraus "vereinigen". Was die Kreis Houghtransformation ein klein wenig "aufwendig macht .
Uwe
My Sitewww.Corpsman.de

My marble madness clone Balanced ( ca. 70,0 mb ) aktuell ver 2.01
  Mit Zitat antworten Zitat
bernhard_LA

Registriert seit: 8. Jun 2009
Ort: Bayern
1.141 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: Hough transformation for Kreise

  Alt 30. Dez 2010, 11:38
unter
http://translate.google.de/translate...eexchange/9898

die Hough circle detection für Bilder mit unbekannten Radius , der Akku gleicht meinem ersten Vorschlag, nur habe ich bisher den Fehler im ersten Akku nicht gefunden


so ein 3D Integer Array für ein Bild mit 1000 x 1000 Pixel und Radius 1 ... 1000 sind 10E9 Zahlen ....

in Matlab speichern sie nur die Pixel im Bild in einer AusgangsMatrix ab :

totalpix = Länge (x);



und dann den Hough Accu dimensioniert nach Bedarf :



" Construct the Hough Matrix of 50 layers "
....
val = ones(length(ind),1); val = Ones (Länge (ind), 1);
data=accumarray(ind,val); data = accumarray (ind, val);
....

Geändert von bernhard_LA (30. Dez 2010 um 12:28 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von Corpsman
Corpsman

Registriert seit: 8. Nov 2005
Ort: nähe Stuttgart
981 Beiträge
 
Delphi XE2 Professional
 
#5

AW: Hough transformation for Kreise

  Alt 30. Dez 2010, 16:53
Damit übersteigt das ganze meinen Wissenshorizont ..

Evtl hilft dir jemand in einem Mathematiker Forum weiter.

An deiner Stelle würde ich das Ding eh komplett von 0 Anfangen und dann selbst Programmieren, dann weist du auch sicher woran es hackt, wenn es hackt.

Sry das ich nicht mehr weiterhelfen kann.
Uwe
My Sitewww.Corpsman.de

My marble madness clone Balanced ( ca. 70,0 mb ) aktuell ver 2.01
  Mit Zitat antworten Zitat
grizzly

Registriert seit: 10. Dez 2004
150 Beiträge
 
Delphi XE4 Professional
 
#6

AW: Hough transformation for Kreise

  Alt 30. Dez 2010, 17:20
Hab mir jetzt den Code hier nicht angesehen, wollte lediglich auf ein verwandtes Thema in einem anderen Forum verweisen: Linien und Kreise erkennen.
Zumindest für simple Kreise (schwarz auf weißem Untergrund, Mittelpunkt innerhalb des Bildes), hat das Ding ganz gut funktioniert.
(Habe allerdings festgestellt, daß mein Hough-Code-Anhang dort (Gummibär, Grizzly war weg) irgendwie nicht ganz vollständig ist - vermutlich gezippt und noch nicht gespeichert )

Gruß
Michael
  Mit Zitat antworten Zitat
bernhard_LA

Registriert seit: 8. Jun 2009
Ort: Bayern
1.141 Beiträge
 
Delphi 11 Alexandria
 
#7

AW: Hough transformation for Kreise

  Alt 28. Dez 2011, 10:34
PS: meinen code gibt es jetzt auf Source forge zum Download und zum Verbessern
  Mit Zitat antworten Zitat
Benutzerbild von BUG
BUG

Registriert seit: 4. Dez 2003
Ort: Cottbus
2.094 Beiträge
 
#8

AW: Hough transformation for Kreise

  Alt 28. Dez 2011, 10:44
PS: meinen code gibt es jetzt auf Source forge zum Download und zum Verbessern
Ich nehme mal an hier:
Falls es mal jemand sucht
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:24 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz