Ask Your Question

tiho_bg's profile - activity

2019-11-02 08:52:48 -0600 received badge  Famous Question (source)
2017-08-25 09:13:42 -0600 received badge  Notable Question (source)
2016-12-15 04:13:29 -0600 received badge  Popular Question (source)
2016-04-15 11:14:07 -0600 asked a question Virtual reality with opencv and Visual C++

Hi

I would like to create a virtual environment using visual C++. I am looking for a suitable library, applied for drawing 3d objects. I would like to draw complex 3D objects. I would like to move them using the keyboard and the mouse of the computer or using any joystick input device. I would like to rotate the 3d objects too.

Therefore I would like to simulate the work of a digital camera. I would like to focus or defocus the objects placed in the working area.

The final task is to create a virtual training simulation software application.

I tried using the library direct3d but it is very difficult to draw and orient 3d objects.

Could you please suggest opencv or another library in combination with visual C++, suitable for my tasks? Could you send me links with similar tutorials using opencv?

Regards

2014-03-11 03:25:20 -0600 commented question How to change the contrast and brightness of the camera?

I have checked cvSetCaptureProperty() on this way:

int ret = cvSetCaptureProperty(capture,CV_CAP_PROP_BRIGHTNESS,trackBar1->Value); if (ret == 0) button2->Text = "OK";

I made this checking and for the other lines with cvSetCaptureProperty and the result is always equal to 1. I think if my camera doesn't support the property CV_CAP_PROP_BRIGHTNESS, it will give me 1 and for the property CV_CAP_PROP_FRAME_WIDTH, it will give me 0. In my case the result always is 1. In this situation this property has to be maintained by my camera.

2014-03-06 04:05:39 -0600 asked a question How to change the contrast and brightness of the camera?

Hi, I am using opencv and microsoft visual studio 2010 express edition. I have made a windows form application for camera (uEye camera) control. I tried to change the contrast and brightness of my camera using this code:

cvSetCaptureProperty(capture,CV_CAP_PROP_BRIGHTNESS,trackBar1->Value);
cvSetCaptureProperty(capture,CV_CAP_PROP_CONTRAST,trackBar2->Value);

There are no errors but the brightness and the contrast are the same as previous without a change.

Could you please give me an advise.

Here is my code:

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

             capture = cvCaptureFromCAM(0);

             cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH,640) ;

             cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT,480) ;

             cvSetCaptureProperty(capture,CV_CAP_PROP_FPS, 40.00) ;

             cvSetCaptureProperty(capture,CV_CAP_PROP_BRIGHTNESS,trackBar1->Value);
             cvSetCaptureProperty(capture,CV_CAP_PROP_CONTRAST,trackBar2->Value);   

             timer1->Start();
         }

private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {

             IplImage* frame = cvQueryFrame(capture);


             pictureBox2->Image  = gcnew    //replacement of cvShowImage
                 System::Drawing::Bitmap(frame->width,frame->height,frame->widthStep,
                 System::Drawing::Imaging::PixelFormat::Format24bppRgb,(System::IntPtr) frame->imageData);

             pictureBox2->Refresh();

                     gray = cvQueryFrame(capture);

             cvThreshold(frame, gray, 100,255,CV_THRESH_BINARY_INV);
             pictureBox1->Image  = gcnew    //replacement of cvShowImage
                 System::Drawing::Bitmap(gray->width,gray->height,gray->widthStep,
                 System::Drawing::Imaging::PixelFormat::Format24bppRgb,(System::IntPtr) gray->imageData);

            pictureBox1->Refresh();

         }
2014-02-26 07:55:31 -0600 commented answer How to acquire image with opencv and Windows Form Application

Thank you for your answer my Bulgarian friend. How to make this kind of checking of the timer? This code below is working better for me but when I would like to start the application again I saw that the .exe file was not stopped. May be something is wrong with my timer. What is the problem?

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

capture = cvCaptureFromCAM(0);

timer1->Start();

         }

private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {

             frame = cvQueryFrame(capture);

pictureBox1->Image = gcnew //replacement of cvShowImage

System::Drawing::Bitmap(frame->width,frame->height,frame->widthStep,

System::Drawing::Imaging::PixelFormat::Format24bppRgb,(System::IntPtr) frame->imageData);

pictureBox1->Refresh(); }

