MATLAB: Hello, How to crop this image if you please

backgroundcroppingimage processing

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

Best Answer

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.