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

Flipping images

coolshashi
Beginner
1,416 Views

Is there an app function to simply flip images vertically / horizontally ?

I see there is funtion to do rotate and mirror. but nothing about flipping.

Shashi

0 Kudos
12 Replies
Aditya_Kadambi
Beginner
1,416 Views

Can't you use mirror function to flip across any particular axis?

0 Kudos
coolshashi
Beginner
1,416 Views

Mirror function mirros the image around vertical or horzontal axis, ie it mirros from the center of the image. is there a way to adjust mirror position not be the center of the image?

All I want is vertical and horizontal flips.Tried mirror, its not what i want.

0 Kudos
Sergey_K_Intel
Employee
1,416 Views

Hi,

Could you be more specific? Suppose you have
  p00 p01 p02 p03
  p10 p11 p12 p13
  p20 p21 p22 p23
  p30 p31 p32 p33 
What image dou you want to get finally?

Regards,
Sergey 

0 Kudos
coolshashi
Beginner
1,416 Views

Horizontal flipping is simply reversing every element in each row (sawpping coulms), vertical flipping is reversing every element in each column(swapping rows)

.after vertical flip it will be

p30 p31 p32 p33

p20 p21 p22 p23

p10 p11 p12 p13

p00 p01 p02 p03

Horizontal flip will result in 

p03 p02 p01 p00

p13 p12 p11 p10

p23 p22 p21 p20

p33 p32 p31 p30

Hope that makes sense.

Shashi

0 Kudos
Sergey_K_Intel
Employee
1,416 Views

Hi Shashi,

Isn't it what ippiMirror is doing?

Regards,
Sergey 

0 Kudos
SergeyKostrov
Valued Contributor II
1,416 Views
Hi everybody, >>...Isn't it what ippiMirror is doing? Exactly. Take a look at a set of Image Processing functions ippiMirror_xxx ( Vertical, Horizontal, or both flips are supported ). Sorry that it took so long to answer your question.
0 Kudos
coolshashi
Beginner
1,416 Views

I looked at Mirror function and used it to see what it does before I asked the question here. It mirros the first half of the image into the second half if I pass Dest and source the same image.

I can make Mirror work by doubling the size of the input and filling only the first half of the image and using a destintation half as much as the source, like its showed in the sample in documnetation.

I was hoping there is a flip image which workds without having to double the image size and pad.

Shashi

0 Kudos
SergeyKostrov
Valued Contributor II
1,416 Views
Description in the ippi.h header file doesn't say anything that pSrc could be equal to pDst. So, this is clearly Not In-place transformation.
0 Kudos
coolshashi
Beginner
1,416 Views

Even then, if you pass a Source 10 X 10 image and pass an empty 10X 10 dest image, Dest image will be filled with sourceimage mirrored at centerline vertically / horzontally / bothway depending on the what flag you pass.

To make the flip image work you have to pad the input to twice the size padding on the right or bottom based on which flip you want.

and use half size Dest. Effectively you are mirroring the enitre image that is of interest.

That's why I asked in the very biggning is there a way to specify the position of the mirror, other than its default to center of the image.. 

Shashi

0 Kudos
Sergey_K_Intel
Employee
1,416 Views

No, I don't understand. Shashi, could you describe your desired image in terms of Pxy matrix? Again, let's you have
p00...p03
...
p30...p33

Regards,
Sergey 

0 Kudos
SergeyKostrov
Valued Contributor II
1,416 Views
>>...Even then, if you pass a Source 10 X 10 image and pass an empty 10X 10 dest image, Dest image will be filled with >>sourceimage mirrored at centerline vertically / horzontally / bothway depending on the what flag you pass... If your images are so small could you post a real example, I mean the Source and Destination ( after processing ) images?
0 Kudos
marrisa
Beginner
1,416 Views

HI there

Here is a code for image flipping:

namespace RE__Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string fileName = "c:/Sample.png";

            REImage reImage = REFile.OpenImageFile(fileName);

            ImageProcessing.ApplyFlipV(reImage);

            REFile.SaveImageFile(reImage, "c:/reimage.png", new PNGEncoder());
0 Kudos
Reply