Excale wrote:Levak wrote:edit : par contre ça j'ai un doute : for (int j = 1 ; i = 31 ; i++)
En Basic j'aurais écrit: for i,1,31 step 1
Alors pourquoi tu initialises un j ? C'est un i que tu veux, sinon, le i il vaut déjà une certaine valeur non ?
Excale wrote:Levak wrote:edit : par contre ça j'ai un doute : for (int j = 1 ; i = 31 ; i++)
En Basic j'aurais écrit: for i,1,31 step 1
Levak wrote:Alors pourquoi tu initialises un j ? C'est un i que tu veux, sinon, le i il vaut déjà une certaine valeur non ?
#include iostream
#include fstream
#include string
#include SFML/System.hpp
#include SFML/Graphics.hpp
using namespace std;
void BMPXML()
{
ofstream xmlfile("Problem1.xml", ios::out | ios::trunc); //déclaration du flux et ouverture du fichier
ifstream bmpfile("converted.bmp", ios::in); // on ouvre le fichier en lecture
if(bmpfile xmlfile) // si l'ouverture a réussi
{
char poubelle;
char bmpbrut;
xmlfile "?xml version=""1.0"" encoding=""UTF-8"" ?prob xmlns=""urn:TI.Problem"" ver=""1.0""syme t=""1"" f=""0""nx1/nv{";
for (int i = 0 ; i 54 ; i++) { bmpfile.get(poubelle); }
for (int i = 1 ; i = 7 ; i++)
{
if (i1)
{
xmlfile "-1}/v/ee t=""1"" f=""0""nx" i "/nv{";
}
for (int j = 1 ; j = 31 ; j++)
{
for (int k = 1 ; k = 318 ; k++)
{
if (bmpfile.get(poubelle) bmpfile.get(poubelle) bmpfile.get(bmpbrut))
{
if (bmpbrut==0)
{
xmlfile k ",";
}
}
}
bmpfile.get(poubelle);
bmpfile.get(poubelle);
}
}
bmpfile.close(); // on referme le fichier
}
else
cerr "Erreur à l'ouverture !" endl;
// Partie II
ifstream bmp2file("converted.bmp", ios::in); // on ouvre le fichier en lecture
if(bmp2file xmlfile) // si l'ouverture a réussi
{
char poubelle;
char bmpbrut;
xmlfile "-1}/v/ee t=""1"" f=""0""ny1/nv{";
for (int i = 0 ; i 54 ; i++) { bmpfile.get(poubelle); }
for (int i = 1 ; i = 6 ; i++)
{
if (i0)
{
xmlfile "-1}/v/ee t=""1"" f=""0""ny" (i + 1) "/nv{";
}
for (int j = 1 ; j = 31 ; j++)
{
for (int k = 1 ; k = 318 ; k++)
{
if (bmpfile.get(poubelle) bmpfile.get(poubelle) bmpfile.get(bmpbrut))
{
if (bmpbrut==0)
{
xmlfile (j + (i * 31)) ",";
}
}
}
bmpfile.get(poubelle);
bmpfile.get(poubelle);
}
}
xmlfile "-1}/v/e/symcard clay=""0"" h1=""10000"" h2=""10000"" w1=""10000"" w2=""10000""flag0/flagwdgt xmlns:gg=""urn:TI.GeoGrapher"" type=""TI.GeoGrapher"" ver=""1.0""gg:mFlags2048/gg:mFlagsgg:value1/gg:valuegg:anim_x10/gg:anim_xgg:anim_y35/gg:anim_ygg:figgg:ver3/gg:vergg:objsgg:axes_systemgg:id1/gg:idgg:axes_p/gg:axes_pgg:xorg50/gg:xorggg:yorg50/gg:yorggg:xuni0.34185/gg:xunigg:yuni0.34185/gg:yunigg:xmin-20/gg:xmingg:xmax20/gg:xmaxgg:ymin-10/gg:ymingg:ymax10/gg:ymaxgg:acol0/gg:acolgg:aast0/gg:aastgg:aazm4/gg:aazmgg:apth0/gg:apthgg:asho1/gg:ashogg:lbl/gg:lblgg:stat0/gg:stat/gg:axes_systemgg:axisgg:id2/gg:idgg:par1 /gg:pargg:xaxis/gg:xaxisgg:smrt2/gg:smrtgg:sm1-6.837/gg:sm1gg:sm26.837/gg:sm2gg:alco0/gg:alcogg:acst0/gg:acstgg:apst0/gg:apstgg:apth0/gg:apthgg:asho1/gg:ashogg:ales0/gg:alesgg:lblx/gg:lblgg:stat16/gg:stat/gg:axisgg:labelgg:id3/gg:idgg:par2 /gg:pargg:lbl_agg:t0.5/gg:tgg:dx0/gg:dxgg:dy0/gg:dy/gg:lbl_agg:chrs1 1 3 0 0 0 x/gg:chrsgg:deta0/gg:detagg:atta1/gg:attagg:x57.41200005/gg:xgg:y50.42499995/gg:ygg:atco0/gg:atcogg:afon0/gg:afongg:asho1/gg:ashogg:lbl/gg:lblgg:stat0/gg:stat/gg:labelgg:axisgg:id4/gg:idgg:par1 /gg:pargg:yaxis/gg:yaxisgg:smrt2/gg:smrtgg:sm1-3.4185/gg:sm1gg:sm23.4185/gg:sm2gg:alco0/gg:alcogg:acst0/gg:acstgg:apst0/gg:apstgg:apth0/gg:apthgg:asho1/gg:ashogg:ales0/gg:alesgg:lbly/gg:lblgg:stat16/gg:stat/gg:axisgg:labelgg:id5/gg:idgg:par4 /gg:pargg:lbl_agg:t0.5/gg:tgg:dx0/gg:dxgg:dy0/gg:dy/gg:lbl_agg:chrs1 1 3 0 0 0 y/gg:chrsgg:deta0/gg:detagg:atta1/gg:attagg:x49.82500005/gg:xgg:y54.59349995/gg:ygg:atco0/gg:atcogg:afon0/gg:afongg:asho1/gg:ashogg:lbl/gg:lblgg:stat0/gg:stat/gg:labelgg:gridgg:id6/gg:idgg:par1 /gg:pargg:grid_as/gg:grid_asgg:acol10066329/gg:acolgg:agst0/gg:agstgg:apth0/gg:apthgg:asho0/gg:ashogg:lbl/gg:lblgg:stat16/gg:stat/gg:gridgg:expressiongg:id7/gg:idgg:r_expr/gg:r_exprgg:expr{x1,y1}/gg:exprgg:prms/gg:prmsgg:lbls1/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id8/gg:idgg:par7 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id9/gg:idgg:r_expr/gg:r_exprgg:expr{x2,y2}/gg:exprgg:prms/gg:prmsgg:lbls2/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id10/gg:idgg:par9 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id11/gg:idgg:r_expr/gg:r_exprgg:expr{x3,y3}/gg:exprgg:prms/gg:prmsgg:lbls3/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id12/gg:idgg:par11 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id13/gg:idgg:r_expr/gg:r_exprgg:expr{x4,y4}/gg:exprgg:prms/gg:prmsgg:lbls4/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id14/gg:idgg:par13 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id15/gg:idgg:r_expr/gg:r_exprgg:expr{x5,y5}/gg:exprgg:prms/gg:prmsgg:lbls5/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id16/gg:idgg:par15 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id17/gg:idgg:r_expr/gg:r_exprgg:expr{x6,y6}/gg:exprgg:prms/gg:prmsgg:lbls6/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id18/gg:idgg:par17 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id19/gg:idgg:r_expr/gg:r_exprgg:expr{x7,y7}/gg:exprgg:prms/gg:prmsgg:lbls7/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id20/gg:idgg:par19 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plot/gg:objsgg:toolgg:ToolGraphergg:vis0/gg:visgg:dhs/gg:dhsgg:phs/gg:phsgg:shs*s1**s2**s3**s4**s5**s6**s7*/gg:shs/gg:ToolGraphergg:ToolScalegg:len20/gg:lengg:vis0/gg:vis/gg:ToolScale/gg:toolgg:anim1/gg:animgg:w100/gg:wgg:h100/gg:hgg:vpx42.05/gg:vpxgg:vpy54.6/gg:vpygg:geos1/gg:geosgg:geoucm/gg:geou/gg:fig/wdgt/card/prob";
bmpfile.close(); // on referme le fichier
}
else
cerr "Erreur à l'ouverture !" endl;
xmlfile.close(); // on referme le fichier
}
unsigned int toGrey1(sf::Color col)
{
unsigned char ret;
ret = (unsigned int) (0.299 * (float) col.r + 0.587 * (float) col.g + 0.114 * (float) col.b);
return ret 7;
}
unsigned int round(float x)
{
unsigned int ret = (unsigned int) x;
if(x - (float) ret = 0.5)
ret ++;
return ret;
}
int main(int argc, char **argv)
{
if(argc != 2)
{
cout "Converts an image into a BW 318*212 24bpp BMP" endl;
cout "Usage: IMG2BMP input_file" endl;
return 0;
}
sf::Image img, dst;
float xFactor, yFactor;
if(!img.LoadFromFile(argv[1]))
{
cout "Erreur: impossible d'ouvrir le fichier d'entree: "" argv[2] """ endl;
return 0;
}
xFactor = img.GetWidth() / 318.f;
yFactor = img.GetHeight() / 212.f;
dst.Create(318,212, sf::Color::White);
for(unsigned int i = 0; i 318; i ++)
for(unsigned int j = 0; j 212; j ++)
dst.SetPixel(i, j, toGrey1(img.GetPixel(round((float)i * xFactor), round((float) j * yFactor))) ? sf::Color::White : sf::Color::Black);
dst.SaveToFile("./converted.bmp");
BMPXML();
return 0;
}
#include iostream
#include fstream
#include string
#include SFML/System.hpp
#include SFML/Graphics.hpp
using namespace std;
void BMPXML()
{
ofstream xmlfile("Problem1.xml", ios::out | ios::trunc); //déclaration du flux et ouverture du fichier
ifstream bmpfile("converted.bmp", ios::in); // on ouvre le fichier en lecture
if(bmpfile xmlfile) // si l'ouverture a réussi
{
char poubelle;
char bmpbrut;
xmlfile "?xml version="1.0" encoding="UTF-8" ?prob xmlns="urn:TI.Problem" ver="1.0"syme t="1" f="0"nx1/nv{";
for (int i = 0 ; i 54 ; i++) { bmpfile.get(poubelle); }
for (int i = 1 ; i = 7 ; i++)
{
if (i1)
{
xmlfile "-1}/v/ee t="1" f="0"nx" i "/nv{";
}
for (int j = 1 ; j = 31 ; j++)
{
for (int k = 1 ; k = 318 ; k++)
{
if (bmpfile.get(poubelle) bmpfile.get(poubelle) bmpfile.get(bmpbrut))
{
if (bmpbrut==0)
{
xmlfile k ",";
}
}
}
bmpfile.get(poubelle);
bmpfile.get(poubelle);
}
}
bmpfile.close(); // on referme le fichier
}
else
cerr "Erreur à l'ouverture !" endl;
// Partie II
ifstream bmp2file("converted.bmp", ios::in); // on ouvre le fichier en lecture
if(bmp2file xmlfile) // si l'ouverture a réussi
{
char poubelle;
char bmpbrut;
xmlfile "-1}/v/ee t="1" f="0"ny1/nv{";
for (int i = 0 ; i 54 ; i++) { bmp2file.get(poubelle); }
for (int i = 0 ; i = 6 ; i++)
{
if (i0)
{
xmlfile "-1}/v/ee t="1" f="0"ny" (i + 1) "/nv{";
}
for (int j = 1 ; j = 31 ; j++)
{
for (int k = 1 ; k = 318 ; k++)
{
if (bmp2file.get(poubelle) bmp2file.get(poubelle) bmp2file.get(bmpbrut))
{
if (bmpbrut==0)
{
xmlfile (j + (i * 31)) ",";
}
}
}
bmp2file.get(poubelle);
bmp2file.get(poubelle);
}
}
xmlfile "-1}/v/e/symcard clay="0" h1="10000" h2="10000" w1="10000" w2="10000"flag0/flagwdgt xmlns:gg="urn:TI.GeoGrapher" type="TI.GeoGrapher" ver="1.0"gg:mFlags2048/gg:mFlagsgg:value1/gg:valuegg:anim_x10/gg:anim_xgg:anim_y35/gg:anim_ygg:figgg:ver3/gg:vergg:objsgg:axes_systemgg:id1/gg:idgg:axes_p/gg:axes_pgg:xorg50/gg:xorggg:yorg50/gg:yorggg:xuni0.34185/gg:xunigg:yuni0.34185/gg:yunigg:xmin-20/gg:xmingg:xmax20/gg:xmaxgg:ymin-10/gg:ymingg:ymax10/gg:ymaxgg:acol0/gg:acolgg:aast0/gg:aastgg:aazm4/gg:aazmgg:apth0/gg:apthgg:asho1/gg:ashogg:lbl/gg:lblgg:stat0/gg:stat/gg:axes_systemgg:axisgg:id2/gg:idgg:par1 /gg:pargg:xaxis/gg:xaxisgg:smrt2/gg:smrtgg:sm1-6.837/gg:sm1gg:sm26.837/gg:sm2gg:alco0/gg:alcogg:acst0/gg:acstgg:apst0/gg:apstgg:apth0/gg:apthgg:asho1/gg:ashogg:ales0/gg:alesgg:lblx/gg:lblgg:stat16/gg:stat/gg:axisgg:labelgg:id3/gg:idgg:par2 /gg:pargg:lbl_agg:t0.5/gg:tgg:dx0/gg:dxgg:dy0/gg:dy/gg:lbl_agg:chrs1 1 3 0 0 0 x/gg:chrsgg:deta0/gg:detagg:atta1/gg:attagg:x57.41200005/gg:xgg:y50.42499995/gg:ygg:atco0/gg:atcogg:afon0/gg:afongg:asho1/gg:ashogg:lbl/gg:lblgg:stat0/gg:stat/gg:labelgg:axisgg:id4/gg:idgg:par1 /gg:pargg:yaxis/gg:yaxisgg:smrt2/gg:smrtgg:sm1-3.4185/gg:sm1gg:sm23.4185/gg:sm2gg:alco0/gg:alcogg:acst0/gg:acstgg:apst0/gg:apstgg:apth0/gg:apthgg:asho1/gg:ashogg:ales0/gg:alesgg:lbly/gg:lblgg:stat16/gg:stat/gg:axisgg:labelgg:id5/gg:idgg:par4 /gg:pargg:lbl_agg:t0.5/gg:tgg:dx0/gg:dxgg:dy0/gg:dy/gg:lbl_agg:chrs1 1 3 0 0 0 y/gg:chrsgg:deta0/gg:detagg:atta1/gg:attagg:x49.82500005/gg:xgg:y54.59349995/gg:ygg:atco0/gg:atcogg:afon0/gg:afongg:asho1/gg:ashogg:lbl/gg:lblgg:stat0/gg:stat/gg:labelgg:gridgg:id6/gg:idgg:par1 /gg:pargg:grid_as/gg:grid_asgg:acol10066329/gg:acolgg:agst0/gg:agstgg:apth0/gg:apthgg:asho0/gg:ashogg:lbl/gg:lblgg:stat16/gg:stat/gg:gridgg:expressiongg:id7/gg:idgg:r_expr/gg:r_exprgg:expr{x1,y1}/gg:exprgg:prms/gg:prmsgg:lbls1/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id8/gg:idgg:par7 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id9/gg:idgg:r_expr/gg:r_exprgg:expr{x2,y2}/gg:exprgg:prms/gg:prmsgg:lbls2/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id10/gg:idgg:par9 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id11/gg:idgg:r_expr/gg:r_exprgg:expr{x3,y3}/gg:exprgg:prms/gg:prmsgg:lbls3/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id12/gg:idgg:par11 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id13/gg:idgg:r_expr/gg:r_exprgg:expr{x4,y4}/gg:exprgg:prms/gg:prmsgg:lbls4/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id14/gg:idgg:par13 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id15/gg:idgg:r_expr/gg:r_exprgg:expr{x5,y5}/gg:exprgg:prms/gg:prmsgg:lbls5/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id16/gg:idgg:par15 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id17/gg:idgg:r_expr/gg:r_exprgg:expr{x6,y6}/gg:exprgg:prms/gg:prmsgg:lbls6/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id18/gg:idgg:par17 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plotgg:expressiongg:id19/gg:idgg:r_expr/gg:r_exprgg:expr{x7,y7}/gg:exprgg:prms/gg:prmsgg:lbls7/gg:lblgg:stat73744/gg:stat/gg:expressiongg:scatter_plotgg:id20/gg:idgg:par19 1 /gg:pargg:scat_e/gg:scat_egg:acol0/gg:acolgg:asho1/gg:ashogg:adst6/gg:adstgg:adcn0/gg:adcngg:apac-255 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 /gg:apacgg:lbl/gg:lblgg:stat0/gg:stat/gg:scatter_plot/gg:objsgg:toolgg:ToolGraphergg:vis0/gg:visgg:dhs/gg:dhsgg:phs/gg:phsgg:shs*s1**s2**s3**s4**s5**s6**s7*/gg:shs/gg:ToolGraphergg:ToolScalegg:len20/gg:lengg:vis0/gg:vis/gg:ToolScale/gg:toolgg:anim1/gg:animgg:w100/gg:wgg:h100/gg:hgg:vpx42.05/gg:vpxgg:vpy54.6/gg:vpygg:geos1/gg:geosgg:geoucm/gg:geou/gg:fig/wdgt/card/prob";
bmp2file.close(); // on referme le fichier
}
else
cerr "Erreur à l'ouverture !" endl;
xmlfile.close(); // on referme le fichier
}
unsigned int toGrey1(sf::Color col)
{
unsigned char ret;
ret = (unsigned int) (0.299 * (float) col.r + 0.587 * (float) col.g + 0.114 * (float) col.b);
return ret 7;
}
unsigned int round(float x)
{
unsigned int ret = (unsigned int) x;
if(x - (float) ret = 0.5)
ret ++;
return ret;
}
int main(int argc, char **argv)
{
if(argc != 2)
{
cout "Converts an image into a BW 318*212 24bpp BMP" endl;
cout "Usage: IMG2BMP input_file" endl;
return 0;
}
sf::Image img, dst;
float xFactor, yFactor;
if(!img.LoadFromFile(argv[1]))
{
cout "Erreur: impossible d'ouvrir le fichier d'entree: "" argv[2] """ endl;
return 0;
}
xFactor = img.GetWidth() / 318.f;
yFactor = img.GetHeight() / 212.f;
dst.Create(318,212, sf::Color::White);
for(unsigned int i = 0; i 318; i ++)
for(unsigned int j = 0; j 212; j ++)
dst.SetPixel(i, j, toGrey1(img.GetPixel(round((float)i * xFactor), round((float) j * yFactor))) ? sf::Color::White : sf::Color::Black);
dst.SaveToFile("./converted.bmp");
BMPXML();
return 0;
}
critor2000 wrote:Est-il possible que le programme soit releasé d'ici le courant de la semaine prochaine, afin de participer aux TI-Bank Awards 2010 ?
Excale wrote:critor2000 wrote:Est-il possible que le programme soit releasé d'ici le courant de la semaine prochaine, afin de participer aux TI-Bank Awards 2010 ?
J'y ai pensé mais vu qu'il n'a pas grande réputation pour le moment, je ne sais pas si c'est le meilleur choix.
critor2000 wrote:C'est quand même une chance de te faire "bien" connaître, puisqu'un lien vers ton programme sera disponible en permanence sur le portail pendant toute la durée des TI-Bank Awards, c'est-à-dire plusieurs semaines!
Users browsing this forum: ClaudeBot [spider] and 2 guests