Linux commands and exercises are designed to be executed from a Linux terminal. However, there are several different ways that most of this functionality can be achieved from the Jupyter notebooks with the attendent advantage of built-in documentation capabilities.
The most direct method is to use the bash kernel which is considered here. Experienced IPython notebook users may enjoy the %magic extensions for Linux commands. The advantage of the VisionX-V4 shell command is that it provides a more convenient command syntax when using VisionX images in python programs.
The following outlines how to execute Linux commands in the Jupyter notebook bash kernel.
Linux command that return text results may be directly specified in code sections:
ls -sl nb-x4*
There is a mechanism to display simple images in png or jpeg format. For example, to display the histogram of a v4 image file:
vplot nyg2.vx -h -rpng of=hist2.png
display < hist2.png
Note the display command is really a bash function and there is no explicit image size scaling method. Therefore, to make large images fit into the page it may be necessary to pre-scale to the desired display size. However, it is possible to pipe into the display command. For example:
vqfile -q nyg2.vx
vimag nyg2.vx m=0.3,0.3,1 of=tmp1
vxport tmp1 -png of= |display
vclip if=nyg2.vx s=128 p=46,160 | vibbox -z of=nyg3.vx
vxtopnm nyg3.vx | pamtopng |display
Frequently when using visionx it is convenient to have vview running concurrently so that images may be viewed and annotated interactively. A process may be called from a notebook but may not be successfully put in the background For example the command
vview &
will create a usable vview from the notebook vview but further execution in the notebook will be prevented until the user exits from that vview.
Therefore, it is recommended that when using the vview and vdview image viewing tools, first start vview in the background before starting the jupyter notebook. If you have already started the notebook then you can open a new terminal and start vview from there.
Individual pixel values for a small image region may be conveniently displayed with the vinsp command.
vinsp if=nyg3.vx p=36,56 s=12,8 -p | display
The vinsp command may also be used to show where the selected image region is located in the full image
vinsp if=nyg3.vx p=36,56 s=12,8 -p -r | display
The vinsp command may also be used with color images in which case teh three color values (R,G,B) are shown in each pixel
vclip if=nyc2.vx s=128 p=46,160 | vibbox -z of=nyc3.vx
vxport nyc3.vx -png of= | display
vinsp if=nyc3.vx p=36,56 s=12,8 -p | display
vinsp if=nyc3.vx p=36,56 s=12,8 -p -r | display
In some cases it will be necessary in reports to include images that are created in the interactive image viewing tools (like v3d and vdview). For these cases, it is necessary to make a screen snapshot of the region, covert that image to jpeg or png if necessary and to import that image into notbook by using the display function.