コード例 #1
0
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();
}
コード例 #2
0
ファイル: stress_test.C プロジェクト: CBrooks12/cis330
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();
}
コード例 #3
0
ファイル: stress_test.C プロジェクト: CBrooks12/cis330
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();
}