When I crop image Width and Height is decrease
이전 댓글 표시
I attach a file code and picture. before use imcrop Width and Height are decrease. it not real value
Please help me
답변 (1개)
Walter Roberson
2017년 2월 17일
The line
[columns, rows] = find(BW);
should be
[rows, columns] = find(BW);
댓글 수: 9
Adisorn Phanukthong
2017년 2월 17일
편집: Adisorn Phanukthong
2017년 2월 17일
Adisorn Phanukthong
2017년 2월 17일
Walter Roberson
2017년 2월 17일
Sure, go ahead and clear the variable. Doing that will not do anything useful, though, but it will help reassure you that it is not a problem with a variable being left around.
Walter Roberson
2017년 2월 17일
You show different values for BWAREA, Dispersion, PERI, aspect, cen, columns, height, rows, and width. imcrop() does not write to any of those variables. Your im variable also does not exist before you do the imcrop() so it is not possible for im to have a different value that is being changed by the imcrop(). You are also not saving the value of im anywhere.
So I do not know what you are doing.
The size extracted is going to change between frames. The code finds the narrowest and shortest box that can fit around the white pixels, and that is going to change as the person walks.
If you want to extract the same size of image for all of the frames, you are going to have to alter your code for that purpose, and since the individual images are going to be thinner or taller at different times, you would have to define where in the fixed-sized box you wanted each current image to be put.
Adisorn Phanukthong
2017년 2월 17일
Walter Roberson
2017년 2월 17일
"clear all" does even less that is useful than clearing an individual variable.
What exactly are you comparing? As I wrote before,
"Your im variable also does not exist before you do the imcrop() so it is not possible for im to have a different value that is being changed by the imcrop(). You are also not saving the value of im anywhere."
Be specific. Are you putting in a breakpoint at the assignment to im in the routine, and then on the first frame you are taking the output of im and doing something to it? And then you are continuing to the second frame and trying to compare the result of im of the second frame with the result of im of the first frame?
Because if that is what you are doing then you need to expect that the results will be different. As the person walks, their leg moves out and that makes the occupied part of the image wider, changing the width, and when their leg swings back again the occupied part of the image would get narrower again.
Adisorn Phanukthong
2017년 2월 17일
Walter Roberson
2017년 2월 17일
Put a breakpoint on the line that calls imcrop. Record the workspace contents. Then give the command
dbstep
at the command line so that imcrop is called. Record the workspace content again. Show us both workspaces.
Image Analyst
2017년 2월 20일
Adisorn, I have no idea what you're doing but of course if you crop an image to be smaller than it is, of course it will be smaller than before the crop. Also, it two images have different bounding boxes, of course they will be different sizes after cropping. Are you expecting anything different?
카테고리
도움말 센터 및 File Exchange에서 Image Segmentation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



