crop image automatically

1 回表示 (過去 30 日間)
mohd
mohd 2012 年 3 月 22 日
i want to crop images automatically at the border of image. please help me. here i give two images.

回答 (1 件)

Junaid
Junaid 2012 年 3 月 22 日
let say your image is I, and if you know your know the areas for your image to crop and those remain for all images then following command should work.
Top = 30;% pixel
bottom =10;%pixels from bottom
margin_left = 30;%pixel from left to right
margin_right = 10;%pixel from right to left
I = rand(729,1024); % random matrix with same dimensions as your image;
J = I(top:size(I,1) - bottom , margin_left:size(I,2) - margin_right);
This should work, you can set the four parameter given above based on your image analysis.
  1 件のコメント
mohd
mohd 2012 年 3 月 22 日
i agree with you. If the border is does not fix. let say i have different image with border is not in same area. what can i do. how to make it automatically set parameter, so that, it can crop every image at the border after detect the border of image.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by