Ask Your Question

newBee's profile - activity

2018-08-17 07:53:37 -0500 received badge  Popular Question (source)
2017-10-30 23:27:18 -0500 received badge  Famous Question (source)
2016-04-29 05:33:34 -0500 received badge  Popular Question (source)
2016-03-30 13:38:47 -0500 received badge  Notable Question (source)
2016-03-09 22:15:50 -0500 received badge  Notable Question (source)
2015-09-01 13:57:14 -0500 received badge  Popular Question (source)
2015-06-16 11:38:23 -0500 received badge  Famous Question (source)
2015-03-27 06:11:13 -0500 received badge  Student (source)
2014-11-26 17:36:50 -0500 received badge  Popular Question (source)
2014-10-01 12:26:30 -0500 received badge  Notable Question (source)
2014-07-25 06:40:05 -0500 received badge  Popular Question (source)
2013-10-15 04:17:27 -0500 commented answer Print Mat values out to screen and vice versa

Thankz....

2013-10-14 05:57:07 -0500 commented question Print Mat values out to screen and vice versa

Thanks for the info, but how do i get into a string ? and from string back to mat ??

2013-10-14 04:13:10 -0500 asked a question Print Mat values out to screen and vice versa

How can I break Mat into readable format i.e get the row and column values printed and convert that readable value back to Mat again

I want something like this Eg

Mat something;
printf(something) = {{0,0},{0,1},{1,0},{1,1}...etc}

and now convert those back to Mat

{0,0},{0,1},{1,0},{1,1}...etc}=> something

I tried using this

for(int i=0 ; i<something.rows ; i++){
    for(int j=0 ; j<something.cols ; j++){
        printf("something rows and cols: %d %d \n", something.row(i),something.row(j));
    }
}

But I am getting same values

1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2

Any help is appreciated

2013-10-10 03:14:16 -0500 commented answer Replace a part of image with another

Ya it was float, Thank you :)

2013-10-09 06:19:42 -0500 commented answer Replace a part of image with another

Please check my Edit3, you will get what i mean

2013-10-06 23:54:09 -0500 commented answer Replace a part of image with another

I dont necessarily need a rect, but atleast an approx location on screen ?

2013-10-06 23:52:02 -0500 commented answer Replace a part of image with another

Ya I did check those points as these values are obj_corners[0] 0.000000 obj_corners[1] 0.000000 obj_corners[2] 1116892853566439400.000000 obj_corners[3] 1116892707587883000.000000

but cant i get an approximate location on the image where this might be drawn ??

2013-10-04 07:21:30 -0500 commented answer Replace a part of image with another

Hey can i get the xy position where the image is displayed means like the corner points ? like (0,0,150,150) for a 150 X 150 image ?

2013-10-04 01:58:59 -0500 received badge  Scholar (source)
2013-10-03 05:13:01 -0500 commented answer Replace a part of image with another

Please check the edit

2013-10-03 03:42:43 -0500 commented answer Replace a part of image with another

This works fine but draws image at top left of the image, but i need to draw it at the images position Check the edit

2013-10-03 01:49:47 -0500 asked a question Replace a part of image with another

Hi, I created an OpenCV matching using this to match an image

As you can see i got the match using the corners from obj_corners array which is a Point2F, I am trying now to extract the squared part from the image(the target image i mean) into a Mat and replace it with another image

I tried using

Rect roi(10, 20, 100, 50);
cv::Mat destinationROI = img_matches( roi );
smallImage.copyTo( destinationROI );
cv::imwrite("images/matchs2.bmp",destinationROI);

but I am not getting any fruitful result, please suggest what to do ?, How do replace the found target with new image ?

I saw addweighted but dont know how to implement it

EDIT Here is

Mat H = findHomography(obj, scene, CV_RANSAC);
    //Get corners from the image
    std::vector<Point2f> obj_corners(4);
    obj_corners[0] = cvPoint(0,0);
    obj_corners[1] = cvPoint( img1.cols, 0 );
    obj_corners[2] = cvPoint( img1.cols, img1.rows );
    obj_corners[3] = cvPoint( 0, img1.rows );
    std::vector<Point2f> scene_corners(4);
    perspectiveTransform(obj_corners,scene_corners,H);
    //-- Draw lines between the corners (the mapped object in the scene - image_2 )
    line( img_matches, scene_corners[0] + Point2f( img1.cols, 0), scene_corners[1] + Point2f( img1.cols, 0), Scalar(0, 255, 0), 4 );
    line( img_matches, scene_corners[1] + Point2f( img1.cols, 0), scene_corners[2] + Point2f( img1.cols, 0), Scalar( 0, 255, 0), 4 );
    line( img_matches, scene_corners[2] + Point2f( img1.cols, 0), scene_corners[3] + Point2f( img1.cols, 0), Scalar( 0, 255, 0), 4 );
    line( img_matches, scene_corners[3] + Point2f( img1.cols, 0), scene_corners[0] + Point2f( img1.cols, 0), Scalar( 0, 255, 0), 4 );

so how do i code scene_corners[0] + Point2f( img1.cols, 0) as Rect's location

and the obj_corners values are

 obj_corners[0]  0.000000
 obj_corners[1]  0.000000
 obj_corners[2]  1116892853566439400.000000
 obj_corners[3]  1116892707587883000.000000

EDIT2 For example consider this This is image1 and the test image is this. I need to replace the car(1st image) with another image like this

Note: If possible it should stretch as per the image is stretched

EDIT 3

These are the two lines i use to draw line on image

line(image_scene,P1,P2, Scalar( 0, 255, 0), 4);
line( image_scene, scene_corners[0], scene_corners[1] , Scalar(0, 255, 0), 4 );

The P1 and p2 are

CvPoint P1,P2;
P1.x=1073;
P1.y=1081;
P2.x=0;
P2.y=0;

so when i do a printf to get its values, i get like this

printf("image_scene => %d %d\n",image_scene.size().width, image_scene.size().height);
printf("P1 & P2 => %d & %d :: %d & %d \n",P1.x, P1.y, P2.x, P2.y);
printf("scene_corners[0] & scene_corners[1] => %d & %d :: %d & %d \n",scene_corners[0].x,scene_corners[0].y ,scene_corners[1].x ,scene_corners[1].y);

Output

image_scene => 2048 1536
P1 & P2 => 1073 & 1081 :: 0 & 0
scene_corners[0] & scene_corners[1] => -1073741824 & 1081308864 :: -2147483648 & 1081400579

so as you see the image width is just 2048 by 1536 so the x and y should be in between these ranges right ? but what i get it 1073741824,1081308864.. like these numbers

so basically the scene_corners[0 ... (more)

2013-08-16 03:31:46 -0500 received badge  Critic (source)
2013-08-14 01:16:39 -0500 commented answer How to get good matches from the ORB feature detection algorithm?

@Alexander Shishkov Can you answer my question http://answers.opencv.org/question/18436/what-to-do-with-dmatch-value/ how can i compare two images and say if ther are equal or not ?

2013-08-09 06:38:31 -0500 commented answer What to do with DMatch value ?

what is the push_back method in line goodMatches.push_back(i);

2013-08-09 01:50:44 -0500 commented question What to do with DMatch value ?

@mada Can you give some lead on how to do that ?