int main(int argc, char *argv[])
{
    PNMreader reader(argv[1]);

    Crop crop;
    crop.SetRegion(300, 1400, 50, 400);
    crop.SetInput(reader.GetOutput());

    Transpose t;
    t.SetInput(crop.GetOutput());

    Invert i;
    i.SetInput(t.GetOutput());

    Color color(50, 1101, 0, 0, 128);
    
    LRConcat lr;
    lr.SetInput(color.GetOutput());
    lr.SetInput2(i.GetOutput());

    Color white(401, 1101, 255, 255, 255);

    Checkerboard cb;
    cb.SetInput(lr.GetOutput());
    cb.SetInput2(white.GetOutput());

    cb.GetOutput()->Update();

    PNMwriter writer;
    writer.SetInput(cb.GetOutput());
    writer.Write(argv[2]);

    CheckSum cs;
    cs.SetInput(cb.GetOutput());
    cs.OutputCheckSum();
    Logger::Finalize();
}
Exemple #2
0
int main(int argc, char *argv[])
{
    if (argc < 2)
    {
        cerr << "Usage: " << argv[0] << " <username>" << endl;
        exit(EXIT_FAILURE);
    }

    char event[1024];
    sprintf(event, "Entered program from %s\n", argv[1]);
    Logger::LogEvent(event);

    /* START STUDENT MODIFIABLE SECTION */

    PNMreader reader("../images/puddles.pnm");

    Shrinker shrinker1;
    Shrinker shrinker2;

    LRConcat lrconcat1;
    LRConcat lrconcat2;

    TBConcat tbconcat1;
    TBConcat tbconcat2;

    Checkerboard blender;

    shrinker1.SetInput(reader.GetOutput());
    shrinker2.SetInput2(shrinker1.GetOutput());

    lrconcat1.SetInput(shrinker1.GetOutput());
    lrconcat1.SetInput2(shrinker2.GetOutput());

    tbconcat1.SetInput(shrinker1.GetOutput());
    tbconcat2.SetInput2(shrinker2.GetOutput());

    blender.SetInput(reader.GetOutput());
    blender.SetInput2(tbconcat1.GetOutput());    
        


    /* Make the image "finalImage" be the image at 
       the bottom of your pipeline */
    Image *finalImage = blender.GetOutput();

    /* END STUDENT MODIFIABLE SECTION */

    try 
    {
        finalImage->Update();
    }
    catch (DataFlowException &)
    {
        ofstream ofile("my_exception");
        if (ofile.fail())
        {
             cerr << "Something is wrong ... can't open my_exception"
                  << " for opening" << endl;
             exit(EXIT_FAILURE);
        }
        ofile << "Exception found!" << endl;
        exit(EXIT_SUCCESS);
    }

    CheckSum cs;
    cs.SetInput(finalImage);
    cs.OutputCheckSum("my_checksum");

    if (argc == 3)
    {
        PNMwriter writer;
        writer.SetInput(finalImage);
        writer.Write("3H.pnm");
    }
    Logger::Finalize();
}
Exemple #3
0
int main(int argc, char *argv[])
{
    if (argc < 2)
    {
        cerr << "Usage: " << argv[0] << " <username>" << endl;
        exit(EXIT_FAILURE);
    }

    char event[1024];
    sprintf(event, "Entered program from %s\n", argv[1]);
    Logger::LogEvent(event);

    /* START STUDENT MODIFIABLE SECTION */

    PNMreader reader1("../images/deschutes.pnm");
    PNMreader reader2("../images/question_marks.pnm");
    PNMreader reader3("../images/puddles.pnm");
    Color color1(75, 352, 200, 0, 0);
    Color color2(75, 352, 0, 0, 200);
    Color color3(1433, 100, 100, 0, 100);

    Crop crop1;
    crop1.SetRegion(0, 356, 0, 351);
    crop1.SetInput(reader1.GetOutput());

    LRConcat LRCon1;
    LRCon1.SetInput(crop1.GetOutput());
    LRCon1.SetInput2(color1.GetOutput());

    LRConcat LRCon2;
    LRCon2.SetInput(color2.GetOutput());
    LRCon2.SetInput2(reader2.GetOutput());

    Checkerboard blend1;
    blend1.SetInput(LRCon1.GetOutput());
    blend1.SetInput2(LRCon2.GetOutput());

    Checkerboard blend2;
    blend2.SetInput(LRCon1.GetOutput());
    blend2.SetInput2(LRCon2.GetOutput());

    TBConcat TBCon1;
    TBCon1.SetInput(blend1.GetOutput());
    TBCon1.SetInput2(blend2.GetOutput());

    Crop crop2;
    crop2.SetRegion(0, 1000, 100, 803);
    crop2.SetInput(reader3.GetOutput());

    LRConcat LRCon3;
    LRCon3.SetInput(TBCon1.GetOutput());
    LRCon3.SetInput2(crop2.GetOutput());

    TBConcat TBCon2;
    TBCon2.SetInput(LRCon3.GetOutput());
    TBCon2.SetInput2(color3.GetOutput());

    Invert invert;
    invert.SetInput(TBCon2.GetOutput());

    TBConcat s1;
    s1.SetInput(color3.GetOutput());
    s1.SetInput2(invert.GetOutput());

    /* Make the image "finalImage" be the image at 
       the bottom of your pipeline */
    Image *finalImage = s1.GetOutput();

    /* END STUDENT MODIFIABLE SECTION */

    try 
    {
        finalImage->Update();
    }
    catch (DataFlowException &)
    {
        ofstream ofile("my_exception");
        if (ofile.fail())
        {
             cerr << "Something is wrong ... can't open my_exception"
                  << " for opening" << endl;
             exit(EXIT_FAILURE);
        }
        ofile << "Exception found!" << endl;
        exit(EXIT_SUCCESS);
    }

    CheckSum cs;
    cs.SetInput(finalImage);
    cs.OutputCheckSum("my_checksum");

    if (argc == 3)
    {
        PNMwriter writer;
        writer.SetInput(finalImage);
        writer.Write("3H.pnm");
    }
    Logger::Finalize();
}
Exemple #4
0
int main(int argc, char *argv[])
{
    if (argc < 2)
    {
        cerr << "Usage: " << argv[0] << " <username>" << endl;
        exit(EXIT_FAILURE);
    }

    char event[1024];
    sprintf(event, "Entered program from %s\n", argv[1]);
    Logger::LogEvent(event);

    /* START STUDENT MODIFIABLE SECTION */

    PNMreader reader("../images/puddles.pnm");
    Color color(1786, 1344, 13,255 , 248);	
    Checkerboard b1;
    b1.SetInput(reader.GetOutput());
    b1.SetInput2(color.GetOutput());

    Color color2(1786, 1344, 255, 13, 102);
    Checkerboard b2;
    b2.SetInput(reader.GetOutput());
    b2.SetInput2(color2.GetOutput());

    LRConcat l1;
    l1.SetInput(b1.GetOutput());
    l1.SetInput2(b2.GetOutput());
    
    LRConcat l2;
    l2.SetInput(b2.GetOutput());
    l2.SetInput2(b1.GetOutput());

    TBConcat t1;
    t1.SetInput(l1.GetOutput());
    t1.SetInput2(l2.GetOutput()); 
    
    Shrinker s1;
    s1.SetInput(t1.GetOutput());

    Shrinker s2;
    s2.SetInput(t1.GetOutput());

    Shrinker s3;
    s3.SetInput(t1.GetOutput());

    Shrinker s4;
    s4.SetInput(t1.GetOutput());

    Invert i1;
    i1.SetInput(s2.GetOutput());

    Invert i2;
    i2.SetInput(s4.GetOutput());

    LRConcat l3;
    l3.SetInput(s1.GetOutput());
    l3.SetInput2(s2.GetOutput());

    LRConcat l4;
    l4.SetInput(s4.GetOutput());
    l4.SetInput2(s3.GetOutput());

    TBConcat t2;
    t2.SetInput(l3.GetOutput());
    t2.SetInput2(l4.GetOutput());

    Image *finalImage = t2.GetOutput();

    
    /* END STUDENT MODIFIABLE SECTION */

    try 
    {
        finalImage->Update();
    }
    catch (DataFlowException &)
    {
        ofstream ofile("my_exception");
        if (ofile.fail())
        {
             cerr << "Something is wrong ... can't open my_exception"
                  << " for opening" << endl;
             exit(EXIT_FAILURE);
        }
        ofile << "Exception found!" << endl;
        exit(EXIT_SUCCESS);
    }

    CheckSum cs;
    cs.SetInput(finalImage);
    cs.OutputCheckSum("my_checksum");

    if (argc == 3)
    {
        PNMwriter writer;
        writer.SetInput(finalImage);
        writer.Write("3H.pnm");
    }
    Logger::Finalize();
}
Exemple #5
0
int main(int argc, char *argv[])
{
    if (argc < 2)
    {
        cerr << "Usage: " << argv[0] << " <username>" << endl;
        exit(EXIT_FAILURE);
    }

    char event[1024];
    sprintf(event, "Entered program from %s\n", argv[1]);
    Logger::LogEvent(event);

    /* START STUDENT MODIFIABLE SECTION */

    PNMreader reader("../images/hank.pnm");
      
    Checkerboard b;
    Invert i;
    i.SetInput(reader.GetOutput());

    b.SetInput(reader.GetOutput());
    b.SetInput2(i.GetOutput());

    LRConcat lr;
    lr.SetInput(i.GetOutput());
    lr.SetInput2(b.GetOutput());

    LRConcat LR;
    LR.SetInput(reader.GetOutput());
    LR.SetInput2(i.GetOutput());

    TBConcat tb;
    tb.SetInput(lr.GetOutput());
    tb.SetInput2(LR.GetOutput());

    LRConcat Lr;
    Lr.SetInput(tb.GetOutput());
    Lr.SetInput2(tb.GetOutput());

    

    
    Image *finalImage = Lr.GetOutput();

    /* END STUDENT MODIFIABLE SECTION */

    try 
    {
        finalImage->Update();
    }
    catch (DataFlowException &)
    {
        ofstream ofile("my_exception");
        if (ofile.fail())
        {
             cerr << "Something is wrong ... can't open my_exception"
                  << " for opening" << endl;
             exit(EXIT_FAILURE);
        }
        ofile << "Exception found!" << endl;
        exit(EXIT_SUCCESS);
    }

    CheckSum cs;
    cs.SetInput(finalImage);
    cs.OutputCheckSum("my_checksum");

    if (argc == 3)
    {
        PNMwriter writer;
        writer.SetInput(finalImage);
        writer.Write("3H.pnm");
    }
    Logger::Finalize();
}