how to crop the region image only and eliminate the light
Show older comments
i have some problem,, i caputured imaged from my camera
picture 2 :http://tinypic.com/view.php?pic=zumsjm&s=6
I need coding to solve the problem,,,, ceramic picture above there is still a light on it, how do I get rid of the light (reduce light) ???? and also how to crop that images just crop the region of ceramic tiles? (i ever used coding imcrop , but imcrop just crop into rectanguler not specify on edge)
Answers (1)
Image Analyst
on 5 Jun 2012
Find the tile, like I showed you before. Then use the any() function and find() function to find the top and bottom rows of the binary image, and the left and right edge of the binary image. Then construct your rectangle [x y width height] and pass that in to imcrop. About 7 lines of code (minimum). Something like
hProfile = any(binaryImage, 1);
col1 = find(hProfile , 1, 'first');
col2 = find(hProfile , 1, 'last');
vProfile = any(binaryImage, 2);
row1 = find(vProfile , 1, 'first');
row2 = find(vProfile , 1, 'last');
imcrop(.....
Give it a try.
4 Comments
KURNIAWAN
on 5 Jun 2012
Image Analyst
on 5 Jun 2012
Before I showed you how to get the binary image. That code is the starting point for this code. You add this code onto that code. I gave you nearly everything except the imcrop line. It's something like this:
croppedImage = imcrop(rgbImage, [col1, row1, col2-col1+1, row2-row1+1]);
Walter Roberson
on 5 Jun 2012
It is only possible to crop rectangular regions, because MATLAB can only store rectangular arrays.
You can set areas to have a value such as black (zeros).
KURNIAWAN
on 6 Jun 2012
Categories
Find more on Particle & Nuclear Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!