- Matlab does not have a data type called cell. However, it has a data type called cell array.
- A cell array is a container for data of dissimilar types (e.g. characters and numbers), it would not make sense to store an image in a cell array. Images in matlab are not stored in cell array.
- If an image were to be stored in a cell array how should that be done? A 3D cell array of pixels (height x width x colour plane)? A 2D cell array of RGB triplets? Something else
- The class of the pixels (uint8) is completely independent of the method you use to store them. You could have a cell array of uint8 pixels, or a regular 3D matrix of uint8 pixels. Again using cell arrays does not make sense.
How to Convert uint8 to Cell
3 次查看(过去 30 天)
显示 更早的评论
Hello,
How can I convert a uint8 variable into a cell? I am attempting to use the SHINE toolbox to mask some images, but the image is not in a cell format, which is required.
I am new to MATLAB, so any information regarding this would be helpful. Thanks!
2 个评论
Guillaume
2017-10-30
The question does not make sense
What is the exact wording of the requirements of your toolbox?
回答(2 个)
Guillaume
2017-10-31
编辑:Guillaume
2017-10-31
I don't know where you got that toolbox but it's been poorly written (unnecessary else, incorrect test of size, and the name of the type is cell array, not cell). I would be wary of using poorly written code.
Anyway, it looks like the code expect a cell array containing several images (note the plural on the variable) name. Each cell of the cell array should be a 2d or 3d matrix representing your image.
0 个评论
Image Analyst
2017-10-31
I have no idea what the SHINE toolbox is but it apparently wants your image(s) to be in cell(s). So just enclose them in braces. Like if grayImage is your uint8 image, then put it into a cell array
ca{1} = {grayImage};
You can add additional cells with more images if you want. Then call your SHINE toobox function passing it the cell or cell array:
someOutput = SomeShineFunction(ca); % Send in the cell "ca", not grayImage.
I can't really say much more without seeing the function definition line, and perhaps some comments about what it expects for input variables.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!