private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {

                 timer1->Stop();
             Application::Exit();
         }
2014-02-26 04:22:25 -0600 asked a question How to acquire image with opencv and Windows Form Application

Hi

I would like to open USB camera and acquiring images under windows form application. I create an application but the streaming of images is going very slowly (The images appear and disappear in big intervals). Where is my error. Using a console application there is no such a problem. Here is my code.

timer1->Interval = 1;
VideoCapture cap(0);
Mat frame;
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

                 timer1->Start();

     }
    private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {

                 cap.read(frame);

                 graphics = pictureBox1->CreateGraphics();
                 System::IntPtr ptr(frame.ptr());

                 b  = gcnew System::Drawing::Bitmap(frame.cols,frame.rows,frame.step,System::Drawing::Imaging::PixelFormat::Format24bppRgb,ptr);
                 System::Drawing::RectangleF rect(0,0,pictureBox1->Width,pictureBox1->Height);

                 graphics->DrawImage(b,rect);

                 pictureBox1->Refresh();
             }
2014-02-24 04:47:10 -0600 commented answer How to set manually mat properties?

I have tried setting CV_F32 but there is an error. I wanted to try making my image colored. Why it is not allowed here?

2014-02-24 04:45:31 -0600 commented answer How to set manually mat properties?

Thank you for your answers. The bytesperPixel is equal to 0 in my case. I have used CV_16U because otherwise it is in stripes. But now imshow("image", img) give me a black window. There are no errors. I have added waitKey(0). Could you please suggest something?

2014-02-23 09:45:20 -0600 commented answer How to set manually mat properties?

Thank you for the help. I have tried the color img example. There is no errors. I have an image data now but imshow("image" img) give me a gray window. I have checked the code in debug mode and I saw that: img.allocator has an error: _vfptr CXX0030:Error: expression can not be evaluated

Is it normal that error or not? May be the gray window means that my image is converted from RGB to GRAY, isn't it? Could you pleas help me to resolve this problem?

2014-02-23 02:07:07 -0600 asked a question How to set manually mat properties?

Hi

I would like to ask is it possible in opencv to set manually all mat properties. I am using a specialised camera were it is not possible to recognise it with opencv funcions. I would like to vizualise the data image of the camera using opencv but combining it with the opening funcitons offered by the manufacturer. I saw that when the image is ready there is a variable structure that has the following parameters:

typedef struct tag_mexImg
{
  unsigned long Version;        //!< [in] Version, currently it must be 'V003' (MEXIMGVERSION)<br>
  unsigned long Bytes;          //!< [in] Amount of bytes of this struct (sizeof(mexImg)).<br>
  int           dimX;           //!< [in/out] Horizontal pixel dimension of image<br>
  int           dimY;           //!< [in/out] Vertical pixel dimension of image<br>
  void*         pBw;            //!< [in/out] Pointer to memory for monochrome image or for the \link page27 DIB-format \endlink<br>
  void*         pRed;           //!< [in/out] Pointer to memory for red image channel<br>
  void*         pGreen;         //!< [in/out] Pointer to memory for green image channel<br>
  void*         pBlue;          //!< [in/out] Pointer to memory for blue image channel<br>
  int           channels;       //!< [in] to take from enum mex_channels<br>
  unsigned int  bitmask;        //!< [out] Bitmask of significant bits in image pixel data<br>
  unsigned long stdTicks;       //!< [out] Realized exposure standard ticks<br>
  unsigned long addTicks;       //!< [out] Realized exposure additional ticks<br>
  unsigned long channelBytes;   //!< [in/out] Realized amount of bytes per color channel<br>
  int           posX;           //!< [out] X-position code of a single image from an unassembled scan (::mexAcquisParams::runas = runas_scan)<br>
  int           posY;           //!< [out] Y-position code of a single image from an unassembled scan (::mexAcquisParams::runas = runas_scan)<br>
  unsigned long bytesperPixel;  //!< [in/out] Bytes per pixel and color (should be 1 or 2)<br>
  unsigned long orientation;    //!< [out] Flip conditions with respect to ::mex_orientation<br>
  unsigned long exposuretime;   //!< [out] exposure time - [microseconds}<br>
  int           colorMask;      //!< [out] A value from enum  ::mexColorMask <br>
  unsigned __int64 timestamp;   //!< [out] timestamp<br>
  unsigned long user_index;     //!< [in/out] instead of reserved[user_index]<br>
  unsigned long HdNr;           //!< Identifier, coming from frame header<br>
  unsigned long Time[4];        //!< time stamps for logging purposes<br>
  unsigned long reserved[4];    //!< Reserved for future use<br>
} mexImg;

