Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
We have moved to a new forum at http://jevois.usc.edu, please check it out. The forum at jevois.org/qa will not allow new user registrations but is maintained alive for its useful past questions and answers.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

ObjectTracker only working if streaming

+4 votes

I've successfully run the ObjectTracker demo while streaming the video to AMCap and sending the tracking commands to an Arduino Uno over hardware serial and confirmed the servos respond appropriately (see mapping 23 below).  However, I've been unable to repeat this when I add a new mapping with no video output (see mapping 0) and issue the following commands or put them into JEVOIS:/config/initscript.cfg

->setmapping 0

->runscript script.cfg      (This is probably redundant and didn't work with or without)

->setpar serout All       (This is just to see any tracking commands also on the serial-over-USB)

->streamon

Below are some other commands and responses on the serial-over-USB connection.

->listmappings

AVAILABLE VIDEO MAPPINGS:

    0 - OUT: NONE 0x0 @ 0fps CAM: YUYV 320x240 @ 60fps MOD: JeVois:ObjectTracker
    1 - OUT: NONE 0x0 @ 0fps CAM: YUYV 320x240 @ 60fps MOD: JeVois:SaveVideo
    2 - OUT: NONE 0x0 @ 0fps CAM: YUYV 320x240 @ 30fps MOD: JeVois:RoadNavigation
    3 - OUT: NONE 0x0 @ 0fps CAM: YUYV 320x240 @ 30fps MOD: JeVois:SaveVideo
    4 - OUT: NONE 0x0 @ 0fps CAM: YUYV 176x144 @ 120fps MOD: JeVois:SaveVideo
    5 - OUT: MJPG 352x288 @ 60fps CAM: RGGB 352x288 @ 60fps MOD: JeVois:Convert
    6 - OUT: MJPG 320x240 @ 60fps CAM: RGBP 320x240 @ 60fps MOD: JeVois:Convert
    7 - OUT: MJPG 320x240 @ 30fps CAM: RGBP 320x240 @ 30fps MOD: JeVois:Convert
    8 - OUT: MJPG 320x240 @ 15fps CAM: YUYV 320x240 @ 15fps MOD: JeVois:Convert
    9 - OUT: MJPG 176x144 @ 120fps CAM: RGGB 176x144 @ 120fps MOD: JeVois:Convert
   10 - OUT: MJPG 160x120 @ 60fps CAM: YUYV 160x120 @ 60fps MOD: JeVois:Convert
   11 - OUT: MJPG 88x72 @ 120fps CAM: RGBP 88x72 @ 120fps MOD: JeVois:Convert
   12 - OUT: YUYV 960x240 @ 30fps CAM: YUYV 320x240 @ 30fps MOD: JeVois:DemoNeon
   13 - OUT: YUYV 640x480 @ 30fps CAM: YUYV 320x240 @ 30fps MOD: JeVois:JeVoisIntro
   14 - OUT: YUYV 640x360 @ 30fps CAM: YUYV 320x240 @ 30fps MOD: JeVois:JeVoisIntro
   15 - OUT: YUYV 640x312 @ 50fps CAM: YUYV 320x240 @ 50fps MOD: JeVois:DemoSalGistFaceObj
   16 - OUT: YUYV 640x300 @ 60fps CAM: YUYV 320x240 @ 60fps MOD: JeVois:DemoSaliency
   17 - OUT: YUYV 640x300 @ 10fps CAM: YUYV 320x240 @ 10fps MOD: JeVois:BurnTest
   18 - OUT: YUYV 352x288 @ 60fps CAM: YUYV 352x288 @ 60fps MOD: JeVois:SaveVideo
   19 - OUT: YUYV 320x288 @ 30fps CAM: YUYV 320x240 @ 30fps MOD: JeVois:SaliencySURF
   20 - OUT: YUYV 320x286 @ 30fps CAM: YUYV 320x240 @ 30fps MOD: JeVois:DemoQRcode
   21 - OUT: YUYV 320x260 @ 30fps CAM: YUYV 320x240 @ 30fps MOD: JeVois:DemoArUco
   22 - OUT: YUYV 320x256 @ 30fps CAM: YUYV 320x240 @ 30fps MOD: JeVois:RoadNavigation
   23 - OUT: YUYV 320x254 @ 60fps CAM: YUYV 320x240 @ 60fps MOD: JeVois:ObjectTracker
   24 - OUT: YUYV 320x252 @ 30fps CAM: YUYV 320x240 @ 30fps MOD: JeVois:ObjectDetect
   25 - OUT: YUYV 320x240 @ 60fps CAM: YUYV 320x240 @ 60fps MOD: JeVois:SaveVideo
   26 - OUT: YUYV 320x120 @ 30fps CAM: YUYV 160x120 @ 30fps MOD: JeVois:DemoBackgroundSubtract
   27 - OUT: YUYV 176x160 @ 120fps CAM: YUYV 176x144 @ 120fps MOD: JeVois:RoadNavigation
   28 - OUT: YUYV 176x144 @ 120fps CAM: YUYV 176x144 @ 120fps MOD: JeVois:SaveVideo
   29 - OUT: YUYV 160x120 @ 60fps CAM: YUYV 160x120 @ 60fps MOD: JeVois:SaveVideo
   30 - OUT: YUYV 88x72 @ 120fps CAM: YUYV 88x72 @ 120fps MOD: JeVois:SaveVideo
   31 - OUT: YUYV 64x192 @ 25fps CAM: YUYV 320x240 @ 25fps MOD: JeVois:SalientRegions
   32 - OUT: GREY 640x480 @ 29fps CAM: YUYV 640x480 @ 29fps MOD: JeVois:EdgeDetection
   33 - OUT: GREY 640x480 @ 26.8fps CAM: YUYV 640x480 @ 26.8fps MOD: JeVois:Convert
   34 - OUT: GREY 320x960 @ 45fps CAM: YUYV 320x240 @ 45fps MOD: JeVois:EdgeDetectionX4
   35 - OUT: GREY 320x240 @ 59fps CAM: YUYV 320x240 @ 59fps MOD: JeVois:EdgeDetection
   36 - OUT: GREY 320x240 @ 30fps CAM: YUYV 320x240 @ 30fps MOD: JeVois:SuperPixelSeg
   37 - OUT: GREY 176x288 @ 100fps CAM: YUYV 176x144 @ 100fps MOD: JeVois:OpticalFlow
   38 - OUT: GREY 176x144 @ 120fps CAM: YUYV 176x144 @ 120fps MOD: JeVois:DemoEyeTracker
   39 - OUT: GREY 160x495 @ 60fps CAM: YUYV 160x120 @ 60fps MOD: JeVois:DemoCPUGPU
   40 - OUT: GREY 128x117 @ 5fps CAM: YUYV 160x120 @ 5fps MOD: JeVois:DenseSift
OK

->setmapping 0

OK

output showing that the ObjectTracker module is loaded...

->help 

ObjectTracker Options:
  --vrange (jevois::Range<unsigned char>) default=[10...245]
    Range of V values for HSV window
       Exported By: ObjectTracker value=[100...255]

  --srange (jevois::Range<unsigned char>) default=[10...245]
    Range of S values for HSV window
       Exported By: ObjectTracker value=[100...255]

  --maxnumobj (unsigned int) default=[10]
    Max number of objects to declare a clean image
       Exported By: ObjectTracker value=[1]

  --debug (bool) default=[true]
    Show contours of all object candidates if true
       Exported By: ObjectTracker

  --hrange (jevois::Range<unsigned char>) default=[10...245]
    Range of H values for HSV window
       Exported By: ObjectTracker value=[8...23]

  --objectarea (jevois::Range<unsigned int>) default=[400...10000]
    Range of object area (in pixels) to track
       Exported By: ObjectTracker value=[2000...40000]

  --dilatesize (unsigned int) default=[8]
    Dilation structuring element size (pixels)
       Exported By: ObjectTracker

  --erodesize (unsigned int) default=[3]
    Erosion structuring element size (pixels)
       Exported By: ObjectTracker

Only when streaming to AMCap, the tracking commands show up as expected...

->setpar serout All

OK
T2D -312 -308
T2D -300 -333
T2D -293 -350
T2D -281 -375
T2D -275 -391
T2D -268 -408
T2D -262 -425
T2D -262 -433
T2D -256 -433
T2D -256 -433

Any help is appreciated.

asked Mar 29, 2017 in User questions by franz (1,080 points)

1 Answer

+1 vote
 
Best answer

Everything you did is correct, great job!

But the ObjectTracker demo did not yet (until now) support a non-streaming mode. An additional function process(InputFrame) must be added to the module source code to add this functionality. The code should be quite similar to that in process(InputFrame, OutputFrame) except that it does not create the demo display.

I just added one and pushed it to the jevoisbase github:

https://github.com/jevois/jevoisbase/commit/ca2a50e9262b55ba1738b58ab9a2dacaf9aaebf7

Now to get this running on your JeVois camera, you should basically follow the INSTALL process, here is a short version assuming you have already gone through the easy INSTALL:

cd ~/jevois

git pull  # I also added a new videomapping in there for this new mode

./rebuild-platform.sh

cd ~/jevoisbase

git pull

./rebuild-platform.sh -DJEVOIS_MODULES_TO_BUILDROOT=ON

cd ~/jevois-sdk

./jevois-build.sh

Additional comment: yes, there is some redundancy between the two process() functions now. We believe this is better than having only 1 function, which would then be littered with many if (has_usb_out) { } statements (which would also consume some CPU) to decide whether we have some USB output or not. The clean way to solve this is to create a Component for the vision algorithm, which would contain all the parameters and a simple exposed function to do all the processing. Then process(InputFrame) would just call that function and send strings to serial, while process(InputFrame, OutputFrame) would also call that function and send to serial, but would also build the demo display.

answered Mar 30, 2017 by JeVois (46,580 points)
selected Mar 30, 2017 by franz
I see (pun intended).  Thanks for the explanation, source, and procedure!
I finally had some time to try this out and I confirm the modification works.  Thanks again!
Is there a list of which demos require streaming, and which work in non-streaming mode? (I've looked and can't find this in the documentation). I'm wondering in particular about the Road Following demo.
RoadNavigation can run without streaming.  See answer here for more details... http://jevois.org/qa/index.php?qa=284&qa_1=is-there-a-list-of-which-modules-work-in-non-streaming-mode
...