Clear Filters
Clear Filters

How to store RGB values of multiple images with separate variables?

5 views (last 30 days)
I have specified a folder location which contains jpg images. I am getting all images but now i want RGB values of each iage separately in workapace to process them further. Please can someone help me. Thank you for reading this question. I am attaching my code for your reference below.

Answers (2)

Matt J
Matt J on 14 Aug 2021
Edited: Matt J on 14 Aug 2021
Something like this perhaps.
RGB=rand(256,256,3,10); %Images
tmp=cellfun(@squeeze, num2cell(RGB,[1,2,4]) , 'uni' ,0);
[R,G,B]=deal(tmp{:}); %separate channels
whos R G B
Name Size Bytes Class Attributes B 256x256x10 5242880 double G 256x256x10 5242880 double R 256x256x10 5242880 double

Image Analyst
Image Analyst on 14 Aug 2021
My attached demo does this very nicely. Adapt as needed.

Categories

Find more on Images 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!