I saw that my variable Mat frame has different parameters as: Mat frame;
frame.addref();
frame.allocator;
frame.channels();
frame.cols;
frame.rows;
frame.data;
frame.datastart;
frame.dataend;
frame.datalimit;
frame.depth();
frame.dims;
frame.flags;
frame.refcount;
frame.reserve();
frame.size;
frame.step;


I think that if I want to visualize the image by imshow("image", frame); I have to set all the parameters of the Mat structure.

Could you help to resolve the problem?

2014-02-19 06:14:52 -0600 asked a question How to integrate Opencv with specific camera control libs from the manufacturer?

Hi I am using the camera ProgRes speedxt core 5. I wanted to work with this camera using opencv but unfortunately it is not possible in fact. I have startet to read the libs of the camera sent by the manufacturer. Now I can open the camera but I would like to visualize the image on the desctop using opencv library. Could somebody help me? Here is my code for opening the camera:

#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\opencv.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <iostream>
#include <time.h>
#include <Windows.h>
#include "MexCam.h"
#include "MexCC.h"
#include <iomanip>
#include <process.h>


using namespace cv;
using namespace std;

int __stdcall CompletionProc (unsigned long status, mexImg* pImg, mexUsrVal completionUser);

int imageCounter=0;
mexImg Imgs[3]; // 3 images for CC-Live
mexImg* ImgPointerList[3]={&Imgs[0],&Imgs[1],&Imgs[2]}; // List of pointers to use in calls to mexAcquire
mexAcquisParams Pars;
//HANDLE hThread=NULL;
DWORD dwThreadID=0;

unsigned long channelBytes;

