to replace black portion of an image, with any other image: in matlab
i have an image named imageA...imageA has some portion colored black. now i want to replace this Black portion of the imageA w开发者_运维知识库ith the pixels of imageB , in such a way that location of portion is same in other image.
like if the position of black pixel in imageA=(10,15) , than this black pixel should be replaced with the pixel at the location (10,15) in imageB .
Use Logical Indexing.
zeropixels = imageA == 0
imageA(zeropixels) = imageB(zeropixels)
You might need some extra error checking code to ensure that the logical matrix zeropixels
is valid for indexing imageB.
精彩评论