Autor Beitrag
DiggiDi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 60



BeitragVerfasst: Mo 28.07.03 00:45 
wie kann ich eine Image um 45° drehen?

danke im voraus
Eggi
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 33

Win 2000, Win XP
D7 Prof
BeitragVerfasst: Mo 28.07.03 09:52 
Hallo

Um ein Bild um einen beliebigen Winkel zu drehen, sind 2 verschiedene Vorgehensweisen möglich. Entweder zu bestimmst für jeden Bildpunkt des Ergebnisbildes den dazugehörigen Bildpunkt im Ausgangsbild oder du berechnest für jeden Bildpunkt im Ausgangsbild den Bildpunkt im Ergebnisbild.

Um für den zweiten Fall die neuen Bildpunktkoordinaten zu berechen kannst du folgende Formeln anwenden:

Xneu = cos a Xalt - sin a Yalt
Yneu = sin a Xalt + cos a Yalt

Da die berechneten Werte mit Sicherheit keine ganzzahligen Pixel Angaben sind, würde ich dir empfehlen die Farbe des Ausgangspixels, an die in Pixel in der Umgebung vom neuen Punkt gewichtet zu verteilen.

Für den ersten Fall müsstest du die Formeln dann dementsprechend Umstellen.

Eggi
ShadowThief
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278



BeitragVerfasst: Mo 28.07.03 10:38 
oder du schaust dir einfach mal die winapi-funktion PlgBlt an.

shadow.
teebee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 109


D6 Prof
BeitragVerfasst: Mo 28.07.03 16:04 
Eggi hat folgendes geschrieben:

Um ein Bild um einen beliebigen Winkel zu drehen, sind 2 verschiedene Vorgehensweisen möglich. Entweder zu bestimmst für jeden Bildpunkt des Ergebnisbildes den dazugehörigen Bildpunkt im Ausgangsbild oder du berechnest für jeden Bildpunkt im Ausgangsbild den Bildpunkt im Ergebnisbild.


Es ist allerdings nur die erste Vorgehensweise zu empfehlen ('Zurückrechnen'), da man sonst durch Rundungsfehler Löcher im Ergebnisbild bekommt.

Ciao, teebee
DiggiDi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 60



BeitragVerfasst: Mo 28.07.03 17:37 
@Eggi
tut mir leid ich versteh das überhaupt nicht
wie kann ich denn jedem pixel neue x und y position zuweisen?
teebee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 109


D6 Prof
BeitragVerfasst: Di 29.07.03 08:27 
Schau mal hier nach:

homepages.borland.co.../ImageProcessing.htm
(Abschnitt Bitmap Rotation)

Ciao, teebee