int main(){

unsigned __int64 GuidList[5]={0,0,0,0,0};
unsigned int NumberOfCameras=5;
unsigned char *pRgbI = new unsigned char[channelBytes];

    // MexConsole must announce begin of session with MexJCam.dll
mexInit(NULL,0); // By NULL,0 no callback are requested with respect to plug and play events for FireWire-cameras

  // Find all present ProgRes-cameras
  long mexResult=mexFindCameras(&NumberOfCameras,GuidList);

  long mexOpen=NOCAMERA;
  char q='q';
  int i=0;

  for(i=0; i<3; i++)
  {
    memset(&Imgs[i],0,sizeof(mexImg));
    Imgs[i].Bytes=sizeof(mexImg);
    Imgs[i].Version=MEXIMGVERSION;
  }

  if(NOERR==mexResult && NumberOfCameras>0)
  {
    mexCameraTypeSummary camTS;
    mexGetCameraTypeSummary(GuidList[0],&camTS);
    cout << "Try to open Camera " << camTS.TypeName << endl << endl;
    mexOpen=mexOpenCamera(GuidList[0]); // Use the first found camera
    if(NOERR==mexOpen)
    {
      cout << "Camera " << camTS.TypeName << " successful opened." << endl;
      cout << "Camera GUID " << setbase(16)<< setw(16) << setfill('0') << GuidList[0] << endl << endl;
      mexCamInfo camInfo;

      memset(&camInfo,0,sizeof(mexCamInfo));

      mexImageInfo imgInfo;
      memset(&imgInfo,0,sizeof(mexImageInfo));

      memset(&Pars,0,sizeof(mexAcquisParams));
      Pars.Bytes=sizeof(mexAcquisParams);
      Pars.Version=MEXACQUISPARAMSVERSION;
      mexCamType camtype=mexGetCameraType(GuidList[0]);
      mexResult=mexGetCameraInfo(GuidList[0],&camInfo);
      if(NOERR==mexResult)
      {
        // prepare acquisition parameter
    //    Pars.runas=runas_snap;
        Pars.runas=runas_cclive;
        switch(camtype)
        {
          case cam10plus:
          case cam12plus:
            Pars.mode=mexShot2F_lowqualitycol;
            break;
          case cam14Cplus:
            Pars.mode=mexc14_Shot_colhighres;
            break;
          case cam14Mplus:
            Pars.mode=mexm14_Shot_bwhighres;
            break;
          case camCt3:
            Pars.mode=mexct3_std;
            break;
          case camC7:
            Pars.mode=mexC7_colhighspeed1;
            break;
          case camC3usb:
               //LinCi
               Pars.mode = mexC3usb_bin2col;
               break;
          case camC5usb:
              Pars.mode = mexShot2F_Raw;// This is my camera;
              cout << "My camera" << endl;
              break;


        }
        ::SetRect(&Pars.rcsensorBounds,0,0,camInfo.SensorX,camInfo.SensorY);
        Pars.buseblackref=FALSE;
        Pars.busewhiteref=FALSE;
        Pars.bwhitebalance=FALSE;
        Pars.correctColors=0;
        Pars.ciCode=0;
        Pars.ccdtransferCode=0;
        Pars.notifymask=0;
        Pars.stdTicks=::mexMSecToTicks(GuidList[0],10,Pars.mode,0); // 10 milliseconds
        Pars.addTicks=0;
        Pars.complProc=&CompletionProc;
        Pars.completionUser=0;
        Pars.progressProc=NULL;
        Pars.progressUser=0;

        mexResult=mexGetAcquisitionInfo(GuidList[0],&Pars,&imgInfo);
        if(NOERR==mexResult)
        {
               channelBytes=imgInfo.DimY*imgInfo.DimX*imgInfo.PlaneBytes;        
          if(mex_chan_dib==imgInfo.Channels)
          {
            channelBytes=((3*imgInfo.DimX+3)&0xfffffffc)*imgInfo.DimY;
          } 

          // attention: Set all available information into ...
(more)
2014-02-17 08:33:37 -0600 asked a question How to use firewire camera with opencv?

Hi

I would like to ask how to use firewire camera with opencv? My camera is progres speedxt core5. Normally it is with USB cable but when I was starting the driver installation on windows 7 x64 it was installed T1394bus driver (driver from thesycon). I have tried to open my camera with the standart code. After build execution there were no errors but in the line: imshow("wind1", frame); the program was stopped. I have checked the call stack and I saw that the program was stopped in >
ntdll.dll!776615de()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]

I have checked the code with a simple webcam and with a specialised usb ueye camera and everything was OK. Unfortunately with the firewire camera it was not possible to work. Could you please help me to resolve the problem. May be it will be necessary to use another software as directshow par example.

Here is my code:

#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\opencv.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main(){

    VideoCapture cap(0);
    cap.open(0);
    if (false)
    {
        return -1;
    }
    namedWindow("wind1", 0);
 Mat frame;  
 while(1)

 {
         cap>>frame;
    imshow("wind1", frame);
         int key = cvWaitKey(1);
    if (key == 27) break;
         }
    return 0;
}
2014-02-06 01:49:46 -0600 asked a question Console Application or Windows Form Application?

I would like to ask about the difference between the console application and windows form application. I know that the design is made better using windows form application. My question is related with the working speed of an application. Is it possible to speed up my application using console application? I would like to ask about the difference and the advantages of the MFC application?

2014-02-05 11:24:32 -0600 received badge  Scholar (source)
2014-02-05 11:22:46 -0600 commented answer How to accelerate my camera control?

Thank you for the information. I would like to ask is it possible to use IPP library with opencv 2.48 for speeding up the object tracking and image processing or opencl and cuda are the best solution?

2014-02-05 07:20:53 -0600 asked a question How to accelerate my camera control?

I am working with opencv 2.48 and visual studio 2010. When I add into my code Gaussian filtering and canny edge detection, the time of the image capturing was increased. How can I accelerate this process. If I have to add more functions for image processing and object tracking I thing that the speed for image capturing will be decreased more? I am using uEye camera 1490-M-GL.

Here is my code:

#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\opencv.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main(){
    VideoCapture cap(0);
    cap.open(0);
    if (false)
    {
        return -1;
    }

    cap.set(CV_CAP_PROP_FRAME_WIDTH, 3840);
    cap.set(CV_CAP_PROP_FRAME_HEIGHT, 2748);
    cap.set(CV_CAP_PROP_FPS, 30.00);
    cap.set(CV_CAP_PROP_POS_MSEC, 300);

    int width = cap.get(CV_CAP_PROP_FRAME_WIDTH);
    int height = cap.get(CV_CAP_PROP_FRAME_HEIGHT);
    double fps = cap.get(CV_CAP_PROP_FPS);

    namedWindow("wind1", 0);
    namedWindow("wind50", 0);
        IplImage* videoFrame = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);

        cout << "W" << width << "FPS" << fps << endl;

        Mat gray;
        int counter = 0;

        while(1)
        {
       Mat frame; 
       cap.read(frame);

       imshow("wind1", frame);

       if (!frame.data) break;

       cvtColor(frame, gray, COLOR_BGR2GRAY);
       GaussianBlur(gray, gray, Size(7,7), 1.5, 1.5);
           Canny(gray, gray, 0, 30, 3);

       imshow("wind50", gray);
       }
       return 0;
}
2014-02-04 11:10:48 -0600 asked a question Opencv How to find the highest Intensity?

I am working with opencv 2.48 and visual studio 2010. I would like to find the highest intensity of the image moving the camera back and fourth. Could you please give me an advise? Here is my code:

#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\opencv.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main(){
    VideoCapture cap(0);
    cap.open(0);
    if (false)
    {
        return -1;
    }

    namedWindow("wind1", 0);

    cap.set(CV_CAP_PROP_FRAME_WIDTH, 3840);
    cap.set(CV_CAP_PROP_FRAME_HEIGHT, 2748);
    cap.set(CV_CAP_PROP_FPS, 30.00);
    cap.set(CV_CAP_PROP_POS_MSEC, 300);

    int width = cap.get(CV_CAP_PROP_FRAME_WIDTH);
    int height = cap.get(CV_CAP_PROP_FRAME_HEIGHT);
    double fps = cap.get(CV_CAP_PROP_FPS);
        IplImage* videoFrame = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);

        cout << "W" << width << "FPS" << fps << endl;

        Mat frame, gray;
        while(1)
       {

    cap.read(frame);
    if (!frame.data) break;
    cvtColor(frame, gray, COLOR_BGR2GRAY);
    threshold(frame, gray, 100,255,CV_THRESH_BINARY_INV);

    imshow("wind1", gray);
        int key = cvWaitKey(10);
    if (key == 27) break;
        cout << "imshow" << endl;

    }
    return 0;
}
2014-02-02 09:49:06 -0600 received badge  Editor (source)
2014-02-02 09:43:40 -0600 asked a question Don't capture frames of the camera???

