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.

Missing python bindings

0 votes

Hi

Still playing A LOT with inventor which is definitely extra cool !!

I think there some python bindings that are missing 

  • convertCvBGRtoCvYUYV() is declared to be available with the magic ad hoc macro but python cannot find it in lib jevois. This is very strange : the doc generator is usually not making a mistake
  • pasteBGRtoYUYV is missing too but this is normal as it is not published. Same thing for pasteRGBtoYUYV

Actually I am building a demonstration for a workshop in a few days and my need is at high level:

  • get an image XxY
  • process the image with a simple pipeline (it's just the counting pips demo)
  • compose a larger result image with:
    • initial image top left
    • final image top right
    • an image for each step on bottom.

The result of the blob detector is a CV BGR image, I need to paste it (as it is only part of my final image) in output frame and function pasteBGRtoYUYV is missing

At this time, I am not stucked, I use

<!--StartFragment-->1 jevois.convertCvBGRtoRawImage(currimg,inimg,0) inimg being initialized with <!--StartFragment-->inframe.get<!--EndFragment-->

2 <!--StartFragment-->jevois.paste(inimg,outimg,int(outimg.width/2),0)<!--EndFragment-->

I see 2 issues in my way of doing things:

  • Probably not the most efficient way
  • I don't know how to create a suitable preallocated raw image for destination parameter. Here I grabbed the raw image returned by inframe.get() and it's ok for my needs but this may be not possible in other contexts

Any suggestion on how doing things in a better way ?

asked Jun 23, 2018 in Programmer Questions by acharroux (140 points)

1 Answer

0 votes
Thanks, we will update these missing bindings as soon as possible. If your method works, great! If you want something more intuitive (but maybe less efficient), just go opencv bgr all the way until the end (where you do a sendCv() of your final bgr image). So, get the input as bgr, compute the results as bgr, create the output assemblage in bgr, and just send that final bgr.

Opencv images in python are numpy arrays. So you can use numpy functions like concatenate, hstack, etc to assemble your output image as a numpy bgr image, then send it off.

Note that it is by design that you cannot create rawimage arrays, as those are shared memory buffers owned by hardware drivers (camera or usb) which have DMA access to them for optimal speed. However, you can paste one image into a bigger one, as you already know and use to transfer your input image to output. Now to transfer your BGR processing result to output rawimage you will indeed pasteBGRtoYUYV
answered Jun 23, 2018 by JeVois (46,580 points)
...