How can I randomly sample 10% and 20% pixels of an image

3 Ansichten (letzte 30 Tage)
fadams18
fadams18 am 11 Jul. 2020
Kommentiert: Adam Danz am 11 Jul. 2020
Hello guys
I have an image of size 2,048×2,048 pixels,
I would like to stack the 3 channels to get a matrix of size 6,144 × 2,048.
Then, sample 10% and 20% pixels to construct respectively with sizes each 2048 x 2048 sparse double
pic = double(imread('new4.jpg'));
redChannel = pic(:,:,1);
blueChannel = pic(:,:,2)
greenChannel = pic(:,:,3)
% now my problem is stacking and sampling. Please help!
  1 Kommentar
Adam Danz
Adam Danz am 11 Jul. 2020
or, if you need to extract the red blue green as you've done in the code from your question, you can just use vertical concatenation,
x = [A;B;C];

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Modify Image Colors finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by