Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Integration of WinForm and Visual C++

Integration of WinForm and Visual C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestioncsharpjson
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kikoso
    wrote on last edited by
    #1

    Dear all, I might ask for help regarding this issue in the list, because I´m pretty sure someone dealt with this in the past. I´ve searched in this forum. There is one similar question, but the solution involves MFC (which does not apply for me) I have coded an application for Visual C++ Express. It basically consists on a VC++ Form and a OpenCV windows displaying video. At some point I recollect the information from the OpenCV Video Window, and I reflect it on the VC++ Form. After finishing the first draft of the application, I was considering improving the interface. The first natural step will be to integrate both OpenCV Window and VC++ Form. I´ve checking the code for cvNamedWindow, and it uses Win32 API (as expected). I´ve looking on the internet, and most of the solutions came by using MFC (which I do not use) or moving to .NET (so late). Does anyone of you have faced this problem? Does anyone has solutions or guidances? Best, Kikoso

    _ 1 Reply Last reply
    0
    • K kikoso

      Dear all, I might ask for help regarding this issue in the list, because I´m pretty sure someone dealt with this in the past. I´ve searched in this forum. There is one similar question, but the solution involves MFC (which does not apply for me) I have coded an application for Visual C++ Express. It basically consists on a VC++ Form and a OpenCV windows displaying video. At some point I recollect the information from the OpenCV Video Window, and I reflect it on the VC++ Form. After finishing the first draft of the application, I was considering improving the interface. The first natural step will be to integrate both OpenCV Window and VC++ Form. I´ve checking the code for cvNamedWindow, and it uses Win32 API (as expected). I´ve looking on the internet, and most of the solutions came by using MFC (which I do not use) or moving to .NET (so late). Does anyone of you have faced this problem? Does anyone has solutions or guidances? Best, Kikoso

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      So are you trying to place the OpenCV window as a child in the Form? How this is done with Window Media Player is that WMP has an activex control which can be placed in a form and instantiated. The activex exposes some methods that can be used to control the video that is played. Check if OpenCV has such an activex control. If not you should check the OpenCV documentation on how this can be done. If it is possible then I'm sure it is documented.

      «_Superman_» I love work. It gives me something to do between weekends.
      Microsoft MVP (Visual C++)

      K 1 Reply Last reply
      0
      • _ _Superman_

        So are you trying to place the OpenCV window as a child in the Form? How this is done with Window Media Player is that WMP has an activex control which can be placed in a form and instantiated. The activex exposes some methods that can be used to control the video that is played. Check if OpenCV has such an activex control. If not you should check the OpenCV documentation on how this can be done. If it is possible then I'm sure it is documented.

        «_Superman_» I love work. It gives me something to do between weekends.
        Microsoft MVP (Visual C++)

        K Offline
        K Offline
        kikoso
        wrote on last edited by
        #3

        Hello Superman, and thank you for your response. OpenCV has not such an ActiveX. Just provide the basics image analyzing algorithms, and a basic Windows system based on Win32 API. After some days checking for it on the internet I have not found a response. There are some clues using MFC, but using just the standard Forms of Visual C++ doesn´t seem possible (or at least obvious). Nevermind, thank you for your interest. If a get a solution I will share it here (and if anybody has more clues, I´ll be pleased of hear them) Cheers, Kikoso

        K 1 Reply Last reply
        0
        • K kikoso

          Hello Superman, and thank you for your response. OpenCV has not such an ActiveX. Just provide the basics image analyzing algorithms, and a basic Windows system based on Win32 API. After some days checking for it on the internet I have not found a response. There are some clues using MFC, but using just the standard Forms of Visual C++ doesn´t seem possible (or at least obvious). Nevermind, thank you for your interest. If a get a solution I will share it here (and if anybody has more clues, I´ll be pleased of hear them) Cheers, Kikoso

          K Offline
          K Offline
          kikoso
          wrote on last edited by
          #4

          Found a solution (and a new problem) to this. I just post the solution in case anyone check it in the future :) I basically transform the IplImage into Bitmap, and then paint it over a Form element. void IplImageToTBitmap (IplImage* image){ System::Drawing::Bitmap^ bitmap = gcnew Bitmap(image->height,image->width * image->nChannels,System::Drawing::Imaging::PixelFormat::Format24bppRgb); int numberOfLines= image->height; int numberOfColums= image->width ;//* image->nChannels; int step= image->widthStep; unsigned char* data=reinterpret_cast<unsigned char*>(image->imageData); for(int i=0; i<numberOfLines; i++){ for(int j=0; j<numberOfColums; j+= image->nChannels){ bitmap->SetPixel(j/3,i,Color::FromArgb(data[j],data[j+1],data[j+2])); } data+= step; } this->panel2->BackgroundImage = bitmap; } Using the sentence this->panel2->BackgroundImage = bitmap; I manage to write the image to a Panel Object (and definitely every object able to support bitmaps). Now I´m trying to work just with the frames from OpenCV not displaying the video (that means, commenting the line cvNamedWindow( "video", 1 );) Nevertheless, the program gets frozen and I´m not able to use it. I´m thinking about doing some stuff with Threads (using a Thread for OpenCV and a different one for the GUI), but any advice will be welcome :) Regards

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups