?
So ich bin weiter gekommen puhh!
Also mittlerweile kann ich eine Image einlesen und dann wieder speicher
Die Umrechnung von RGB zu HSV hab ich auch drin.
Ich weiß bloß nicht wie ich die RGB werte aus der Image bekomme und und dann wieder die HSV in die Image bekomme kann mir da jemand helfen?
Hier mein Code!
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int x, y;
double R, G, B, Max, Min, H, S, V, r, g, b;
unsigned char* pData;
// read the image
bool bSuccess = ReadBmp( "C:/P1000825.bmp", x, y, pData );
if ( bSuccess == false )
{
cout << "*Error loading image!*" << endl;
return 1;
}
cout<<"R Wert";
cin>>r;
cout<<"G Wert";
cin>>g;
cout<<"B Wert";
cin>>b;
R = r / 256.0;
G = g / 256.0;
B = b / 256.0;
if(R > G && R > B)Max = R;
if(G > R && G > B)Max = G;
if(B > G && B > R)Max = B;
if(R < G && R < B)Min = R;
if(G < R && G < B)Min = G;
if(B < G && B < R)Min = B;
if(R = Max)H = 0 + (G - B) / (Max - Min);
if(G = Max)H = 2 + (B - R) / (Max - Min);
if(B = Max)H = 4 + (R - G) / (Max - Min);
if(H < 0) H = H + 360;
S = (Max- Min) / Max;
V = Max;
cout<<H<< endl;
cout<<S<< endl;
cout<<V<< endl;
// write the image
if ( WriteBmp( "output.bmp", x, y, pData ) == false )
{
cout << "*Error writing image!*" << endl;
return 1;
}
fgetchar ();
return 0;
}