bitwiseandcv
Performs bitwise union on given inputs, source1 and source2.
Syntax
R = bitwiseandcv(source1, source2)
R = bitwiseandcv(source1, source2, mask)
Inputs
- source1
- Handle of an image.
- source2
- Handle of an image or an integer.
- mask
- Optional handle of an 8-bit single channel image or a 2D matrix of natural numbers representing the elements in R that need to be changed.
Outputs
- R
- Handle of the output image.
Examples
Apply bitwiseandcv and inrangecv functions to perform cloud detection:
Figure 1. Input image
![](images/bitwiseand_inrange_fig1.png)
Figure 2. Output image
![](images/bitwiseand_inrange_fig2.png)
img = imreadcv('Clouds.jpg', 1);
figure(1);
imshowcv(img);
white_ = [255, 255, 255];
lowerBound = [200,200,200];
mask = inrangecv(img, lowerBound, white_);
res = bitwiseandcv(img, img, mask);
figure(2);
imshowcv(res);
![](images/bitwiseand_inrange_fig1.png)
![](images/bitwiseand_inrange_fig2.png)
Do a bitwise union of two images:
Figure 3. Input image 1
![](images/bitwiseandcv_fig1.png)
Figure 4. Input image 2
![](images/bitwiseandcv_fig2.png)
Figure 5. Output image
![](images/bitwiseandcv_fig3.png)
source1 = imreadcv('image1.jpg');
source2 = imreadcv('image2.jpg');
R = bitwiseandcv(source1, source2);
![](images/bitwiseandcv_fig1.png)
![](images/bitwiseandcv_fig2.png)
![](images/bitwiseandcv_fig3.png)
Do a bitwise union of two images with a mask:
source1 = imreadcv('image1.jpg');
source2 = imreadcv('image2.jpg');
masksize = imsizecv(source1);
mask = ones(masksize(1), masksize(2));
R = bitwiseandcv(source1, source2, mask);