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

How to copy pixels using a raster?

Alexander_K_9
Beginner
431 Views

Let say there is a 7x5 matrix (16-bit image) with the following values, and a raster with equdistant length of 3 pixels between the lines. So I want to copy every 3rd value into a new 3x2 matrix

 http://i.stack.imgur.com/Hv7D1.jpg

=>

 0  3  6
21 24 27

I tried ippiCopySubpix_16u_C1R  but it does not seem to be the correct function. Do you have any ideas how to solve it? I'm using IPP 5.2.

Thanks.

0 Kudos
1 Solution
b_k_
New Contributor I
431 Views
Hello. On a common PC and For small images up to 640x480, c\c++ implementation might be faster than using IPP. If the images are of constant size and are as small as 5x7 than hard coding is probably the fastest way. That is because the code is reading from only a fraction of the memory. Many rows are not even looked at, and may not even be loaded into the cache ( any real expert, please correct me here if I'm wrong) If you have very big images or want to use IPP anyway you could do the following: For every third row, use the ippsSampleDown function. Very useful function, ippsSampleDown. If you do not have that function in 5.2 you could use a combination of ippscopy, shift, logical and arithmetic ops to do the same. It becomes a little more complex.

View solution in original post

0 Kudos
4 Replies
Chao_Y_Intel
Moderator
431 Views

Hi, 

Can you check the 
ippiCopy_16u_C3C1R ( )

function, and see if it can meet your requirement?

Thanks,
Chao 

0 Kudos
Chao_Y_Intel
Moderator
431 Views


btw, the IPP 5.2 is pretty old version,   if possible,  I would suggest you upgrade to the new IPP versions,  which include the new optimization,  bug fix, etc. 

Thanks,
Chao

0 Kudos
b_k_
New Contributor I
432 Views
Hello. On a common PC and For small images up to 640x480, c\c++ implementation might be faster than using IPP. If the images are of constant size and are as small as 5x7 than hard coding is probably the fastest way. That is because the code is reading from only a fraction of the memory. Many rows are not even looked at, and may not even be loaded into the cache ( any real expert, please correct me here if I'm wrong) If you have very big images or want to use IPP anyway you could do the following: For every third row, use the ippsSampleDown function. Very useful function, ippsSampleDown. If you do not have that function in 5.2 you could use a combination of ippscopy, shift, logical and arithmetic ops to do the same. It becomes a little more complex.
0 Kudos
Alexander_K_9
Beginner
431 Views

Great! Exactly what I wanted. Thanks!

0 Kudos
Reply