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

Integration with Image component in Visual C++

jmparrot
Principiante
1.371 Visualizações

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 Respostas
Albert_Stepanov
Novo colaborador I
1.371 Visualizações
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
Novo colaborador I
1.371 Visualizações
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
Principiante
1.371 Visualizações
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
Novo colaborador I
1.371 Visualizações
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

Responder