How to convert the text file (1x290400) to image as shown as below?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Tham Wei Jian
il 18 Ago 2019
Commentato: Tham Wei Jian
il 22 Ago 2019
After I done simulatation, ModelSim gives me an output image file in text file format when doing the convolution neutral network.
However, the output image in text file is 1 column vector. (1x290400)
Community have an example codes to convert the 1 column vector text file to become an image like above (55x55x96)?There is 96 pictures in 1 output picture and each size is 55x55
Please help me and thank a lot..
9 Commenti
Walter Roberson
il 21 Ago 2019
Imagine that you were to take all of the data for your images and arrange it into a 3D cuboid. Now with that cuboid start numbering pixels consecutively.
For any particular x and z, number all of the y in increasing distance from the x axis (the first column of data). Once the first column is done, continue numbering from the beginning of the second column near the x axis and getting further from x axis
Y5+ 5 10 15
Y4+ 4 9 14
Y3+ 3 8 13
Y2+ 2 7 12
Y1+ 1 6 11
+++++++++
X1 X2 X3
That would be for Z1. Now continue with Z2 which would continue the same pattern but the entries would be numbered 15 higher in this example.
You can take consecutive pixels from the input file and order them in this way to build a 3d array of images. Though in your case each image would be 55 x 55 instead of the 5 x 3 that I show in this example.
Now that we have seen how pixels can be taken from a serial data and rearranged into 3d with each z slice being a different image, I want you to imagine taking the cuboid and turning it. Now take the rotated cuboid and number them using the same system as before. All of the same data is there but a different order.
The permute call effectively tells you which axes order you need to read the data to get ordering that matlab expects. [3 2 1] is ttracing along the z axis then the x axis then the y axes. The 4 in 3 2 4 1 acts to introduce an axis that is length 1 that is needed for technical reasons
Risposta accettata
Jyothis Gireesh
il 21 Ago 2019
I am assuming that you want to create a montage for the given dataset. You may make use of the above code provided by Walter Roberson to create the required output and has been verified to be working on MATLAB R2017a version
You may also make use of the following pointers about using “montage()” in MATLAB R2017a
- The image array given as input to the function had to be in the form of a M-by-N-by-1-by-K array. This requirement resulted in the creation of an error when the following code was used
d4 = permute( reshape(data, [], 55, 55), [3 2 1]);
The above “d4” array was of the form 55 x 55 x 95 which may not be considered as an acceptable input in R2017a. The modification suggested by Mr. Roberson converts the array into 55 x 55 x 1 x 96.
- This requirement was modified in R2018b which allows the use of multi-image arrays as input to the function
You may also go through the following link if you need any further clarification on the same.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!