Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Goran_N
Beginner
59 Views

DMIP reuse graph with different inputs?

I have a set of 10 images that I need to run through a DMIP graph. I would like to have a loop that changes inputs and run "g.Execute()" 10 times. How to do this?
I tried to re-initialize SrcNode, but it wouldn't let me.
I hope I don't have to crate a new Graph for every iteration.

Thanks!
0 Kudos
1 Reply
Sergey_K_Intel
Employee
59 Views

Quoting - Goran N
I have a set of 10 images that I need to run through a DMIP graph. I would like to have a loop that changes inputs and run "g.Execute()" 10 times. How to do this?
I tried to re-initialize SrcNode, but it wouldn't let me.
I hope I don't have to crate a new Graph for every iteration.

Thanks!
Hi!

Currently, the only way to do this is to copy new images into DMIP::Image object. Hope, that all your source images have the same parameters - i.e. data type/ width / height / number of channels - otherwise you will not be able to re-use graph, because during graph compilation all physical image dimensions are used in data calculations.

So, if all your inputs have the same dimensions, you can do the following:
  1. Create a source DMIP::Image object. Before object creation you'll need to allocate space for real image. Then in object constructor you'll specify the buffer parameters - e.g. Image(void* data, IppDataType type, IppChannels chan, IppiSize roi, int step, int top=0, int bot=0, int lef=0, int rig=0, bool inverserow=false)
  2. The above data pointer is the pointer where you can copy new source images to.
  3. After you compile the graph, in the loop, copy next source image from where you keep them to data pointer. Use ippiCopy functions for that.
  4. Execute method will create a destination image. The DMIP::DstNode has the similar DMIP::Image object with output data buffer pointer. You may copy destination image from there to wherever you want. Again, use ippiCopy.
Regards,
Sergey

P.S. New versions of DMIP will have some specific methods to simplify DMIP usage in stream mode, when the graph is the same, but the data is changing.
Reply