Autor Beitrag
barty
Hält's aus hier
Beiträge: 10



BeitragVerfasst: So 01.08.10 19:02 
Servus

hoffe bin im richtigen bereich gelandet.

wie kann ich, wenn ich einen bildausschnit von 10x10 pixel habe, diesen auf dem desktop suchen lassen und mit der maus zu den koordinaten springen.

schon mal danke für eventuelle hilfen
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: So 01.08.10 19:11 
Such mal nach dem Stichwort KreuzkorellationIst dfür zwar (wegen O(n^3) nicht unbedingt das Schnellste, aber sollte für einfache Dinge reichen.

_________________
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.
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: So 01.08.10 20:14 
Nicht, dass ich das empfehle aber effizient lässt es sich mit Faltung via Fourier Transformation erledigen. Dann wäre die Komplexität n^2 log n.

In Pseudo-Mathe irgend sowas wie:
MaxInd(Kreuzkorr(Bildschirm, Ausschnitt)) = MaxInd(Faltung(-Bildschirm, Ausschnitt)) = MaxInd(Fourier^-1(Fourier(-Bildschirm)*Fourier(Ausschnitt))))

Wobei MaxInd die Indizes (Koordinaten) am Maximum zurückgibt. Die Multiplikation versteht sich Komponentenweise im Frequenzraum (n^2).

Bei so kleinen Fensterchen (10x10) lohnt es sich vermutlich aber eher nicht.
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: So 01.08.10 22:15 
user profile iconBenBE hat folgendes geschrieben Zum zitierten Posting springen:
(wegen O(n^3) nicht unbedingt das Schnellste


Bin ich blöd? Du kannst doch einfach die Pixel alle einmal angucken (maximal). Damit wäre es O(n)...oder was ist bei dir n? ;) Wenn n bei dir die Fenstergröße ist, dann ist das verdammt schnell :shock:

Das wäre jetzt auch meine Lösung, da sie einfach ist. Guck dir die Pixel die Reihe nach an. Ist der betrachtete Pixel = Pixel 0/0 in deinem Fenster, guck ob die Pixel ausenrum dein Fenster matchen.

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mo 02.08.10 03:39 
ich hätt ne andere frage: wenn man 2 bilder hat, müssten ja zwei variablen da sein, oder? also zb (m*n)^3 oder so? weil zb bei Boyer-Moore oder KMP hat man ja auch 2 variablen. n für das suchwort und m für den text in dem gesucht werden soll. oder irre ich?

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Gerd Kayser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 632
Erhaltene Danke: 121

Win 7 32-bit
Delphi 2006/XE
BeitragVerfasst: Mo 02.08.10 15:36 
user profile iconbarty hat folgendes geschrieben Zum zitierten Posting springen:
wie kann ich, wenn ich einen bildausschnit von 10x10 pixel habe, diesen auf dem desktop suchen lassen und mit der maus zu den koordinaten springen.

Möchtest Du ein bestimmtes Icon auf dem Desktop suchen und anspringen?
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: Mo 02.08.10 15:58 
Naja, eigentlich sind es 4: Zwei Variablen je Bild, also jeweils Höhe und Breite.

Komplexität ganz naiv wäre dann:

(w1-w2+1)*(h1-h2+1)*(w2)*(h2)

Für w1=h1 und w2=h2 ergibt sich daraus:

(w1-w2+1)^2*(w2)^2

Sprich ganz naiv wäre man bei n^4 (ausmultipliziert); da es aber wie gesagt über die FFT bzw. ne Faltung nen Shortcut gibt, ist O(n^3) durchaus eine verwertbare obere Schranke. Habe ja auch nur behauptet, DASS es in O(n^3) geht, NICHT, dass es O(n^3) braucht ;-)

_________________
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.
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Mo 02.08.10 16:38 
user profile iconXion hat folgendes geschrieben Zum zitierten Posting springen:
Das wäre jetzt auch meine Lösung, da sie einfach ist. Guck dir die Pixel die Reihe nach an. Ist der betrachtete Pixel = Pixel 0/0 in deinem Fenster, guck ob die Pixel ausenrum dein Fenster matchen.

Jup, und genau das Ergibt dann die Rechnung von user profile iconBenBE.
Kann man noch etwas optimieren, indem man nicht jedes Pixel prüft, sondern über eine Art Quadtree mit Color-Lookup arbeitet. Aber wesentlich besser wirds tatsächlich nicht, solange man nur Pixel vergleicht.
Muss aber auch nicht, mit ScanLine und InMemoryPixmaps solle man das wohl schnell genug hinbekommen, damit die Anforderungen erfüllt werden.
Duct Tape Programming.

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Mo 02.08.10 17:12 
Zitat:
because otherwise they’d have to admit that they just don’t feel smart enough to use what would otherwise be a perfectly good programming technique FOR SPOCK.

:mrgreen:

Zitat:
Duct tape programmers don’t give a shit what you think about them. They stick to simple basic and easy to use tools and use the extra brainpower that these tools leave them to write more useful features for their customers.

Ganz meine Meinung. Aber ich glaub "Duct Tape Programming" ist jetzt keine Auszeichnung hier an der Technischen Universität :P

Naja, als Student vielleicht schon, pobody is nerfect ;)

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)