Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
6628 Discussions

Integration with Image component in Visual C++

jmparrot
Beginner
186 Views

Hello,

I'm having difficultiesin usingimage IPPfunctions with images loaded by using .NET CLR JPG loading.
Say, by using Image^ FromFile (String^ filename) to load and show them in the form.
I know thatthey are32 bits per pixelin ARGB structure, but I have no success in passing them as arguments to IPP functions.

Are there sample codes whith images read in such way, passed to IPP functions?
Pardon me for so basic question, but unfortunately I'm not able to see the answer...

Thanks in advance for any hint...
Jose

0 Kudos
4 Replies
Albert_Stepanov
New Contributor I
186 Views
Quoting - jmparrot

Hello,

I'm having difficultiesin usingimage IPPfunctions with images loaded by using .NET CLR JPG loading.
Say, by using Image^ FromFile (String^ filename) to load and show them in the form.
I know thatthey are32 bits per pixelin ARGB structure, but I have no success in passing them as arguments to IPP functions.

Are there sample codes whith images read in such way, passed to IPP functions?
Pardon me for so basic question, but unfortunately I'm not able to see the answer...

Thanks in advance for any hint...
Jose

Hi Jose,

I think you should use the Bitmap and BitmapData classes for operation with IPP functions. For example so:

Bitmap^ img =

dynamic_cast(Image::FromFile(filename));

switch( bmpData->PixelFormat ) {

caseSystem::Drawing::Imaging::PixelFormat::Format8bppIndexed:

ippiMirror_8u_C1IR(pSrcDst, bmpData->Stride, roi, ippAxsBoth);

break;

case System::Drawing::Imaging::PixelFormat::Format24bppRgb:

ippiMirror_8u_C3IR(pSrcDst, bmpData->Stride, roi, ippAxsBoth);

break;

case System::Drawing::Imaging::PixelFormat::Format32bppArgb:

ippiMirror_8u_C4IR(pSrcDst, bmpData->Stride, roi, ippAxsBoth);

break;

default:

break;

}

img->UnlockBits(bmpData);

I hope this help you.

Albert

Albert_Stepanov
New Contributor I
186 Views
Excuse me for the bad format.
Again:
Bitmap^ img = dynamic_cast
Rectangle rect = Rectangle(0, 0, img->Width, img->Height);
System::Drawing::Imaging::BitmapData^ bmpData =
img->LockBits(rect, System::Drawing::Imaging::ImageLock<:READWRITE>PixelFormat);
Ipp8u* pSrcDst = (Ipp8u*)((bmpData->Scan0).ToPointer());
IppiSize roi = {img->Width, img->Height};
switch( bmpData->PixelFormat ) {
case System::Drawing::Imaging::PixelFormat::Format8bppIndexed:
ippiMirror_8u_C1IR(pSrcDst, bmpData->Stride, roi, ippAxsBoth);
break;
case System::Drawing::Imaging::PixelFormat::Format24bppRgb:
ippiMirror_8u_C3IR(pSrcDst, bmpData->Stride, roi, ippAxsBoth);
break;
case System::Drawing::Imaging::PixelFormat::Format32bppArgb:
ippiMirror_8u_C4IR(pSrcDst, bmpData->Stride, roi, ippAxsBoth);
break;
default:
break;
}
img->UnlockBits(bmpData);
Albert

jmparrot
Beginner
186 Views
Hi, Albert,
Thanks a lot for your answer.Seems it solves what I have trouble with...
I'll tryadapt your codeto myimage deconvolution application, andinform you ontheresults.
No problem with the previouscommentformat, it isa normalcut&paste susprise!
Jose

Albert_Stepanov
New Contributor I
186 Views
Hi, Jose!
Wish to hear good news from you. If anything you think I can help you, plese feal free to tell me.
Regards,
Albert

Reply