Choose Language Hide Translation Bar
Community Trekker

JMP Pixel Values/OpenCV Pixels? Blob? RunProgram?

If anyone has experience with image analysis, help would be much appreciated! I'm new to both RunProgram and OpenCV, and am pretty rusty in Python.

I have a script written in Python that uses OpenCV to do image processing. Basically, I want to open the returned image in JMP using RunProgram. I was unsure of how to go about this, as I'm very new to the RunProgram function. I've read the documentation that I found, but I'm definitely missing something. I tried to use the Read Function("blob") then using <<Add Image(Set Blob(Char to Blob(" ... "), "png") but I just get an empty window. 


One thing I've noticed with the OpenCV, when just getting the blue channel values, there are multiple lists inside another list. Where with JMP, looking at examples, all of the values are in one list. What is the difference between these formats? Is there a way to convert between them?


One of the documented scripts for the blob,, created a data table from the output.

Should I get print the r,g,b values in Python to the console, use this method to get them into a data table, then create the image that way? I can't really see how using that method would be efficient since the rgb values will be so much text.

0 Kudos
Super User

Re: JMP Pixel Values/OpenCV Pixels? Blob? RunProgram?


I am not a Python user (yet), nor am I familiar with OpenCV, however, I have worked with JMP images and Run Program.

JMP reads a graphics file as a matrix of color numbers, for example, the JSL statement Show( Color to RGB(-24727) );  returns

    Color To RGB(-24727) = {0, 0.376470588235294, 0.592156862745098};


Is the output of OpenCV a binary object or a picture?  JMP can automatically read an image file. Here are a couple of ideas. 

  •  img = blob << Get Image
  • Using OpenCV save your graph, and return a 0 or 1, then if the value is 1 open the the saved .jpg or .png.

The attached script is one from Chapter 8 of our book JSL Companion Applications of the JMP Scripting Language, 2nd, that demonstrates a few simple methods for working with image pixels.  Also you might want to look at; it documents  an add-in for image segment and color analysis.  


If you can attach an example OpenCV output, that might help.

0 Kudos

Re: JMP Pixel Values/OpenCV Pixels? Blob? RunProgram?

In order to call OpenCV from JMP, I suggest using the 14.x JMP-to-Python bridge that allows - you guessed it - JMP to call and exchange objects directly with Python.

0 Kudos