Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Mask (computing)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Image masks=== {{see also|Bit blit|Clipping path}} [[Image:Blit dot.gif|thumb|[[Raster graphics|Raster graphic]] [[Sprite (computer graphics)|sprite]]s (left) and masks (right)]] In [[computer graphics]], when a given image is intended to be placed over a background, the transparent areas can be specified through a binary mask.<ref>{{Cite web|url=https://www.pyimagesearch.com/2018/11/19/mask-r-cnn-with-opencv/|title=Mask R-CNN with OpenCV|date=2018-11-19|website=PyImageSearch|language=en-US|access-date=2020-04-05}}</ref> This way, for each intended image there are actually two [[bitmap]]s: the actual image, in which the unused areas are given a [[pixel]] value with all [[bit]]s set to 0s, and an additional ''mask'', in which the correspondent image areas are given a pixel value of all bits set to 0s and the surrounding areas a value of all bits set to 1s. In the sample at right, black pixels have the all-zero bits and white pixels have the all-one bits. At [[Run time (program lifecycle phase)|run time]], to put the image on the screen over the background, the program first masks the screen pixel's bits with the image mask at the desired coordinates using the [[bitwise AND]] operation. This preserves the background pixels of the transparent areas while resets with zeros the bits of the pixels which will be obscured by the overlapped image. Then, the program renders the image pixel's bits by combining them with the background pixel's bits using the [[Logical disjunction|bitwise OR]] operation. This way, the image pixels are appropriately placed while keeping the background surrounding pixels preserved. The result is a perfect compound of the image over the background. [[Image:Sprite rendering by binary image mask.png|center]] This technique is used for painting pointing device cursors, in typical 2-D videogames for characters, bullets and so on (the [[Sprite (computer graphics)|sprite]]s), for [[GUI]] [[Icon (computing)|icon]]s, and for video titling and other image mixing applications. A faster method is to simply overwrite the background pixels with the foreground pixels if their alpha=1 Although related (due to being used for the same purposes), [[Palette (computing)#Transparent color in palettes|transparent color]]s and [[alpha channel]]s are techniques which do not involve the image pixel mixage by binary masking.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)