I would like to know how to cover part of an image that is black and amp; White?
I have found an object that needs to be identified on the side, but I have other white interfering objects in the background which are under the target ozzyjet ... I have all the lower part Want to mask the image to black, how can I do this?
Thank you!
Edit
I also have some other parts (top part) ... how can I do this?
Please explain the code because I want to know how it works and applies it to your understanding.
EDIT2
My image is 480x640 ... is there any way to cover specific pixels? For example, from the 180x440 image ...
If you have the matrix A
, You can set the lower half to black by:
centerIndex = round (size (A, 1) / 2); Get center index for% # rows (center index: end, :) = cast (0, orbit (a)); Set the lower half for% # value% 1 (A similar type of A)
Using the first it is getting the number of rows in a
The function, which is divided by 2, and closes the image to get an integer index near the center of the height. Then, vector center index: ending
indexes all indices from the closing center list, and :
lists all the columns representing all indexed elements in color black To be set to 0.
The function is used to obtain the data type A
so that 0 can be used in that type of program. It is not necessary to may be , however, as 0 would probably be converted into type without its A
.
If you use it as a mask, you can do the following:
mask = true (size (A)); % # Create a matrix of the right values the same size as a center. Indian = Round (Size (A, 1) / 2); Get center index for% # rows mask (centerIndex: end, :) = false; Set the false lower half%
Now, a logical with mask
for true
pixels (i.e. "1") The matrix you want to keep and the false
(i.e. "0") for pixels that you want to set to 0. You can set more elements of false
from mask
as you want, when you want to apply a mask, you can do the following:
A (~ mask) = 0; Set all elements related to 0% in false values in false values 0
Comments
Post a Comment