My last post contained a picture of a window that contained a grid of images. This was a randomly generated array of images based on an extract from the MNIST dataset. This database contains over 60,000 samples of handwritten digits.
However, my pixel data was disoriented and the images looked more like hieroglyphs. Fortunately JMP understands an image as an ‘object’, and allows a variety of transformations to be applied to it, including flipping and rotating.
In case you’re interested, here is the full code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
// empty window with placeholder for inserting images New Window( "Images", vlb = V List Box( ) ); // source data table, derived from: // http://yann.lecun.com/exdb/mnist/ // (table has NOT been transposed // i.e. each row represents an image) dt = Current Data Table(); mat = dt << Get As Matrix; //Close(dt,NoSave); nr = NRows(mat); k = 0; // image counter ran = J(1,160,Random Integer(1,60000)); // loop for each column of images For (i=1,i<=10,i++, // container for a row of images hlb = H List Box(); // loop for each row of images For (j=1,j<=16,j++, k++; // pixels for one image are in a single row p = mat[ran[k],0]; // pixels represent a 28x28 image r = Shape( p, 28, 28 ); // scale values for RBG grey-scale s = RGB Color(r,r,r); // use pixel data to construct bitmap image image = New Image(); image << Set Pixels(s); // append to container for current row hlb << Append( image ) ); // append row of images to window vlb << Append( hlb ) ); |
Hey Tack för bra tid här på denna webbplats. Fortsätt Vänligen det. Eftersom Jag glad igen tidigare