Using OpenCV with VC++ on Windows Forms Application

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Using OpenCV with VC++ on Windows Forms Application

ahmet emir
Hello everybody,

I did correct project settings in project property pages in order to use OpenCV with VC++.
 and   wrote  code  that found Fast Fourier Transform of image. In order to display image and it's FFT transform of  image in two different picture box components I added this code to my program:

IplImage* img=cvLoadImage("C://lena.jpg",CV_LOAD_IMAGE_GRAYSCALE );

//Display image in picturebox1
this->pictureBox1->Image=(gcnewSystem::Drawing::Bitmap(img->width,img->height,img->widthStep,System::Drawing::Imaging::PixelFormat::Format24bppRgb,(System::IntPtr)img->imageData));

// IplImage* FFTimg is fast fourier transform image of image.

this->pictureBox2->Image=(gcnewSystem::Drawing::Bitmap(FFTimg->width,FFTimg->height,FFTimg->widthStep,System::Drawing::Imaging::PixelFormat::Format24bppRgb,(System::IntPtr)FFTimg->imageData));

 When I start debugging,pictureBox1 can't display image in orginal image  size and pictureBox2  display incorrect FFT image.Could you help me please?

Best regards...



     

[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: Using OpenCV with VC++ on Windows Forms Application

Zeki
Hi Ahmet, I added sample class for viewing saple opencv image. You can
use this control with all .net platform.

Here is the link;

http://f1.grp.yahoofs.com/v1/QPZhSaEbEgemlxFT-
CiBkZjTPQHiqvfOgTH6qubxDVE1aQd71XfyINKf7P292r2P-ALs_3rvsO2WOoc6pjujjUs-
-kvNTFE/Net%20ImageViewer.rar

I you have any question, feel free to ask.

Zeki...

Reply | Threaded
Open this post in threaded view
|

Re: Using OpenCV with VC++ on Windows Forms Application

ejorge19
Hi Zeki, I'm interested in your code, but I get a "Document not found"
error using the link you provided.

--- In [hidden email], "Zeki" <nic0demux@...> wrote:

>
> Hi Ahmet, I added sample class for viewing saple opencv image. You can
> use this control with all .net platform.
>
> Here is the link;
>
> http://f1.grp.yahoofs.com/v1/QPZhSaEbEgemlxFT-
> CiBkZjTPQHiqvfOgTH6qubxDVE1aQd71XfyINKf7P292r2P-ALs_3rvsO2WOoc6pjujjUs-
> -kvNTFE/Net%20ImageViewer.rar
>
> I you have any question, feel free to ask.
>
> Zeki...
>


Reply | Threaded
Open this post in threaded view
|

Re: Using OpenCV with VC++ on Windows Forms Application

Ed Elston
In reply to this post by ahmet emir
Here is code to resize the picture box.  I am making it the same
size as the image first.

WINDOWPLACEMENT wndplImg;
GetDlgItem(IDC_PBOX, &hPBoxWnd);
::GetWindowPlacement(hPBoxWnd, &wndplImg);
wndplImg.rcNormalPosition.left = 10;
wndplImg.rcNormalPosition.right = wndplImg.rcNormalPosition.left +
img->width;
wndplImg.rcNormalPosition.top = 100;
wndplImg.rcNormalPosition.bottom = wndplImg.rcNormalPosition.top +
img->height;
::SetWindowPlacement(hPBoxWnd,  &wndplImg);

Ed

--- In [hidden email], ahmet emir <ahmetemir67@...> wrote:
>
> Hello everybody,
>
> I did correct project settings in project property pages in order
to use OpenCV with VC++.
>  and   wrote  code  that found Fast Fourier Transform of image. In
order to display image and it's FFT transform of  image in two
different picture box components I added this code to my program:
>
> IplImage* img=cvLoadImage("C://lena.jpg",CV_LOAD_IMAGE_GRAYSCALE );
>
> //Display image in picturebox1
> this->pictureBox1->Image=(gcnewSystem::Drawing::Bitmap(img-
>width,img->height,img-
>widthStep,System::Drawing::Imaging::PixelFormat::Format24bppRgb,
(System::IntPtr)img->imageData));
>
> // IplImage* FFTimg is fast fourier transform image of image.
>
> this->pictureBox2->Image=(gcnewSystem::Drawing::Bitmap(FFTimg-
>width,FFTimg->height,FFTimg-
>widthStep,System::Drawing::Imaging::PixelFormat::Format24bppRgb,
(System::IntPtr)FFTimg->imageData));
>
>  When I start debugging,pictureBox1 can't display image in orginal
image  size and pictureBox2  display incorrect FFT image.Could you
help me please?
>
> Best regards...
>
>
>
>      
>
> [Non-text portions of this message have been removed]
>