Új hozzászólás Aktív témák

  • amargo

    addikt

    válasz shaft72 #2027 üzenetére

    Azért ez nem olyan egyszerű(szerintem), hogy csak úgy valaki megírja most neked.. bár lehet jó kihívásnak találná, vagy jó 5lete van rá.
    Viszont valószínű létezik erre is valami prog. De én nem ismerek [link] google:image/picture match
    De, ha 5let kell, nekem van rá, tekintve, hogy sorokban kitudod olvasni BMP-ből a szineket.. ahol eltér a kettő, ott megjelölöd valamivel. Nos ez elméleti volt, ezen a nyomon elindulhat valaki, ha gondolja:

    BITMAP bm1;
    GetObject(Image1->Picture->Bitmap->Handle, sizeof(bm1), &bm1);

    //step through lines of first bitmap two at a time and
    //average pixels into the second bitmap
    for (int row=0;row<bm1.bmHeight/2;row++)
    {
    for (int col=0;col<bm1.bmWidth/2;col++)
    {
    //get addresses of the four pixels in the source bitmap
    unsigned char* bm1ptr1=(unsigned char*)bm1.bmBits+(bm1.bmHeight-row*2)*bm1.bmWidthBytes+col*2*bm1.bmBitsPixel/8;
    unsigned char* bm1ptr2=bm1ptr1+3;
    unsigned char* bm1ptr3=(unsigned char*)bm1.bmBits+(bm1.bmHeight-row*2)*bm1.bmWidthBytes+col*2*bm1.bmBitsPixel/8;
    unsigned char* bm1ptr4=bm1ptr3+3;

    //get address of the corresponding pixel in the destination bitmap
    unsigned char* bm2ptr=(unsigned char*)Image2->Picture->Bitmap->ScanLine[row]+col*bm1.bmBitsPixel/8;

    //average source pixel RGB values
    BYTE finalRed=(bm1ptr1[0]+bm1ptr2[0]+bm1ptr3[0]+bm1ptr4[0])/4;
    BYTE finalGreen=(bm1ptr1[1]+bm1ptr2[1]+bm1ptr3[1]+bm1ptr4[1])/4;
    BYTE finalBlue=(bm1ptr1[2]+bm1ptr2[2]+bm1ptr3[2]+bm1ptr4[2])/4;

    //put averaged values into the final bitmap
    bm2ptr[0]=finalRed;
    bm2ptr[1]=finalGreen;
    bm2ptr[2]=finalBlue;
    }
    }

    “The workdays are long and the weekend is short? Make a turn! Bike every day, bike to work too!”

Új hozzászólás Aktív témák