i would like to know how can i cut a jpg file using a coordinates i want to retrieve using artoolkit and opencv, see:
i want to retrieve coordinates of the white sheet and then use those coordinates to cut a jpg file I’m took before.
Find this but how can this help?
How to slice/cut an image into pieces
If you already have the coordinates, you might want to deskew the image first:
http://nuigroup.com/?ACT=28&fid=27&aid=1892_H6eNAaign4Mrnn30Au8d
This post uses
cv::warpPerspective()to achieve that effect.The references above use the C++ interface of OpenCV, but I’m sure you are capable of converting between the two.
Second, cutting a particular area of an image is known as extracting a Region Of Interest (ROI). The general procedure is: create a
CvRectto define your ROI and then callcvSetImageROI()followed bycvSaveImage()to save it on the disk.This post shares C code to achieve this task.