cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Samir7791
Level I

Create a JMP Function

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

 

10 REPLIES 10
Samir7791
Level I

Re: Create a JMP Function

Hi M,

Yes , I see this function in the image processing add-in.

It is usefull.

Krs,

Samir