The union of 2 images

11 次查看(过去 30 天)
John Snow
John Snow 2013-10-28
评论: John Snow 2013-10-28
Let's say I have an image called A and another constant image of the same size how do I get the set union of those 2 images : the union should be of the same size as image A
Note: when I use union function it gives me an error (A and B must be vectors or 'rows' must be specified.)

采纳的回答

Matt J
Matt J 2013-10-28
编辑:Matt J 2013-10-28
the union should be of the same size as image A
Then you have an unconventional definition of a "union". There's no reason they should be the same size. Possibly you want to do a pixel-wise or() operation?
Union = A|B
Otherwise please clarify.
  5 个评论
John Snow
John Snow 2013-10-28
Thank you very much this works good

请先登录,再进行评论。

更多回答(1 个)

Image Analyst
Image Analyst 2013-10-28
Maybe you mean something like this:
% Find dark pixels.
binaryImage = skeletonImage < 50; % Or whatever intensity you want.
% Replace dark pixels with pixels from image B.
C_Image = skeletonImage; % Initialize
C_Image(binaryImage) = B_Image(binaryImage); % Replace.
  1 个评论
John Snow
John Snow 2013-10-28
This works ok but i think the "C=max(A,0.5);" command is easier from the other anser is easier but thank you very much for your answer

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by