Autor Beitrag
klezmor
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Mo 26.02.07 19:17 
Hallo ich programmiere zur Zeit an einem Bildverarbeitungsprogramm.
Programmiersprache ist C++/OpenCV(Bildverarbeitungsbibliothek)--> kann ich nur empfehlen, leider gibts sowas nicht für delphi :cry:
Aufjedenfall kann mein programm bis jetzt einzelne Konturen erkennen.
Wenn mehrere Konturen aneinander liegen, sollen diese mit einer linie umrandet werden und dann als polygon gespeichert werden, letzteres ist abdingbar.

Schaut euch einfach das Bild an, ist denke ich mal selbsterklärend.
Praktisch gesehen ist dieser Algorithmus sozusagen eine Annäherung.

Meine Frage lautet nun, gibt es möglicherweise schon einen Algorithmus(muss nicht unbedingt implementiert sein), der dieses problem löst, denke mal, das ist ein rein algorithmisches Problem.

Vielen Dank im Voraus

MFG Klezmor.
Einloggen, um Attachments anzusehen!
_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
klezmor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Mo 26.02.07 21:41 
Vielleicht nochmal um es eindeutiger zu sagen die erste kontur wird angegeben(deren Koordinaten sind bekannt), diese befindet isch in einer kette mit anderen konturen, sprich die nächstliegenden werden erkannt und ein polygon gebildet.Wenn ich das problem noch weiter präzisieren soll, könnt ihr mir das natürlich auch sagen.

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
klezmor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Di 27.02.07 18:24 
Niemand da der mir hilfen könnte?

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
klezmor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Mi 28.02.07 16:01 
Noch habe ich die hoffnung nihct augegeben.

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Mi 28.02.07 16:09 
Also einen fertigen Algorithmus kenne ich nicht!
Wie funktionierte der Algorithmus her denn in C (also ich will kein Code sehn, erklär einfach mal das Prinzip)
Soll das ganze für beliebige Polygone gelten oder WIE IM BILD nur für Rechtecke ?

So können wir dir vll helfen.

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
klezmor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Mi 28.02.07 18:15 
Wie ihr auf dem bild sehen könnt, sind einige konturen weiter auseinander, einige konturen liegen auf einer scheinbaren linie, nämlich die in der Mitte, wobei die Position natürlich beliebig sein kann.
Mit der Maus klicke ich nun auf eine Kontur meiner Wahl und das programm soll die konturen finden, welche mit der ausgewählten kontur eine line bilden.Konturen sind die Farbigen 4 ecke, wobei deren Form natürlich nicht immer rechteckig ist(-->Paint).

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mi 28.02.07 21:20 
Naja, mir viele da jetzt auf Die Schnelle ein Probalistischer Vorschlag ein:
Bilde für Teilmengen K' aus K, die die Konturen k aus K enthalten (ich liebe Mathe ;-)) die Regressionsgleichung (lineare Regression, willst ja Linien ;-)) und wähle daraus die Teilmenge K', deren Regressionsgenauigkeit am höchsten ist UND, die die meisten Elemente k aus K enthält.

Klingt kompliziert, ist aber relativ einfach, wenn Du die Konturen mal als einfache Punkte auf dem Bild betrachtest. Ich denke, Du solltest mit dem Hinweis sehen, was ich meine ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
klezmor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Mi 28.02.07 22:04 
So was in der art hatte ich mir auch vorgestellt, allerdings scheint die lineare regression nicht unbedingt geeignet dafür zu sein. Schließlich könnten die gesuchten konturen auch theoretisch in einem kreis angeordnet sein.
So dass keinerlei regression mehr möglich wäre.
(Wenn ich das richtig verstanden habe.)

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mi 28.02.07 22:07 
Im Endeffekt musst Du deinem Algorithmus ja eh (per Definition eines Algorithmus) auf seine Aufgabe festlegen. Du kannst also nicht gleichzeitig Kreise UND Linien erkennen, sei denn, Du findest eine Möglichkeit, beide eindeutig über eine Vorschrift zu beschreiben.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
klezmor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: So 18.03.07 15:44 
So eine Vorschrift gibt es theoretisch natürlich schon, ich als Mensch könnte zumindest eine solche Klassifikation vornehmen.

Ich habe mich jetzt dazu entschieden dies über verschiedene Regressionen zu machen.
Weiß jemand wie man eine Regression, sei es linear oder irgendwie polynominal, implementiert.(Geht doch irgendwie mit den kleinsten Fehlerquadraten oder so)

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
kkausp
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 77
Erhaltene Danke: 1

W2K, WIN XP, WIN XPe; WIN7
(D1;D2;D5;) D6 Ent.; D2009 Ent.
BeitragVerfasst: So 18.03.07 21:03 
1. Um die nahebeieinanderliegenden Strukturen zu verbinden nutzt man mophorlogische Filter

-Erosion
-Dilation
-Öffnen
-Schliessen

Damit kannst du die die rechtecke in der Mitte erstmals verbinden.

2. Wegwerfen aller Flächen mit Flächeninhalt<Grenze oder maximaler Länge <Grenze?

3. Bilden der konvexe Hülle eine Punktwolke (hier existiert ein Algo)
klezmor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Fr 23.03.07 12:39 
Also Schritte 1 und 2 habe ich schon gemacht, jetzt muss ich nur noch die besagte konvexhülle bilden, allerdings, würde ich da am liebsten auf die OpenCv bibliothek zurückgreifen, glaube da gibt es sogar schon ähnliche algorithmen, muss mich allerdings nochmal kundig machen. Die Anwendung der Funktionen ist teilweise ziemlich verwirrend.

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
kkausp
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 77
Erhaltene Danke: 1

W2K, WIN XP, WIN XPe; WIN7
(D1;D2;D5;) D6 Ent.; D2009 Ent.
BeitragVerfasst: Sa 24.03.07 12:59 
Titel: Polygon oder konvexe Hülle Gesucht?
Unter

www.iti.fh-flensburg...thmen/geo/graham.htm

Ist es gut beschrieben.

Du kanns in Bild noch alle Punkte vorher entfernen, welche nicht mindestens 4 Hintergrund punkt in der 8-Umgebung haben. Diese können glaube ich nicht eckepunkte der nonvexe Hülle sein und solten dann den Algo beschleunigen.


Hast du die Schritte 1 und 2 im Bild auf Pixelebene oder analytisch in Koordinaten (die hattest du ja als Ausgangngspunkt) gemacht?