I don't understand this ROI code. can someone explain it?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have this image. How can I know the start row and column as well as off set of this picture? I don't understand the code below.
This is the example code that I've got from tutorial. Can someone please explain to me ?
% you can obtain the coordinates of the rectangular region using
% pixel information displayed by imtool
start_row = 34;
start_col = 208;
cropRGB = RGB(start_row:163, start_col:400, :);
imshow(cropRGB)
% Store (X,Y) offsets for later use; subtract 1 so that each offset will
% correspond to the last pixel before the region of interest
offsetX = start_col-1;
offsetY = start_row-1;
댓글 수: 0
답변 (1개)
Florian Morsch
2018년 5월 11일
편집: Florian Morsch
2018년 5월 11일
Well, this code simply creates a ROI starting at point X 34 and Y 208, with the endpoint at 163 and 400.
You should make your question more clear, how can you know the start row and column? Well, its there in the code, 34 and 208. In the comment its seen you can get the information with imtool, so my guess is someone opened the image, defined a ROI and this ROI starts at 34,208. Could also have started at 30,200... Without more information you cant tell.
I asume you also have some kind of description to the tutorial, so i might guess there is a info on the ROI you want to find. Something like: "Cut out the bike rider" or something like that. So you specify a area you want to crop, which in this example starts at X34 Y208.
The offset is just the starting point of your ROI - 1, its defined by whoever wrote that code, it also could be "offsetX = start_col-20". There are not enough information given why the offset and X/Y are defined like that.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!