Ask Your Question

JeyP4's profile - activity

2019-04-09 11:59:47 -0500 marked best answer How to update cv::namedwindow in multi-threading environment?

If 1 callback receives an image and performs some image-processing. How can the output image be shown in multi-threading environment? By multi-threading I mean, if that particular callback(depthCallback) can be invoked by more than one thread.

And, one more query: Is using waitkey(1), optimal for real-time application?

class storedData {
  public:    
    cv::Mat im, depth, outIm;
    void imCallback(const sensor_msgs::CompressedImageConstPtr& msgIm) {
      im = cv::imdecode(cv::Mat(msgIm->data),3);
    }

    void depthCallback(const sensor_msgs::CompressedImageConstPtr& msgDepth)
    {        
      depth = cv::imdecode(cv::Mat(msgDepth->data),0);

      //    Performs something using both images(im & depth), Result : outIm    //

      cv::imshow("view", outIm);
      cv::waitKey(1);
    }
};
int main(int argc, char **argv)
{
  ros::init(argc, argv, "PredictiveDisplay");
  ros::NodeHandle nh;
  storedData obj;
  cv::namedWindow("view", 0);
  cv::startWindowThread();

  ros::Subscriber subIm = nh.subscribe("/image", 2, &storedData::imCallback, &obj);
  ros::Subscriber subDepth = nh.subscribe("/depth", 2, &storedData::depthCallback, &obj);

  ros::AsyncSpinner spinner(2);
  spinner.start();
  ros::waitForShutdown();

  cv::destroyWindow("view");
}
2019-04-09 09:55:45 -0500 edited question How to initialize array of cv::Mat with rows, cols and value?

How to initialize array of cv::Mat with rows, cols and value? How to initialize an array with 10 Mat's? cv::Mat im[10](

2019-04-09 09:54:59 -0500 asked a question How to initialize array of cv::Mat with rows, cols and value?

How to initialize array of cv::Mat with rows, cols and value? How to initialize an array with 10 Mat's? cv::Mat im[10](

2019-04-03 09:21:10 -0500 asked a question How to efficiently represent blobs in binary image with ellipse?

How to efficiently represent blobs in binary image with ellipse? I want to represent blobs with oriented ellipse. I hav

2019-03-30 04:51:46 -0500 commented question How to update cv::namedwindow in multi-threading environment?

In single threading ros::spin(), above code runs well. And update image normally. In multi-threading ros::AsyncSpinner s

2019-03-30 04:49:03 -0500 asked a question How to update cv::namedwindow in multi-threading environment?

How to update cv::namedwindow in multi-threading environment? If 1 callback receives an image and performs some image-pr

2019-03-21 07:30:03 -0500 received badge  Supporter (source)
2019-03-21 04:41:04 -0500 marked best answer How to pass OpenCV Mat(CV_8UC3) to Matlab generated c++ code and vice-versa? Efficiently

'Matlab coder' generated a c++ function. (function name is 'matlab')

matlab(uv0, outImg);

//Before calling, arguments need to declared
emxArray_uint8_T *outImg;
static unsigned char uv0[758016];
emxInitArray_uint8_T(&outImg, 3);

I don't know how 'cv::Mat' can be converted into 'unsigned char uv0'

and

'emxArray_uint8_T *outImg' back into cv::Mat.

//some related function are

static void argInit_376x672x3_uint8_T(unsigned char result[758016])
{
  int idx0;
  int idx1;
  unsigned char result_tmp;
  for (idx0 = 0; idx0 < 376; idx0++) {
    for (idx1 = 0; idx1 < 672; idx1++) {
      result_tmp = argInit_uint8_T();
      result[idx0 + 376 * idx1] = result_tmp;
      result[(idx0 + 376 * idx1) + 252672] = result_tmp;
      result[(idx0 + 376 * idx1) + 505344] = argInit_uint8_T();
    }
  }
}

static unsigned char argInit_uint8_T()
{
  return 0U;
}
2019-03-18 01:13:15 -0500 received badge  Enthusiast
2019-03-14 07:24:18 -0500 edited question How to pass OpenCV Mat(CV_8UC3) to Matlab generated c++ code and vice-versa? Efficiently

How to pass OpenCV Mat(CV_8UC3) to Matlab generated code and vice-versa? Efficiently 'Matlab coder' generated a c++ func

2019-03-14 07:22:36 -0500 asked a question How to pass OpenCV Mat(CV_8UC3) to Matlab generated c++ code and vice-versa? Efficiently

How to pass OpenCV Mat(CV_8UC3) to Matlab generated code and vice-versa? Efficiently 'Matlab coder' generated a c++ func

2018-07-30 05:05:17 -0500 marked best answer How to mask only red channel_C++

How to mask only one channel, say only red channel. e.g.

Mat img = imread("Lena.jpg");
Mat mask = img[:, : , 2]>0;       // I want to do something like this
2018-07-30 04:28:33 -0500 asked a question How to mask only red channel_C++

How to mask only red channel_C++ How to mask only one channel, say only red channel. e.g. Mat img = imread("Lena.jpg");

2018-07-28 19:11:25 -0500 edited question How to perform image warping "projective" without output image size known(similar to matlab)_C++

How to perform image warping "projective" without output image size known(similar to matlab)_C++ Hi In Matlab "imwarp",

2018-07-28 18:09:01 -0500 asked a question How to perform image warping "projective" without output image size known(similar to matlab)_C++

How to perform image warping "projective" without output image size known(similar to matlab)_C++ Hi In Matlab "imwarp",

2018-07-28 17:48:53 -0500 marked best answer Overlap Image in a specific way?_C++

How can following overlapping be performed? Image

Note: Mask can be created with any of R G B layer, because black areas are completely black, i.e. '0' for each R G B's. In this way efficiency can be improved.

In MATLAB this can be done with:

mask = (Im2> 0);           % masking 3 channels (computationally expensive)
Im1(mask) = Im2(mask);     % Im1 will become the final overlapped image
2018-07-28 17:48:53 -0500 received badge  Scholar (source)
2018-07-23 04:29:17 -0500 received badge  Editor (source)
2018-07-23 04:29:17 -0500 edited question Overlap Image in a specific way?_C++

Overlap Image in a specific way? How can following overlapping be performed? Note: Mask can be created with any of R G

2018-07-23 04:28:40 -0500 commented answer Overlap Image in a specific way?_C++

Thnx And how to create the specific mask in opencv?

2018-07-23 04:04:42 -0500 asked a question Overlap Image in a specific way?_C++

Overlap Image in a specific way? How can following overlapping be performed? Note: Mask can be created with any of R G