what (:, :, :) syntax does?
이전 댓글 표시
Hi, I'm new in MatLab and my teacher gave us a code to crop images and split them into his RGB components. This section it's suposed to crop the image (I1) I think (am I right?) and display the cropped image (I2)
u=round(ginput(2));
P12 = u(1,2);
P22 = u(2,2);
P11 = u(1,1);
P21 = u(2,1);
I2=I1(P12:P22,P11:P21,:);
figure
imshow(I2)
axis equal
I think I know what the first line does, it gets two inputs from the mouse and then round it to the nearest integer to finally save them into a vector 'u' right?, in that case, my doubt is what those u(1,2) means, how do they work? what are those 1 and 2 into them? And, how that syntax I2=I1(P12:P22,P11:P21,:) works? why is only the : in the final?
I know I could get the answer by reading the documentation, but what documentation do I have to read? Thank you in advance.
댓글 수: 2
Lateef Adewale Kareem
2022년 5월 24일
you can use that to index 3 dimensional space in a 4 or higher dimensional data.
The question is why would you need that in the first place
Voss
2022년 5월 24일
@Emmanuel Arias Polanco: Here is some documentation you can read that will answer all of those questions:
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!