How do we matching the features on image with live camera and draw the rectangle?

asked 2020-05-09 05:26:04 -0600

Vasu gravatar image

updated 2020-05-16 07:26:42 -0600

Hi folks, Here, I want to recognize the object with use of SIFT algorithm in OpenCV python and find the missing part on object with live camera (Represent Draw rectangle on missing part).

For example: I am having target image to be recognize with camera in that I removed one part of portion. Now I can able to recognize the target image but i need to be mention that removed part with rectangle compare with target image. I have attached the screenshots.C:\fakepath\IMG_20200508_161924.jpg

C:\fakepath\ultimo_sopravvissuto.jpg![image description]image description

edit retag flag offensive close merge delete

Comments

1

Ciao, bel libro! (for english reader is just "hello, nice book!)

Can you provide an example of the result that you expect in terms of rectangle? You expect in this case 2 rectangles (one for the missing "L'ultimo" and one for the missing yellow part with the author) or one (a top rectangle)?

HYPEREGO gravatar imageHYPEREGO ( 2020-05-09 09:58:00 -0600 )edit

Thank you for the response. Actually, i need to draw rectangle for both parts and i want to mention top part is missing from actual image. I have attached expected output here. And one more question - Can we able to build application for android platform from python.

Vasu gravatar imageVasu ( 2020-05-16 07:26:49 -0600 )edit

Ok, I got it but there are some tricky part. You need to apply an homography to make the two image as have been acquired from the same point of view. So you need the classical pipeline involving feature detector, matcher and homography estimation. Here you should understand if the images that you got from the camera can be very hard to detect: a roubst affine feature detector should be used. Then, after that, you can basically do a subtraction between the images to find the parts that are missing. You can use some threshold to leave out the noise (there will be a lot of noise for sure). After that you should be able to identify the area that is missing, and the problem is just to draw the rectangle, is similiar to find bounding box.

Regarding the last question I've no experience.

HYPEREGO gravatar imageHYPEREGO ( 2020-05-16 08:08:30 -0600 )edit

Hi, I'm struck with one issue while using FindHomography in android studio. For your reference,

 OpenCV(3.4.10) Error: Bad argument (The input arrays should be 2D or 3D point sets) in cv::Mat cv::findHomography(cv::InputArray, cv::InputArray, int, double, cv::OutputArray, int, double), file /build/3_4_pack-android/opencv/modules/calib3d/src/fundam.cpp, line 372

I'm using opencv point variable as input array. Can you please suggest me to sort out the issue.

Vasu gravatar imageVasu ( 2020-05-25 23:26:48 -0600 )edit

Can you provide to me a little bit of more code? The input points should be a std::vector<cv::Point2f> or a cv::Mat (1 to 3 channel). At least 7 points are required but I suggest you to pass something around 50/60 points for a more stable and reliable result

HYPEREGO gravatar imageHYPEREGO ( 2020-05-26 04:42:03 -0600 )edit

Thank you for the response. I fixed the issue I did mistake on description1 variable casting. I had another issue not able to draw rectangle on target object. I followed below coding from opencv java documentation. Its getting line but not form a rectangle on target object.

https://docs.opencv.org/trunk/d7/dff/...

Thanks in advance.

Vasu gravatar imageVasu ( 2020-05-26 07:28:40 -0600 )edit