I am working with opencv 2.48, visual studio 2010 C++ and a professional camera UI-1490SE (uEye camera). I have realised that opencv is working better with normal web-cams but with professional cameras it is necessary to make all settings first. I would like to start live streaming of the camera using opencv but it is something wrong in my code. I think that I can't capture frames of the camera. The screen is black all the time. Here it is:

#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\opencv.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <iostream>

using namespace cv;

int main ()
{
  VideoCapture cap(0);
  cap.open(0);
  if (false)
  {return -1;}

  cap.set(CV_CAP_PROP_FRAME_WIDTH, 3840);
  cap.set(CV_CAP_PROP_FRAME_HEIGHT, 2748);
  cap.set(CV_CAP_PROP_FPS, 30.00);

  int width = cap.get(CV_CAP_PROP_FRAME_WIDTH);
  int height = cap.get(CV_CAP_PROP_FRAME_HEIGHT);
  double fps = cap.get(CV_CAP_PROP_FPS);

  IplImage* videoFrame = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
  cvNamedWindow("wind");

  Mat frame;
  while(1)
  {
    frame = videoFrame;
    cap.read(frame);

    if(!frame.data) break;
    imshow("wind", frame);
    if (waitKey(30) == 27)
    {
      cout << "esc key:" << endl;
      break;
    }
  }
  cvReleaseImage(&videoFrame);
  cvDestroyWindow("wind");
  return 0;
}