Dear everybody,
My knowledge in JMP scripting is small and SAS doesn't allow me to do what I can do in JMP in terms of image processing.
I adapted a little an existing JMP script (JohnPonte) that allow me to generate RGB data from images.
the scripte allow me to do it for one image and I have more than 300 images.
in SAS it is easy for me to create a macro to do it in an automated way but not in JMP.
the input (image) and the output (SAS dataset) will have the same name (in red), this means that the function will have only one argument.
the names of all the images I want treat are stored in JMP dataset (dataset with one column).
Here is the script:
NamesDefaultToHere(1);
// Read the image into JMP
img = NewImage("D:\M1_ACTIVE_ZL_T00.jpg");
w = newWindow("image", img);
// Get the pixel values as 3 distinct matrices (red, green and blue)
// RGB colors are in normalized color space (0.0-1.0)
{r, g, b} = img << getPixels("rgb");
// Convert rgb to gray-scale (intensity) matrix
i = 0.3*r + 0.59*g + 0.11*b;
// Get the pixel values as JSL colors then convert to hue, lightness and saturation
// HLS colors are in normalized color space (0.0-1.0)
jslColors = img << getPixels();
{h, l, s} = ColorToHLS(jslColors);
// Get the dimensions of the image/matrices
numRows = nrow(r);
numCols = ncol(r);
// Create a data table
dt = New Table("Image Data",
newColumn("X", set values(repeat(1::numCols, numRows))),
newColumn("Y", set values(shape(repeat(1::numRows,numCols)`,numCols,numRows))),
newColumn("r", set values(r)),
newColumn("g", set values(g)),
newColumn("b", set values(b)),
newColumn("i", set values(i)),
newColumn("h", set values(h)),
newColumn("l", set values(l)),
newColumn("s", set values(s))
);
dt << Save("D:\M1_ACTIVE_ZL_T00.sas7bdat");
Close(dt);
img<<close Window();
w<<close Window();
Thanks in advance for our help.
very kind regards,
Samir