Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

YUV I420 Image Translation

swalton75
Beginner
753 Views
Hello,

I would like to translate a YUV I420 image and fill the x and/or y offset with black pixels. Think of this as horizontal/vertical picture adjustment. Is there anything that I can use in IPP 5.0 that would do the trick?

Thanks!

Shane
0 Kudos
11 Replies
Vladimir_Dudnik
Employee
753 Views

Hello Shane

You can use ippiSet function to set image pixels to desired values. It is not clear what adjustment do you mean? Could you please describe what operation do you need?

Regards,
Vladimir

0 Kudos
swalton75
Beginner
753 Views
Sorry for not being clear.

Suppose I have a constant stream of 30 FPS of 640x480 I420 images. The images being provided may be shifted off "some alignment" by the camera producing the images. What I would like to do is correct the image in software by shifting it with an X and Y value.

Since the final display is 640x480 the software shifted image will not show the complete original image, where the image is void, I would like to replace the missing pixels with black.

The issue seems to be operating on the I420 planes as the U and V planes are not the same step as the Y plane. I don't see any IPP functions that would relate to what I think is called "Geometric Translation".

A picture would make this easier to explain.

Thanks!

Shane
0 Kudos
Vladimir_Dudnik
Employee
753 Views

If you know what part of image should be filled with zeros, I think, you can use tree calls of ippiSet function, each for every plane.

Vladimir

0 Kudos
swalton75
Beginner
753 Views
Thanks.

Okay, how about dealing with the adjusted image. I was hoping that there was a function with and ROI that allows for an X = { -width, +width } and Y = { -height, +height } so I don't have to figure out how to stride through the 420 planes.

I have image 640x480 and want to translate it to a new 640x480 offset by X or Y as stated above, in sense a copy with an ROI.

Shane
0 Kudos
Vladimir_Dudnik
Employee
753 Views

Shane,

there is ippiCopy_8u_C1R function, which work with ROI in image, so you can copy only part of image (one plane in your case). Is it what you are thinking about?

Regards,
Vladimir

0 Kudos
swalton75
Beginner
753 Views
Vladimir,

Along those lines yes, but I need all 3 planes. So I guess the answer is no, IPP doesn't have an I420 Copy method with an ROI.

Thanks for the help Vladimir!

Shane
0 Kudos
Vladimir_Dudnik
Employee
753 Views

Shane,

yes, IPP does not have special function for copying I420 format data, we have color_conversion functions, which takes I420 on input and can produce RGB888/565/555 (just in case you need color conversion after copying you can combine these operations in only one call). But becauseIPP is set of "primitive" functions, you can easily constructI420 copy function by your own on base of low-level IPP functions. Will it fit your needs?

Vladimir

Message Edited by vdudnik on 03-30-2006 10:23 PM

0 Kudos
swalton75
Beginner
753 Views
Vladimir,

Yes, I might try doing a color conversion, operate in the better supported color space and convert back.

What I am afraid of is the performance hit as the to and from conversion equates to 2 extra memcpy(). I wonder if I just wrote my own method, if it would be more efficient.

On another note, is there any way to do a I420_Filter. I see the YCbCr420ToYCrCb420_Filter, but I don't have a 2 plane data set and would rather not interleave the U/V planes to make one.

Shane
0 Kudos
Vladimir_Dudnik
Employee
753 Views

Shane,

when I wrote about color conversion I mean case if your need output to be color converted. In this case you get performance improvement because you implement copy and conversion just in one call. I did not meant forward color conversion and after that conversion back just to implement such simple operation as copy.

If you want to keep YUV color, itshould bebetter to construct your own copy function from three call of ippiCopy_8u_C1R functions, one for each plane

The same about filtering (if you can filter planes independently from each other)

We do not have general image processing functions for every possible data format, you know, in this case we will get 250 000+ functions in ippIP instead of ~2 500 we have now.

Vladimir

0 Kudos
swalton75
Beginner
753 Views
Vladimir,

My misunderstanding. I see what you mean about 3 calls to ippiCopy_8u_C1R. Wow, that wasn't obvious to me. And point well taken about the number of IPP methods, 2,500 is enough to manage.

Thanks for the help!

Shane
0 Kudos
Vladimir_Dudnik
Employee
753 Views
you are welcome:)
0 Kudos
Reply