From: Steve R. <sr...@at...> - 2000-07-27 20:38:12
|
I've completed support for the Python Shell interface that builds upon Frank's recent work of adding NumPy array support. The python shell in OpenEV (accessed from the Edit menu) works just the same as the command line version. The initial environment has Numeric imported (numerical python, "from Numeric import *") as well it provides some extra functions for interacting with OpenEV. Here is a summary of current OpenEV Python commands to use in the python shell: Load a file into a Numeric python array: array = LoadFile('filename.foo') Display it in the current view: display(array) Get the Region Of Interest (ROI) marked on the image - use the ROI tool to mark a region roi() returns the ROI in (x, y, width, height) Use the ROI tool to get a subarray: - first mark out an ROI with the tool on the image array2 = get_roi(array) The get_roi() function will slice all the channels of "array" (ie, for RGB all three channels will be sliced). If the ROI is outside of the image the array returned is NOT padded with zeros, it is clipped to the maximum valid data region of "array." Also note that get_roi() simply uses the RIO marked by the tool and does not check if it corresponds to the array for the image you're passing in. Therefore, the array argument could be one image and the ROI could be marked on another. Steve |