Jump to content
  • 0

Boumding Box vitis vision for streaming


kouroshkarimi

Question

2 answers to this question

Recommended Posts

  • 0

Hello @kouroshkarimi,
You will also need another Mat (which is actually a FIFO) to act as a consumer, in order for dataflow to work.
If I recall correctly, the bounding box function is not made for streaming applications. As such, you will need to modify it/write a new function to achieve what you are trying to do.  A pseudocode of such a function would look like similar to this (this only uses 1 roi). 

new_boundingbox(src_mat, dst_mat, roi, color) {
  for(i = 0; i < rows; i++) {
     	for(j = 0; j < cols; j++) {
            // read pixel from src mat
            src_pixel = src_mat.read(i * rows + j)
            // check that pixel is located on the rectangle described by x0,y0,x1,y1
            if (is_on_rectangle(src_pixel, roi) {
              // color it
              dst_pixel = color
            } else {
              // keep original pixel
              dst_pixel = src_pixel
            }
            // write data to dst mat
            dst_mat.write(dst_pixel, i * rows+ j)
        }
    }
}
Edited by Niță Eduard
format
Link to comment
Share on other sites

  • 0
On 8/22/2022 at 2:45 AM, Niță Eduard said:

Hello @kouroshkarimi,
You will also need another Mat (which is actually a FIFO) to act as a consumer, in order for dataflow to work.
If I recall correctly, the bounding box function is not made for streaming applications. As such, you will need to modify it/write a new function to achieve what you are trying to do.  A pseudocode of such a function would look like similar to this (this only uses 1 roi). 

new_boundingbox(src_mat, dst_mat, roi, color) {
  for(i = 0; i < rows; i++) {
     	for(j = 0; j < cols; j++) {
            // read pixel from src mat
            src_pixel = src_mat.read(i * rows + j)
            // check that pixel is located on the rectangle described by x0,y0,x1,y1
            if (is_on_rectangle(src_pixel, roi) {
              // color it
              dst_pixel = color
            } else {
              // keep original pixel
              dst_pixel = src_pixel
            }
            // write data to dst mat
            dst_mat.write(dst_pixel, i * rows+ j)
        }
    }
}

thanks it worked.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...