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

## Min, Max and Mathematical Morphology

Beginner
804 Views

Hi,
The most basic operation in mathematical morphology is the union/intersect operation which, in binary (1-bit) images, is the OR/AND bitwise operation and in the grayscale generalization, the max/min operation.
IPP (IPL) supports the greater/less (ippiCompare_) than functions. This function returns a bit/byte binary mask of which pixels fullfil the condition.
However, this is a problematic approach since it requires multiple operations to produce the max/min image, i.e. the image in which each pixel is the maximum/minimum of the respective pixels of 2 input images.
Considering that most processors (ARM too) contain speacial instructions for such min=/max= operation without branches such functions seem somewhat inefficient.
Does IPP have or will it have such a max/min operation?
I believe it can be made exteremly efficient much more than the current greater/less functions.
Please advise,
Adi
14 Replies
Employee
804 Views

Hi Adi,

the question is does IPP optimized code uses special CPU instructions? The answer is - yes, of course. We always try to use CPU hw capabilities if they can help us to reach better performance.

Regards,
Vladimir

Beginner
804 Views

Hi,

Actually, this wasn't really my question. Since as you say you use special CPU instruction, it seems starnge that there isn't one atomic operation for getting the min(max) of 2 images(arrays).

The current implementation requires keeping an intermidiate result mask e.g for later assignment. Though convenient for some things, other operation can benefit from avoiding this second image pass.

Adi

Employee
804 Views

So, you talk about something like this:

ippiMin_8u_C1R(pSrc1,pSrc2,pDst),

where pDst[i[] = min(pSrc1,pSrc2)

Is that right?

Vladimir

Beginner
804 Views
Exactly!, and, of course, the in-place version and the max versions too.
Adi
Employee
804 Views
Ok, now I understand, thank you. Well, we will consider this request.
If you did notsubmitted yet this request to Intel Premier Support, it would be nice to do it. So it will fall into our data base where it will be tracked.
Regards,
Vladimir
Beginner
804 Views

Sure. Will do.

Thanks,

Adi

Employee
804 Views

By the way, have you seen ippsMinEvery/ippsMaxEvery API in ippSP library? Wesupport 16s/32s/32f data types for in-place operations, so you can use them for images at row-by-row basis.

Vladimir

Beginner
804 Views

Hmm.. I haven't seen this. You're right, I can use this for depths larger than 8-bit.

This is what I wanted for images too.

Thanks,

Adi

Employee
804 Views

Ok, I'm gladthat this info was useful somehow:)

Please do not forget to submit request for new functionality through the premier support service. Of course, it does not mean we automatically accept it, but we will consider it for the next versions of IPP. You understand, it always some compromise between what we want to do and what we can, at least at this moment:)

Thank you,
Vladimir

Beginner
804 Views

Already submitted :-)

Thanks,
Adi

Employee
804 Views
Well, now I am happy:)
Vladimir
Beginner
804 Views
Quoting - ISN Admin
Well, now I am happy:)
Vladimir

Well, five years laster it seems that the requested function is still unavilable.
Moderator
804 Views

Hi,

Have you noticed bellow function :
ippiMinEvery_

It suport 8u, 16u, 16s, 32f type. Is this what your required?

Thanks,
Chao
Beginner
804 Views
Quoting - Chao Y (Intel)

Hi,

Have you noticed bellow function :
ippiMinEvery_

It suport 8u, 16u, 16s, 32f type. Is this what your required?

Thanks,
Chao

I am terribly sorry.
I assumed that that MinEvery_ should belongs to either arithmetic, filtering or comparing operations without looking through the manual.
Thank your for your quick response.