Questions tagged [mask]
An image mask is a bitmap that specifies an area to paint, but not the color. In effect, an image mask acts as a stencil to specify where to place color on the page. Quartz uses the current fill color to paint an image mask.
mask
2,854
questions
197
votes
3
answers
382k
views
Update row values where certain condition is met in pandas
Say I have the following dataframe:
What is the most efficient way to update the values of the columns feat and another_feat where the stream is number 2?
Is this it?
for index, row in df.iterrows():
...
108
votes
8
answers
82k
views
How can I mask a UIImageView?
I am trying to mask an image with something like this:
Would you please help me?
I am using this code:
- (void) viewDidLoad {
UIImage *OrigImage = [UIImage imageNamed:@"dogs.png"];
UIImage ...
82
votes
9
answers
437k
views
Implement an input with a mask
I would like to implement a mask for a text input field which accepts a date. The masked value should display directly inside of the input.
Something like this:
<input type='text' value='____/__/...
70
votes
5
answers
280k
views
OpenCV - Apply mask to a color image
How can I apply mask to a color image in latest python binding (cv2)? In previous python binding the simplest way was to use cv.Copy e.g.
cv.Copy(dst, src, mask)
But this function is not available ...
62
votes
11
answers
108k
views
How to mask an EditText to show the dd/mm/yyyy date format
How can I format an EditText to follow the "dd/mm/yyyy" format the same way that we can format using a TextWatcher to mask the user input to look like "0.05€". I'm not talking about limiting the ...
56
votes
6
answers
50k
views
How to define TextBox input restrictions?
How can I restrict TextBox to accept only capital letters, or for example digits, or forbid to put any special character?
Sure it's a piece of cake to catch TextInput event and handle the text here, ...
56
votes
7
answers
70k
views
Simply mask a UIView with a rectangle
I want to know how to simply mask the visible area of a UIView of any kind. All the answers/tutorials I've read so far describe masking with an image, gradient or creating round corners which is way ...
56
votes
3
answers
126k
views
Select elements of numpy array via boolean mask array
I have a boolean mask array a of length n:
a = np.array([True, True, True, False, False])
I have a 2d array with n columns:
b = np.array([[1,2,3,4,5], [1,2,3,4,5]])
I want a new array which ...
45
votes
11
answers
80k
views
Converting CIDR address to subnet mask and network address
Given a CIDR address, e.g. 192.168.10.0/24
How to determine mask length? (24)
How to determine mask address? (255.255.255.0)
How to determine network address? (192.168.10.0)
43
votes
9
answers
129k
views
Mask US phone number string with JavaScript
I need regular express for US Phone Number format.I want to replace the phone number string into below US phone number string format in JavaScript.
var number = "4031234789";
And I want to mask it ...
43
votes
7
answers
166k
views
How to properly mask a numpy 2D array?
Say I have a two dimensional array of coordinates that looks something like
x = array([[1,2],[2,3],[3,4]])
Previously in my work so far, I generated a mask that ends up looking something like
mask =...
39
votes
7
answers
39k
views
How to apply a disc shaped mask to a NumPy array?
I have an array like this:
>>> np.ones((8,8))
array([[ 1., 1., 1., 1., 1., 1., 1., 1.],
[ 1., 1., 1., 1., 1., 1., 1., 1.],
[ 1., 1., 1., 1., 1., 1., 1., 1.]...
39
votes
4
answers
35k
views
How can you turn an index array into a mask array in Numpy?
Is it possible to convert an array of indices to an array of ones and zeros, given the range?
i.e. [2,3] -> [0, 0, 1, 1, 0], in range of 5
I'm trying to automate something like this:
>>> ...
34
votes
4
answers
36k
views
Is it possible to have multiple masks with clip-path?
Hi,
I wonder whether it's possible to use more than one mask on the same element, just like this:
clip-path:polygon(8% 0%, 8% 7%, 14% 12%), polygon(96.4%, 92% 96.4%, 97% 92.3%), polygon(97% 15%, 99% ...
32
votes
2
answers
15k
views
Android - Is it possible to declare an alpha mask directly within layer-list XML definition?
A newbie question
I have this layers.xml that I use as a source for an ImageView.
And two images, mask.png and image.jpg
layers.xml:
<layer-list xmlns:android="http://schemas.android.com/apk/res/...
31
votes
15
answers
314k
views
Phone mask with jQuery and Masked Input Plugin
I have a problem masking a phone input with jQuery and Masked Input Plugin.
There are 2 possible formats:
(XX)XXXX-XXXX
(XX)XXXXX-XXXX
Is there any way to mask it accepting both cases?
EDIT:
I ...
31
votes
3
answers
30k
views
How to mask UIViews in iOS
I've seen similar questions, but haven't found workable answers.
I want to mask a UIView using a grey image (need to convert to alpha scale for masking). The UIView has background. It should be easy ...
30
votes
5
answers
18k
views
Cut Out Shape with Animation
I want to do something similar to the following:
How to mask an image in IOS sdk?
I want to cover the entire screen with translucent black. Then, I want to cut a circle out of the translucent black ...
30
votes
3
answers
60k
views
Can you overlay a transparent css3 gradient over a background image?
I'm trying to put a css3 gradient over the top of a background image. Using the code below puts a background image on top of my gradient, but i'm trying to do it the other way around, so the gradient ...
30
votes
9
answers
26k
views
Animating a CALayer's mask size change
I have a UIView subclass which uses a CAShapeLayer mask on its CALayer. The mask uses a distinct shape, with three rounded corners and a cut out rectangle in the remaining corner.
When I resize my ...
28
votes
2
answers
28k
views
How to mask credit card numbers in log files with Log4J?
Our web app needs to be made PCI compliant, i.e. it must not store any credit card numbers. The app is a frontend to a mainframe system which handles the CC numbers internally and - as we have just ...
26
votes
6
answers
124k
views
How to Apply Mask to Image in OpenCV?
I want to apply a binary mask to a color image.
Please provide a basic code example with proper explanation of how the code works.
Also, is there some option to apply a mask permanently so all ...
24
votes
2
answers
52k
views
Numpy inverse mask
I want to inverse the true/false value in my numpy masked array.
So in the example below i don't want to mask out the second value in the data array, I want to mask out the first and third value.
...
24
votes
2
answers
19k
views
Mask a 3d array with a 2d mask in numpy
I have a 3-dimensional array that I want to mask using a 2-dimensional array that has the same dimensions as the two rightmost of the 3-dimensional array. Is there a way to do this without writing the ...
23
votes
6
answers
69k
views
Masked Input Using EditText Widget in Android
Is there a way I can specify an input mask to the EditText control in Android?
I want be able to specify something like ### - ## - #### for a Social Security Number. This will cause any invalid input ...
23
votes
6
answers
27k
views
Is there way to match IP with IP+CIDR straight from SELECT query?
Something like
SELECT COUNT(*) AS c FROM BANS WHERE typeid=6 AND (SELECT ipaddr,cidr FROM BANS) MATCH AGAINST 'this_ip';
So you don't first fetch all records from DB and then match them one-by one....
22
votes
7
answers
53k
views
Remove literals from input mask after form submit?
this question has already been asked but the solutions where not clear.
Im using Josh Bush's MaskedInput plugin for jQuery
What im trying to achieve is:
E.g: a phone input with the mask
$("#...
22
votes
4
answers
38k
views
CABasicAnimation - transform scale keep in center
Trying to animatie an ellipse masked on a UIView to be scale transformed remaining in the center position.
I have found CALayer - CABasicAnimation not scaling around center/anchorPoint, and followed ...
19
votes
3
answers
22k
views
How to make SVG "fill" act in a similar way to CSS "background-size: cover"
I'm am trying to create an SVG which masks an image with a particular path however, when I try to fill the area using a pattern, the image does not cover the entire area.
Expected
Actual
In my defs ...
19
votes
1
answer
7k
views
How to implement highlighting on UIImage like UIButton does when tapped?
I need to replicate the effect that the UIButton does on an image when tapped, the highlighting. See:
The original PNG is a square with alpha background. When I set it as UIButton's image it ...
19
votes
3
answers
41k
views
How do I get masked date in model from input in angular using ui-mask?
I have a view which requires that the user enter their birthdate into a textbox.
I am using the mask directive from UI-Utils.
My view has this input element in it:
<input ui-mask="99/99/9999" ...
19
votes
2
answers
23k
views
OpenGL - mask with multiple textures
I have implemented masking in OpenGL according to the following concept:
The mask is composed of black and white colors.
A foreground texture should only be visible in the white parts of the mask.
A ...
19
votes
6
answers
18k
views
How to draw CALayer border around its mask?
So, I have a CALayer, which has a mask & I want to add border around this layer's mask. For example, I have set triangle mask to the layer and I want to have border around that layer.
Can anyone ...
18
votes
1
answer
3k
views
list of masked functions in R
I use a lot of packages and I know some functions are masked because they exist in several different packages.
Is there a way to get the list of duplicate functions (or masked functions?)
The ideal ...
18
votes
3
answers
22k
views
OpenCV & Python: Cover a colored mask over a image
I want to cover a image with a transparent solid color overlay in the shape of a black-white mask
Currently I'm using the following java code to implement this.
redImg = new Mat(image.size(), image....
18
votes
5
answers
23k
views
Masking a Drawable/Bitmap on Android
I'm currently looking for a way to use a black and white bitmap to mask the alpha channel of another bitmap or Drawable on Android. I'm curious as to what the best way to do this is. I certainly ...
17
votes
6
answers
29k
views
Delphi InputBox for password entry?
Inputbox:
answer:=Inputbox('a','b','c');
works good, but I'm looking for a masked one, like a password box where you only see little stars instead of the typed characters.
16
votes
2
answers
7k
views
Reverse a CALayer mask
I am trying to use a CALayer with an image as contents for masking a UIView. For the mask I have complex png image. If I apply the image as a view.layer.mask I get the opposite behaviour of what I ...
16
votes
4
answers
3k
views
Imagick: compose with mask
I try to recreate a script that uses the ImageMagick command "convert" to compose an image. But I want to do the same in PHP using Imagick (version 6.6.2-10).
The command is as follows:
convert A1....
16
votes
1
answer
8k
views
Is there an inverse to the CSS "Clip" property; hide the clipped area?
The CSS clip syntax gets you to define a rectangular area of a larger image that you wish to be visible. Is there a way to specify the inverse? Specify the rectangular area of the image that you wish ...
16
votes
1
answer
25k
views
Is there a -moz-mask CSS property, like -webkit-mask-image?
It seems -moz-mask-image is not supported in Firefox.
I am attempting a foreground gradient. I can't use an image as i need the text to be selectable. Does anyone have any ideas for Firefox?
This ...
15
votes
6
answers
14k
views
Reposition/resize UIBezierPath
I have a draggable view that has a mask layer on it. The mask layer has a UIBezierPath on it which makes an area on the view see-through/transparent(the effect that i want). My end goal is to change ...
15
votes
1
answer
19k
views
How to use a mask with QPainter?
I have a shape (in blue) loaded from a PNG with transparency:
Then I'm drawing several circles on top of this shape (in red) with QPainter::drawEllipse.
The result of that is somewhat similar to the ...
15
votes
3
answers
14k
views
Pandas best way to subset a dataframe inplace, using a mask
I have a pandas dataset that I want to downsize (remove all values under x).
The mask is df[my_column] > 50
I would typically just use df = df[mask], but want to avoid making a copy every time, ...
15
votes
2
answers
20k
views
OpenCV: How to get inlier points using findHomography()/findFundamental() and RANSAC
OpenCV does not provide a RANSAC-function per se or at least in such a form that you can just call it and be done with it (e.g. cv::ransac(...)). All functions/methods that are able to use RANSAC have ...
14
votes
5
answers
26k
views
Android Mask bitmap on canvas gen a black space
I have a mask bitmap with a half is red color and ones is transparent like this
https://www.dropbox.com/s/931ixef6myzusi0/s_2.png
I want to use mask bitmap to draw content on canvas only visible in ...
14
votes
2
answers
17k
views
How to format a Label to have a Display Format String?
I have a Label:
<Label Name="lblBilledDate"
Content="{Binding Path=BilledDate, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}">
</Label>
It is bound to a DateTime value.
How ...
14
votes
1
answer
4k
views
bitwise mask vs IN() efficiency in sqlite?
I have two ways to select a set of entries from the database:
SELECT ... WHERE `level` IN (1,2,4,8) LIMIT ...;
or
SELECT ... WHERE `level` & mask LIMIT ...;
There are 4 'levels' total, ...
13
votes
3
answers
38k
views
How to "zero" everything within a masked part of an image in OpenCV
If I have an image (IplImage 8-bit) and a binary mask (which is also an 8-bit IplImage of the same size, where every pixel has a value of either 0 or 255), how can I make every pixel in the image that ...
13
votes
1
answer
19k
views
How can i get ngx-mask masked value?
I'm trying to create simple field for phone number with help of ngx-mask module like this:
<mat-form-field>
<input matInput formControlName="PhoneNumber" placeholder="Phone ...