How do you convert a .PNG image to a matrix of values using MATLAB?
Is it possible to convert a .PNG image to an array of numerical values (e.g. red, green, blue values) that I can work with using MATLAB? If so, how can I do this?
1 answer

not sure what you mean. if you import
imread('someImage.png')
you get an x m x 3
matrix
See also questions close to this topic

How to union a vector with a preexisting matrix in matlab?
I have an example:
A = [1 5;2 6;3 7;4 8] B = [1;2;3;4]
I wanna stack them in
C
as, withC
formatted as:C = [1 5 1; 2 6 2; 3 7 3; 4 8 4]
How to proceed? I have tried
vertcat
,horzcat
with transposing, andunion
. None of them works. 
Strange results when running faster rcnn on a new dataset
I have trained RCNN, Fast RCNN and Faster RCNN on a custom dataset with these settings:
%%%%%%%%%%%%%%%%%%%%%% training options options = trainingOptions('sgdm', ... 'Momentum', 0.9, ... 'InitialLearnRate', 0.001, ... 'LearnRateSchedule', 'piecewise', ... 'LearnRateDropFactor', 0.1, ... 'LearnRateDropPeriod', 8, ... 'L2Regularization', 0.004, ... 'MaxEpochs', 40, ... 'MiniBatchSize', 128, ... 'Verbose', true); %%%%%%%%%%%%%%%%%%%%%% Train an RCNN object detector rcnn = trainRCNNObjectDetector(imageTable,Layers, options, ... 'NegativeOverlapRange', [0 0.3], 'PositiveOverlapRange',[0.5 1]);
for RCNN I got these results:
Training on single GPU. Initializing image normalization. =========================================================================================  Epoch  Iteration  Time Elapsed  Minibatch  Minibatch  Base Learning    (seconds)  Loss  Accuracy  Rate  =========================================================================================  1  1  10.33  2.3039  0.00%  0.0010   1  50  22.99  1.4532  75.00%  0.0010   1  100  35.40  1.2080  75.00%  0.0010   1  150  47.56  1.1673  75.00%  0.0010  . . .  40  9800  2252.88  0.5430  83.59%  1.00e07   40  9850  2264.47  0.1504  96.88%  1.00e07   40  9900  2276.62  0.4920  78.13%  1.00e07   40  9950  2287.41  0.2321  91.41%  1.00e07   40  10000  2298.10  0.9022  78.91%  1.00e07   40  10040  2306.74  0.5830  84.38%  1.00e07  =========================================================================================
but for faster rcnn this was the output of stage 4:
=========================================================================================  Epoch  Iteration  Time Elapsed  Minibatch  Minibatch  Base Learning    (seconds)  Loss  Accuracy  Rate  =========================================================================================  1  1  1.39  1.6948  50.00%  0.0010   1  50  82.70  2.1859  50.00%  0.0010   1  100  165.51  2.0188  50.00%  0.0010   2  150  248.19  1.7161  50.00%  0.0010   2  200  330.94  1.1704  50.00%  0.0010  . . .  9  900  1500.16  1.6119  50.00%  0.0001   9  950  1584.03  1.7687  50.00%  0.0001   10  1000  1667.73  1.1775  50.00%  0.0001   10  1050  1751.86  1.6114  50.00%  0.0001   10  1100  1835.23  1.7860  50.00%  0.0001  =========================================================================================
The same thing goes with fast rcnn. I don't know what I am doing wrong, but the Minibatch Accuracy is constantly on 50%. How can I get the results to come out right?
thanks

How to hide a variable from workspace in matlab
Is there an undocumented way to render a variable 'invisible' in matlab such that it still exists but does not show up in the workspace list?