Hello
How can I make automatic crop around core? like
.

댓글 수: 2

Rik
Rik 2018년 6월 24일
Have a read here (or here for more general advice) and here. It will greatly improve your chances of getting an answer.
wisam kh
wisam kh 2018년 6월 24일
Thank you

댓글을 달려면 로그인하십시오.

 채택된 답변

Image Analyst
Image Analyst 2018년 6월 24일

0 개 추천

Why do you need to crop it?
Anyway, if you do for some reason, you can just binarize and look for the min and max row and column.
binaryImage = imbinarize(grayImage);
[rows, columns] = find(binaryImage);
row1 = min(rows);
row2 = max(rows);
col1 = min(columns);
col2 = max(columns);
croppedGrayImage = grayImage(row1:row2, col1:col2);
imshow(croppedImage);

댓글 수: 5

wisam kh
wisam kh 2018년 6월 24일
Thank you But the crop must be surround a specific point that varies from one image to another, I tried your suggestion and did not succeed
Image Analyst
Image Analyst 2018년 6월 24일
Please post your original gray scale image and the code that you used to binarize and crop the image.
wisam kh
wisam kh 2018년 6월 24일
편집: wisam kh 2018년 6월 24일
</matlabcentral/answers/uploaded_files/122639/imge_with%20core.jpg> this image after preprocessing and finde the core
I am currently using this code But crop measurements are not uniform for all images [X,Y]=get_core(binarize_img); % find core point
i1=X-30;
i2=X-30;
i3=Y-30;
i4=Y-30;
M = imcrop(original_img,[i1 i3 i2 i4]);
figure, imshow(M);title('crop Image');
Image Analyst
Image Analyst 2018년 6월 24일
편집: Image Analyst 2018년 6월 24일
Well there's the problem. You totally ignored my code in my answer, and did it your own (wrong) way. Why?
wisam kh
wisam kh 2018년 6월 25일
I am sorry sir, I did not ignore your answer, but I tried it and did not succeed.
BW=im2bw(img,0.8);
[rows, columns] = find(BW);
row1 = min(rows);
row2 = max(rows);
col1 = min(columns);
col2 = max(columns);
croppedImage = img(row1:row2, col1:col2);
figure, imshow(croppedImage);title('crop Image');
but the problem was here: BW=im2bw(img,0.8);
that should be : BW=~im2bw(img,0.8);
Now the problem has been solved
am sorry
Thank you so much for your time and effort
I apologize to you again

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

질문:

2018년 6월 24일

댓글:

2018년 6월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by