Get original but cropped Co-ordinates of image in iOS - ios

I have two images. One is the original (let's say it's 830 x 1222 pixels. The other is a cropped image (let's say 300 x 300 pixels) takend from the original. Cropped image is as per the ratio of the Green rectangle shown in to the sample image below.
What I'm looking for is a way using objective C (iOS) to look at both images and find the coordinates of the cropped image within the original.
Hope that makes sense? Any help appreciated.

Related

Cropping Canny edge detection image

I have scanned images of A5 pages. In the scan they only take up half the page and I want to remove the parts with nothing in it.
I have used canny edge detection to get the edged image and now was wondering how I could crop it so the resulting image is the area within the 4 corner pixels.
image for reference

Finding cropped and scaled similar image

Given several large original images and a small image which is cropped and isotropic-scaled from one of large images, the task is to find where the small image comes from.
cropping usually occur at the center of large image
but exact crop boundary is unknown
the size of small image is about 200x200
again, exact size of small image is unknown
if the size of cropped area is (width, height), the size of small image must be (width * k, height * k), where k < 1.0
I've read some related topics in SO and tried methods like ORB / color histograms, however the accuracy is not acceptable. Would you please give me some advice? Is there any efficient algorithm to deal with this problem? Thank you very much.
The wording you are looking for is template matching, as you want to scan the original image and look for the origin of the cropped and scaled one.
The OpenCV tutorial has an extensive explaination for it

opencv - crop according to coloured points in an image

Given an image with say just two coloured points in it.. Is it possible to crop the image from the coordinates of the first colured point to the coordinates of the second coloured point .
A sample image where i have to crop between two green points
This is possible, if the colored points have a distinct range of color when compared with the rest of the image.
Algorithm:
1. Convert the image to HSV color space
2. Scan the image while looking for pixels in the range of hue and saturation of the color/s of the points.
3. Record minimum and maximum X,Y coordinates of the points that match.
4. calculate the bounding box of the region using the coordinates.
5. Crop the image using the bounding box.
You can try to follow these steps and edit the question with code if/when you come up with errors. Uploading a sample image somewhere and linking to it will help us provide better answers.

OpenCV warp perspective to align and equalize rectangle size

I'm trying to align two rectangles using the perspectiveTransform. In the image below there are the two orange rectangles (I know their dimensions and locations) and I want to warp the perspective so that they are of approximately the same size and in line (the green ones in the image). A perspectiveTransform that e.g. makes the small one equal in size with the big one doesn't really do the trick, as the size of the big one changes too. Any help much appreciated!

How to find if the image has black rectangles of size greater than 5*5

I am trying to write a program in c# or c++, which finds if the image (png or jpg) has a rectangle which is black in color and is greater than size 5 * 5 pixels. If there are multiple such rectangles in an image, it should be able to give me the coordinates of all such rectangles which are black in color.
You could try an Image Correlation:

Resources