Ask Your Question

mosta's profile - activity

2019-12-09 13:41:31 -0600 received badge  Notable Question (source)
2019-06-12 14:58:10 -0600 received badge  Popular Question (source)
2017-04-30 03:55:08 -0600 answered a question How to compute occupancy grid in opencv?

sssssssssssssssssssssss

2017-02-18 01:24:34 -0600 received badge  Enthusiast
2017-02-17 02:12:25 -0600 asked a question How to compute occupancy grid in opencv?

I already have disparity image and i want to compute an occupancy grid, is there is a way to do it in Opencv?, i am using opencv 2.4.13 with C++.

2016-10-12 11:42:57 -0600 commented question Access sub-image in opencv

It is written correctly, thanks !

2016-10-12 03:20:21 -0600 asked a question Access sub-image in opencv

Hi,

I am new in opencv, i am using opencv 3.0, i am trying to access a sub-image,

Original image

As i know there is a 2 ways to do it, using rect or range

using range to access the top quarter of the image

using namespace cv;
int main()
{
   Mat img_l = imread("left2.png",IMREAD_GRAYSCALE);
   img_l.convertTo(img_l, CV_64FC1); //convert to double in gray scale
   Mat leftROI = img_l(Range(0, img_l.rows/2), Range(0,img_l.cols/2));
   cv::normalize(leftROI, leftROI, 0, 1, cv::NORM_MINMAX);  //to view
   imshow("opencvtest1",leftROI);
   waitKey(0);
   return 0;
 }

The output is

using rect

using namespace cv;
int main()
{
   Mat img_l = imread("left2.png",IMREAD_GRAYSCALE);
   img_l.convertTo(img_l, CV_64FC1); //convert to double in gray scale
   Mat leftROI = img_l(Rect(0,0, img_l.cols/2 , img_l.rows/2));
   cv::normalize(leftROI, leftROI, 0, 1, cv::NORM_MINMAX);  //to view
   imshow("opencvtest1",leftROI);
   waitKey(0);
   return 0;
 }

The output is

However the output images does not seem right, the sub images are no the top left quarter
but when i use matlab

x = imread('left2.png' );
x = rgb2gray(x);
leftROI = x(1:size(x,1)/2,1:size(x,2)/2);
imshow(leftROI)

The output is ,

The output of matlab seems right

could anyone help why is opencv not right?