Hello, How to crop this image if you please?

1 view (last 30 days)
I wanna crop this image. I have some other images like those but with different currencies so I want something that can be applied to all of them in order to differentiate them. Thanks
  2 Comments
Chad Greene
Chad Greene on 20 Jun 2014
I don't think crop is the word you're looking for if you simply want to differentiate between different types of currency. Cropping simply means to cut the edges off of the image. Principal component analysis may help you automatically identify different types of currency.
Abeer
Abeer on 20 Jun 2014
I got your point, cropping itself wouldn't differentiate between them. But it's a step before applying some operations on the images because not all images have identical backgroud so I want to crop it.
From your point of view, how can i differentiate between the previous image and this one? You could tell me a new idea other than mine.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 21 Jun 2014
This is very trivial if you just simply put the notes over the proper colored background. For notes with light colored borders, put them on black construction paper. Then it's pretty trivial - there are at least three ways I can think of off the top of my head. It's so much easier to do image processing when you start with a good image than to try things to "fix up" a crummy image image before you can start the image processing. See attached m-file, test3.m, which will produce the image below (where I darkened the surround to simulate you taking your photo on the proper background).
Basically what I did was to convert to graylevel and threshold. Then call regionprops() to get the bounding box. Finally call imcrop() to crop out the image into a new, smaller image.
  5 Comments
Abeer
Abeer on 28 Jun 2014
I am so sorry, but could you help me with this too? It's a scanned image so the white background is constant. Can it be cropped? but I don't want to use the imcrop because I have different sizes of currencies images.
Thanks in advance
Image Analyst
Image Analyst on 28 Jun 2014
Why don't you just tape black paper to the lid? You can get the note in a variety of ways, such as by converting to gray scale and thresholding, cropping from know coordinates, or getting the sum vertically and horizontally and looking for smooth and "rough" parts, or by using a texture filter such as entropyfilt() or stdfilt() to find smooth parts and taking the largest smooth area as a background mask. What approach do you want to try? If you try one and want me to look over your code, attach it.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!