Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remove all non black pixels from image
Message
De
26/12/2013 14:45:29
 
 
À
26/12/2013 11:51:41
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01590997
Message ID:
01591001
Vues:
76
This message has been marked as a message which has helped to the initial question of the thread.
>Hi folks!
>Using GDIPlusX, how to remove all non black pixels from an image?


If you capture the data to a 32-bit bitmap, you can read the bitmap buffer data and look for all CHR(0)+CHR(0)+CHR(0) combinations at either the start or end of the 4-byte block (depending on endian, a small test would indicate which it is) references which occur on 4-byte boundaries:
lcBlack = CHR(0)+CHR(0)+CHR(0)
FOR lnI = 1 TO bufferLength STEP 4
    IF SUBSTR(buffer, lnI, 3) == lcBlack OR SUBSTR(buffer, lnI + 1, 3) == lcBlack
        * It's a black pixel
    ENDIF
NEXT
You could also capture the bitmap, invert its colors, use VFP to overlay the inverted image atop a known background color with the Image's mode set to TRANSPARENT (where all WHITE pixels are ignored), then capture that image and save it to another buffer. Then, repeat the same process using another background color. In such a case, every difference between the two images will be where the black pixels were.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform