concatenating arrays and matrix

1 view (last 30 days)
Matpar
Matpar on 16 Aug 2019
Commented: Matpar on 17 Aug 2019
Hi all I trying to get a simple syntax to add this constant to image values
im=imread(im)
im=rgb2gray(im)
so now that im is now the gray scale image
i am try to add these values to the image
C1=[10,20,50,100]
Can profesional provide an example of how this is done in the simplest form using a for loop?
thank you in advance!!!
  7 Comments
Matpar
Matpar on 17 Aug 2019
Hi adam, it couldn't be clearer than that!! I understood thanx! I will get on it now

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 16 Aug 2019
nd = ndims(YourImageArray);
Thresholded_arrays = bsxfun(@le, YourImageArray, reshape([50, 100, 150, 200], [ones(1,nd), 4]) );
Instead of @le you would use @plus
nd = ndims(YourImageArray);
Incremented_arrays = bsxfun(@plus, YourImageArray, reshape(uint8([50, 100, 150, 200]), [ones(1,nd), 4]) );
  5 Comments
Matpar
Matpar on 17 Aug 2019
ok i will try it! can you explain the output outside the forloop and inside the for loop? this what happens!! I understood everthing else and how do i make the code myself! i guess this comes with practice but I am willing to learn.
Walter! I must say you have loads of patience and experience!!! I will like to add how grateful I am for having you explain stuff for me in my mess of confusing concerning Matlab!
I am so thankful walter! thank you I appreciate you budz, really thanx much!

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!