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

Function for color recognition

Shamma_Almarzooqi
364 Views
hello there,

I was using openCV library to implement some image processing functionalities .. and I used this function

cvInRangeS(imgHSV, cvScalar(24, 100, 150), cvScalar(34, 255, 255),
imageTest[0]);
which basically filter out the colors in this range (This is a iyellow color)

I fail to locate a function which is simmilar to it in IPP .. any help ?

0 Kudos
5 Replies
SergeyKostrov
Valued Contributor II
364 Views
hello there,

I was using openCV library to implement some image processing functionalities .. and I used this function

cvInRangeS(imgHSV, cvScalar(24, 100, 150), cvScalar(34, 255, 255),
imageTest[0]);
which basically filter out the colors in this range (This is a iyellow color)

I fail to locate a function which is simmilar to it in IPP .. any help?


I would try to look at a source code forcvInRangeS function. Does it use any IPP functions?Another optionto
consider is IPP thresholding functions.

Best regards,
Sergey

0 Kudos
Shamma_Almarzooqi
364 Views
void cvInRangeS( const CvArr* src, CvScalar lower, CvScalar upper, CvArr* dst );
src
The first source array.
lower
The inclusive lower boundary.
upper
The exclusive upper boundary.
dst
The destination array, must have 8u or 8s type.

The function cvInRangeS does the range check for every element of the input array:

dst(I)=lower0 <= src(I)0 < upper0

for a single-channel array,

dst(I)=lower0 <= src(I)0 < upper0 &&
     lower1 <= src(I)1 < upper1

for a two-channel array etc.


dst(I) is set to 0xff (all '1'-bits) if src(I) is within the range and 0 otherwise. All the arrays must have the same size (or ROI size)

-------------------------------------------------------

so it is basically like the threshold function, but instead of having ony the minimum or only the maximum value... it has both the max and min .. to include all the values between them..

0 Kudos
SergeyKostrov
Valued Contributor II
364 Views
void cvInRangeS( const CvArr* src, CvScalar lower, CvScalar upper, CvArr* dst );
src
The first source array.
lower
The inclusive lower boundary.
upper
The exclusive upper boundary.
dst
The destination array, must have 8u or 8s type.

The function cvInRangeS does the range check for every element of the input array:

dst(I)=lower0 <= src(I)0 < upper0

for a single-channel array,

dst(I)=lower0 <= src(I)0 < upper0 &&
     lower1 <= src(I)1 < upper1

for a two-channel array etc.

dst(I)
is set to 0xff (all '1'-bits) if src(I) is within the range and 0 otherwise. All the arrays must have the same size (or ROI size)


Do you have the source codes for the OpenCV library? If Yes, try to look at how the cvInRangeSfunction is implemented.

0 Kudos
Shamma_Almarzooqi
364 Views
I looked at the implementation... I can re-code it using IPP basic functions such as the one which give you access to each pixel and then set the value of it .. but I thought there will be a ready function which do such a thing in IPP and will take care of managing the memory ...

0 Kudos
Ying_H_Intel
Employee
364 Views
Hi shamma,

IPP haven'texact function for this. But as sergey suggested, ipp thresholdshould be ofhelp.


for example,
ippThreshold_LTValGTVal

Performs double thresholding of pixel values in an image buffer.


Case 4: In-place operation on multi-channel data

IppStatus ippiThreshold_LTValGTVal_(Ipp* pSrcDst, int srcDstStep, IppiSize roiSize, const Ipp thresholdLT[3], const Ipp valueLT[3], const Ipp thresholdGT[3], const Ipp valueGT[3]);

Description

The function ippiThreshold_LTValGTVal is declared in the ippi.h file. It operates with ROI (see Regions of Interest in Intel IPP).

This function thresholds pixels in the source image pSrc using two specified levels thresholdLT and thresholdGT. Pixel values in the source image are compared to these levels. If the pixel value is less than thresholdLT, the corresponding output pixel is set to valueLT. If the pixel value is greater than thresholdGT, the output pixel is set to valueGT. Otherwise, it is set to the source pixel value. The value of thresholdLT should be less than or equal to thresholdGT.

Best Regards,
Ying H.

0 Kudos
Reply